-
Notifications
You must be signed in to change notification settings - Fork 16
Add support for buildx build secrets #202
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
a82ce1c
Pass secrets to buildx builder
shanejbrown 5c8e1c3
Add validation for build secrets
shanejbrown dde775b
Fix inject errors
shanejbrown 46893f8
Fix test_build_multiple_builds test
shanejbrown 71c1d72
Fix build_multiple_images threading default
shanejbrown d3f21ed
Update multiplatform validation for secrets
shanejbrown 8ab3eac
Update build/secrets examples
shanejbrown 2940d15
Exclude platforms-buildrunner.yaml from tests
shanejbrown File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| # In order to use secrets, you need to set use-legacy-builder to false in the config file | ||
| # To run this example, you need to set the SECRET_PASSWORD environment variable | ||
| # and run the example with the following command: | ||
| # SECRET2=my_secret ./run-buildrunner.sh -f examples/build/secrets/buildrunner.yaml | ||
| # More info about secrets: https://docs.docker.com/build/building/secrets/ | ||
| use-legacy-builder: false | ||
shanejbrown marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| steps: | ||
| simple-build-step: | ||
| build: | ||
| no-cache: true | ||
| dockerfile: | | ||
| FROM alpine:latest | ||
| # Using secrets inline | ||
| RUN --mount=type=secret,id=secret1 \ | ||
| --mount=type=secret,id=secret2 \ | ||
| echo Using secrets in my build - secret1 file located at /run/secrets/secret1 with contents $(cat /run/secrets/secret1) and secret2=$(cat /run/secrets/secret2) | ||
| # Using secrets in environment variables | ||
| RUN --mount=type=secret,id=secret1 \ | ||
| --mount=type=secret,id=secret2 \ | ||
| SECRET1_FILE=/run/secrets/secret1 \ | ||
| SECRET2_VARIABLE=$(cat /run/secrets/secret2) \ | ||
| && echo Using secrets in my build - secret1 file located at $SECRET1_FILE with contents $(cat $SECRET1_FILE) and secret2=$SECRET2_VARIABLE | ||
| secrets: | ||
| # Example of a secret that is a file | ||
| - id=secret1,src=examples/build/secrets/secret1.txt | ||
| # Example of a secret that is an environment variable | ||
| - id=secret2,env=SECRET2 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| # In order to use secrets, you need to set use-legacy-builder to false in the config file OR | ||
| # add platforms to the build section | ||
| # To run this example, you need to set the SECRET_PASSWORD environment variable | ||
| # and run the example with the following command: | ||
| # SECRET2=my_secret ./run-buildrunner.sh -f examples/build/secrets/platforms-buildrunner.yaml | ||
| # More info about secrets: https://docs.docker.com/build/building/secrets/ | ||
| steps: | ||
| simple-build-step: | ||
| build: | ||
| dockerfile: | | ||
| FROM alpine:latest | ||
| # Using secrets inline | ||
| RUN --mount=type=secret,id=secret1 \ | ||
| --mount=type=secret,id=secret2 \ | ||
| echo Using secrets in my build - secret1 file located at /run/secrets/secret1 with contents $(cat /run/secrets/secret1) and secret2=$(cat /run/secrets/secret2) | ||
| # Using secrets in environment variables | ||
| RUN --mount=type=secret,id=secret1 \ | ||
| --mount=type=secret,id=secret2 \ | ||
| SECRET1_FILE=/run/secrets/secret1 \ | ||
| SECRET2_VARIABLE=$(cat /run/secrets/secret2) \ | ||
| && echo Using secrets in my build - secret1 file located at $SECRET1_FILE with contents $(cat $SECRET1_FILE) and secret2=$SECRET2_VARIABLE | ||
| secrets: | ||
| # Example of a secret that is a file | ||
| - id=secret1,src=examples/build/secrets/secret1.txt | ||
| # Example of a secret that is an environment variable | ||
| - id=secret2,env=SECRET2 | ||
| platforms: | ||
| - linux/amd64 | ||
| - linux/arm64 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| testuser123 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.