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

Puts docker-login action behind a conditional - allows outside contributors to pass CI #161

Merged

Conversation

brandonjbjelland
Copy link
Contributor

@brandonjbjelland brandonjbjelland commented Aug 2, 2023

What is this change?

Adds conditionals to docker-login, allowing outside contributors to get successful builds on their PRs.

Why make this change?

As we get outside contributions, it'd be great to see our entire build pipeline succeed on their PRs. This change allows us to skip the action that requires access to secrets.

Related

An example: https://github.com/docker/metadata-action/tree/v4/
#154

.github/workflows/docker-build-push.yaml Outdated Show resolved Hide resolved
.github/workflows/docker-build-push.yaml Outdated Show resolved Hide resolved
@brandonjbjelland
Copy link
Contributor Author

brandonjbjelland commented Aug 4, 2023

It looks like this is the only known path forward allowing outside contributors to use secrets: https://iterative.ai/blog/testing-external-contributions-using-github-actions-secrets

But also, I ultimately think we don't need this - just PRs don't need to push to dockerhub at all, so they shoulnd't hit the login job. The conditional should live at a different place and block the job from proceeding beyond building the container image. We don't need container images to publish as a PR is submitted right? If we do, we can gate it behind a similar contributor/maintainer check like the above.

@brandonjbjelland brandonjbjelland marked this pull request as draft August 5, 2023 00:10
@brandonjbjelland brandonjbjelland changed the title workflow_dispatch (ui-based) trigger, issue comment-based trigger, and supporting conditional Puts docker-login action behind a conditional Aug 11, 2023
@brandonjbjelland brandonjbjelland changed the title Puts docker-login action behind a conditional Puts docker-login action behind a conditional - allows outside contributors to pass CI Aug 11, 2023
@brandonjbjelland brandonjbjelland marked this pull request as ready for review August 11, 2023 05:57
@brandonjbjelland
Copy link
Contributor Author

brandonjbjelland commented Aug 11, 2023

@nstogner - I revised this to be simpler and smaller. All we needed was to put the action that uses secrets behind a conditional and they won't be accessed during PRs (saves us a step too). The docker build action will still run and won't push, as expected. Reference: https://github.com/docker/metadata-action/tree/v4/

@brandonjbjelland brandonjbjelland merged commit 82b4769 into main Aug 11, 2023
4 checks passed
@brandonjbjelland brandonjbjelland deleted the feat/support-comment-and-ui-based-test-triggers branch August 11, 2023 06:11
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

3 participants