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

feat: add support for building docker actions with private registries #1557

Merged
merged 1 commit into from
Jan 12, 2023

Conversation

ZauberNerd
Copy link
Contributor

This commit adds a new LoadDockerAuthConfigs function, which loads all registry auths that are configured on the host and sends them with the build command to the docker daemon.

This is needed in case act builds a docker action and the images referenced in that docker action are located on private registries or otherwise require authentication (e.g. to get a higher rate limit).

The code is adapted from how the docker cli works: https://github.com/docker/cli/blob/257ff41304bf121bdf1acdf00a1c7a896ed038d1/cli/command/image/build.go#L323-L332

@ZauberNerd ZauberNerd requested a review from a team as a code owner January 12, 2023 10:30
@mergify
Copy link
Contributor

mergify bot commented Jan 12, 2023

@ZauberNerd this pull request has failed checks 🛠

@mergify mergify bot added the needs-work Extra attention is needed label Jan 12, 2023
KnisterPeter
KnisterPeter previously approved these changes Jan 12, 2023
Copy link
Member

@KnisterPeter KnisterPeter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but there seems to be some formatting issues

This commit adds a new `LoadDockerAuthConfigs` function, which loads all
registry auths that are configured on the host and sends them with the build
command to the docker daemon.

This is needed in case act builds a docker action and the images referenced in
that docker action are located on private registries or otherwise require
authentication (e.g. to get a higher rate limit).

The code is adapted from how the docker cli works:
https://github.com/docker/cli/blob/257ff41304bf121bdf1acdf00a1c7a896ed038d1/cli/command/image/build.go#L323-L332

Co-authored-by: Markus Wolf <[email protected]>
@codecov
Copy link

codecov bot commented Jan 12, 2023

Codecov Report

Merging #1557 (0aff358) into master (4989f44) will increase coverage by 0.04%.
The diff coverage is 77.41%.

@@            Coverage Diff             @@
##           master    #1557      +/-   ##
==========================================
+ Coverage   61.22%   61.26%   +0.04%     
==========================================
  Files          46       46              
  Lines        7141     7167      +26     
==========================================
+ Hits         4372     4391      +19     
- Misses       2462     2467       +5     
- Partials      307      309       +2     
Impacted Files Coverage Δ
pkg/container/docker_cli.go 82.23% <ø> (ø)
pkg/container/docker_images.go 31.14% <ø> (ø)
pkg/container/docker_logger.go 52.08% <ø> (ø)
pkg/container/docker_pull.go 33.33% <ø> (ø)
pkg/container/docker_run.go 13.58% <ø> (ø)
pkg/container/docker_volume.go 0.00% <ø> (ø)
pkg/container/docker_auth.go 51.35% <56.25%> (+3.73%) ⬆️
pkg/container/docker_build.go 59.49% <100.00%> (+0.51%) ⬆️
pkg/runner/job_executor.go 88.40% <100.00%> (+0.71%) ⬆️
pkg/runner/step_action_remote.go 90.96% <100.00%> (+0.05%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@github-actions
Copy link
Contributor

🦙 MegaLinter status: ✅ SUCCESS

Descriptor Linter Files Fixed Errors Elapsed time
✅ EDITORCONFIG editorconfig-checker 2 0 0.01s
✅ REPOSITORY gitleaks yes no 2.99s
✅ REPOSITORY git_diff yes no 0.0s
✅ REPOSITORY secretlint yes no 1.28s

See detailed report in MegaLinter reports
Set VALIDATE_ALL_CODEBASE: true in mega-linter.yml to validate all sources, not only the diff

MegaLinter is graciously provided by OX Security

@mergify mergify bot removed the needs-work Extra attention is needed label Jan 12, 2023
@mergify mergify bot requested a review from a team January 12, 2023 10:59
@mergify mergify bot merged commit 3f3b25a into master Jan 12, 2023
@mergify mergify bot deleted the docker-build-authenticated branch January 12, 2023 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants