Skip to content

Docker Build Failure for Cedar Lean CLI #653

Closed
@clairew

Description

@clairew

Before opening, please confirm:

Bug Category

Other

Describe the bug

I used the provided Dockerfile in cedar-spec/cedar-lean-cli to build the CLI, and the docker build fails.

Expected behavior

Docker build doesn't fail.

Reproduction steps

# Create a docker image that is identified with the tag "cedar-lean-cli"
cd cedar-lean-cli                                   # Enter the cedar-lean-cli directory
docker build -t cedar-lean-cli -f ./Dockerfile ..

Code Snippet

In cedar-spec/cedar-lean-ffi/src/messages.rs

impl proto::ValidationRequest {
    pub(crate) fn new(policyset: &PolicySet, schema: &Schema, mode: &ValidationMode) -> Self {
        Self {
            schema: Some(cedar_policy::proto::models::Schema::from(schema)),
            policies: Some(cedar_policy::proto::models::PolicySet::from(policyset)),
            mode: cedar_policy::proto::models::ValidationMode::from(mode).into(),
        }
    }
}

Log output

15.83    Compiling cedar-policy-formatter v4.5.0
26.88 error[E0277]: the trait bound `cedar_policy::proto::models::ValidationMode: From<&cedar_policy::ValidationMode>` is not satisfied
26.88    --> /opt/src/cedar-spec/cedar-lean-ffi/src/messages.rs:177:19
26.88     |
26.88 177 |             mode: cedar_policy::proto::models::ValidationMode::from(mode).into(),
26.88     |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `From<&cedar_policy::ValidationMode>` is not implemented for `cedar_policy::proto::models::ValidationMode`
26.88     |
26.88     = help: the trait `From<&cedar_policy::ValidationMode>` is not implemented for `cedar_policy::proto::models::ValidationMode`
26.88             but trait `From<&cedar_policy_core::validator::ValidationMode>` is implemented for it
26.88     = help: for that trait implementation, expected `cedar_policy_core::validator::ValidationMode`, found `cedar_policy::ValidationMode`
26.88
26.92 For more information about this error, try `rustc --explain E0277`.
26.92 error: could not compile `cedar-lean-ffi` (lib) due to 1 previous error
26.96 error: failed to compile `cedar-lean-cli v4.4.0 (/opt/src/cedar-spec/cedar-lean-cli)`, intermediate artifacts can be found at `/opt/src/cedar-spec/cedar-lean-cli/target`.
26.96 To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.
------
Dockerfile:48
--------------------
  47 |     WORKDIR $CEDAR_SPEC_ROOT/cedar-lean-cli
  48 | >>> RUN source /root/.profile \
  49 | >>>   && source ../cedar-lean-ffi/set_env_vars.sh \
  50 | >>>   && cargo install --path .
  51 |
--------------------
ERROR: failed to solve: process "/bin/sh -c source /root/.profile   && source ../cedar-lean-ffi/set_env_vars.sh   && cargo install --path ." did not complete successfully: exit code: 101

Additional configuration

No response

Operating System

No response

Additional information and screenshots

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions