Skip to content
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

Bug: EARTHLY_SECRETS env var not working with earth command #229

Closed
zenyui opened this issue Aug 22, 2020 · 3 comments
Closed

Bug: EARTHLY_SECRETS env var not working with earth command #229

zenyui opened this issue Aug 22, 2020 · 3 comments
Assignees
Labels
type:bug Something isn't working

Comments

@zenyui
Copy link
Contributor

zenyui commented Aug 22, 2020

I believe there's a bug with the EARTHLY_SECRETS env var. Per docs, I should be able to define CSV secrets instead of individually passing in with the --secret argument.

Given a target:

some-target:
    RUN --secret SOME_SECRET=+secrets/SOME_SECRET echo $SOME_SECRET

these commands succeed

# passing in as a key/value
earth --secret SOME_SECRET=a --no-cache +code

# setting the environment inline
SOME_SECRET=a earth --no-cache --secret SOME_SECRET +some-target

# setting the env var in a separate command
export SOME_SECRET=a
earth --no-cache --secret SOME_SECRET +some-target

and these commands fail...

# using key/value earthly secrets inline
EARTHLY_SECRETS="SOME_SECRET=a" \
earth --no-cache +some-target

# setting env var separately as key/value
export EARTHLY_SECRETS="SOME_SECRET=a"
earth --no-cache +some-target

# setting env vars separately
export SOME_SECRET=a
export EARTHLY_SECRETS="SOME_SECRET"
earth --no-cache +some-target

... with the error message:

+some-target | --> RUN echo $SOME_SECRET
+some-target | ERROR: (RUN echo $SOME_SECRET) secret SOME_SECRET not found: not found
Repeating the output of the command that caused the failure
=========================== FAILURE ===========================
+some-target failed | --> RUN echo $SOME_SECRET
+some-target failed | [no output]
+some-target failed | ERROR: (RUN echo $SOME_SECRET) secret SOME_SECRET not found: not found
Error: solve side effects: solve: failed to solve: rpc error: code = Unknown desc = secret SOME_SECRET not found: not found

@vladaionescu vladaionescu added the type:bug Something isn't working label Aug 22, 2020
@alexcb alexcb self-assigned this Aug 24, 2020
@alexcb
Copy link
Collaborator

alexcb commented Aug 24, 2020

Thanks @zenyui , I believe I found a bug in the underlying cli handling library we use: urfave/cli#1178

If we get that PR merged we'll be able to fix this, otherwise I now know how to work around it 😄

Thanks for the clear repro-cases.

@zenyui
Copy link
Contributor Author

zenyui commented Aug 25, 2020

Thanks @zenyui , I believe I found a bug in the underlying cli handling library we use: urfave/cli#1178

If we get that PR merged we'll be able to fix this, otherwise I now know how to work around it 😄

Thanks for the clear repro-cases.

You're welcome. I'm not blocked, for now I'm just passing in the secrets explicitly. If you have a local workaround I'm happy to try it out!

@alexcb
Copy link
Collaborator

alexcb commented Aug 25, 2020

@zenyui we just released v0.3.2 which fixes this issue.

@alexcb alexcb closed this as completed Aug 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants