-
Notifications
You must be signed in to change notification settings - Fork 14.8k
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
chore: refactor the github actions has-secrets logic #26795
Conversation
This part worries me a bit. Each key is set separately by Apache Infra, and sometimes they are (or soon will be) secrets for disparate systems (e.g. Google, Github, OpenAI, etc). I don't think it's safe to assume that if one secret exists that the others are all good... it would be best to pass an array of secrets, and have them all validated by the shared action. |
Just to make sure I'm understanding, is this fixing the issue wherein the |
.github/workflows/docker.yml
Outdated
needs: config | ||
if: needs.config.outputs.has-secrets | ||
needs: check-secrets | ||
if: needs.check-secrets.outputs.has-secrets == 'true' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not totally related with this PR, but I think it only makes sense to build and push to a local file on the workspace workflow while the PR is open, so this means we are supposed to not have secrets here. the ephemeral-env
workflow is expecting the build dir
.github/workflows/docker.yml
Outdated
needs: config | ||
if: needs.config.outputs.has-secrets == 'true' | ||
needs: check-secrets | ||
if: needs.check-secrets.outputs.has-secrets == 'true' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we always build images on PRs? like we were doing before? docker_build_push.sh
will only push if DOCKERHUB_USER
is present
also this is kind of tricky to test, except opening a similar PR directly to the repo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that's right, more work to do here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
About both your comments, I think I figured it out in #26801, where we always run docker, but in forks it runs without authentication, which means it builds an DOESNT push, just making sure that docker build works.
Now I was also able to improve caching there, where in forks, it's use the registry cache as input, but it cannot push the cache and won't. Unclear what the cache hit rate will be, but should be pretty good unless the PR touches dependencies. Also if you don't touch the frontend there's a lot savings on docker build time.
As docker cache can be really good if done well, it could be tempting to eventually run tests in-docker, and saving a lot on build times.
While working on #26772, I realized that the has-secret logic was broken for unclear reasons. Now after doing this fix, I looked and realized that there's similar logic across about a dozen other gh actions, and thought it'd be a good thing to refactor/fix this with a reusable action. Now many of these workflows are set to trigger on push-on-master only meaning it's less of an issue since a false positive on has-secret dpesn't matter in that context since there's always a secret. I still thought I should refactor this to something we can trust and build upon. The solution introduces this new simple reusable action. One minor note is in cases where we need multiple secrets, as in say DOCKERHUB_TOKEN and DOCKERHUB_USER, we simply look at one and assume that's clear-enough of an indicator.
315f4b3
to
d524461
Compare
103d1d8
to
beb9f13
Compare
Frustrated head-butting with GitHub reusable actions not working as expected. Tried a million things and couldn't make the output value work. Closing for now |
[reopening] While working on #26772, I realized that the has-secret logic was broken for unclear reasons. Now after doing this fix, I looked and realized that there's similar logic across about a dozen other gh actions, and thought it'd be a good thing to refactor/fix this with a reusable action.
Now many of these workflows are set to trigger on push-on-master only meaning it's less of an issue since a false positive on has-secret dpesn't matter in that context since there's always a secret.
I still thought I should refactor this to something we can trust and build upon.
The solution introduces this new simple reusable action.
One minor note is in cases where we need multiple secrets, as in say DOCKERHUB_TOKEN and DOCKERHUB_USER, we simply look at one and assume that's clear-enough of an indicator.