Skip to content

Building in a jenkins pipeline with docker. #46

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
theherk opened this issue Aug 29, 2022 · 0 comments
Open

Building in a jenkins pipeline with docker. #46

theherk opened this issue Aug 29, 2022 · 0 comments

Comments

@theherk
Copy link

theherk commented Aug 29, 2022

I am struggling to sort two things out. I am attempting to build inside a declarative jenkins pipeline. Like this:

def container = docker.image("rustserverless/lambda-rust").run(
    '-i ' +
    '--env CARGO_FLAGS=--arm64 ' +
    '-u "$(id -u)":"$(id -g)" ' +
    '-v ${PWD}:/code '
)

This fails with:

error: Found argument '--arm64' which wasn't expected, or isn't valid in this context

	If you tried to supply `--arm64` as a value rather than a flag, use `-- --arm64`

Fair enough, that was based on a custom argument for cargo lambda. I'm not sure how to correctly target arm64 in this context.


Even if I remove this, though, I get:

Caused by:
  failed to create directory `/cargo/registry/index/github.com-1ecc6299db9ec823`

Caused by:
  Permission denied (os error 13)

But, I don't understand as I haven't mounted a volume for the registry so it seems these should be within the container. Seems this container should have all the permissions required to create a directory within the container, and I thought mounting these were optional for improved builds. Any help would be appreciated.


Maybe the right thing to do is just install cargo-lambda within the container. I'm not really sure what the correct workflow is here.


Actually, I can't run this locally either. Running with podman on mac, presents the same error.

✗ podman run --rm \
    -u "$(id -u)":"$(id -g)" \
    -v ${PWD}:/code \
    rustserverless/lambda-rust
error: failed to get `aws-config` as a dependency of package `mft-rotator v0.1.0 (/code)`

Caused by:
  failed to create directory `/cargo/registry/index/github.com-1ecc6299db9ec823`

Caused by:
  Permission denied (os error 13)

And even if I try to mount a volume with which it can do anything it wants:

✗ podman run --rm \
    -u "$(id -u)":"$(id -g)" \
    -v ${PWD}:/code \
    -v ~/tmpcargo:/cargo \
    rustserverless/lambda-rust

/usr/local/bin/build.sh: line 38: /cargo/env: No such file or directory

or:

✗ podman run --rm \
    -u "$(id -u)":"$(id -g)" \
    -v ${PWD}:/code \
    -v ${HOME}/tmpcargo/registry:/cargo/registry \
    -v ${HOME}/tmpcargo/git:/cargo/git \
    rustserverless/lambda-rust

error: failed to get `aws-config` as a dependency of package `mft-rotator v0.1.0 (/code)`

Caused by:
  failed to create directory `/cargo/registry/index/github.com-1ecc6299db9ec823`

Caused by:
  Permission denied (os error 13)

I'm not sure how to use this in any case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant