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

Display which secret was not found in error message #972

Merged
merged 1 commit into from
May 7, 2021

Conversation

alexcb
Copy link
Collaborator

@alexcb alexcb commented May 7, 2021

Previously if one referenced a secret which was not available, earthly
would fail and simply return "Error: not found"; this changes the
behavious to display which secret was not found.

For example, consider an Earthfile like:

foo:
    FROM alpine:latest
    RUN --secret password=+secrets/password env

If you invoke earthly +foo (without passing a value for the password secret), now it will display
an error such as:

Error: unable to lookup secret password: not found

Where as previously it just displayed:

Error: not found

Signed-off-by: Alex Couture-Beil alex@earthly.dev

@alexcb alexcb force-pushed the improve-error-message-when-secret-is-missing branch from b1faa0a to 561f804 Compare May 7, 2021 21:18
earthfile2llb/earthfile2llb.go Outdated Show resolved Hide resolved
@alexcb alexcb force-pushed the improve-error-message-when-secret-is-missing branch 3 times, most recently from 7458fc9 to 7d1241e Compare May 7, 2021 22:10
Previously if one referenced a secret which was not available, earthly
would fail and simply return "Error: not found"; this changes the
behavious to display which secret was not found.

For example, consider an Earthfile like:

    foo:
        FROM alpine:latest
        RUN --secret password=+secrets/password env

If you invoke earthly +foo (without passing a value for the password secret), now it will display
an error such as:

    Error: unable to lookup secret password: not found

Where as previously it just displayed:

    Error: not found

Signed-off-by: Alex Couture-Beil <alex@earthly.dev>
@alexcb alexcb force-pushed the improve-error-message-when-secret-is-missing branch from 7d1241e to d07f538 Compare May 7, 2021 22:14
@alexcb
Copy link
Collaborator Author

alexcb commented May 7, 2021

@dchw my initial draft PR wasn't checking the correct secret keys, nor did it work with our hosted secrets store, it turns out displaying which secret wasn't found is easier (however we loose the bit that display the Earthfile that was referencing it). If we did want to also display the location we would have had to include it in the converter.go code instead (but that still wouldn't work with hosted secrets)).

@alexcb alexcb marked this pull request as ready for review May 7, 2021 22:42
@alexcb alexcb merged commit 4d3e378 into main May 7, 2021
@alexcb alexcb deleted the improve-error-message-when-secret-is-missing branch May 7, 2021 22:43
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

Successfully merging this pull request may close these issues.

None yet

2 participants