-
Notifications
You must be signed in to change notification settings - Fork 14.2k
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
fix(docker): credentials issues around superset-cache in forks #26772
Conversation
5f22977
to
07398ed
Compare
scripts/docker_build_push.sh
Outdated
@@ -130,14 +130,16 @@ if [[ -n "${BUILD_TARGET}" ]]; then | |||
TARGET_ARGUMENT="--target ${BUILD_TARGET}" | |||
fi | |||
|
|||
CACHE_REF="${REPO_NAME}-cache:${TARGET}-${BUILD_ARG}" | |||
CACHE_REF="${REPO_NAME}:cache-${TARGET}-${BUILD_ARG}" |
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.
We actually have a superset-cache
registry setup that's intended to be used here: https://hub.docker.com/repository/docker/apache/superset-cache/general
The reason for this is so that we don't clutter up the "real" registry with a pile of cache images
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.
I tried to use this and got the exact same error messages on forks, I agree it's better to use this for caching
Realizing this shouldn't even trigger on PRs of forks, somehow the conditional logic stopped working. Fixing it here. |
While working on apache#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.
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.
While working on apache/superset#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.
Fixing the docker builds after merging a PR where I was getting a false positive since it was directly location on the main fork. Now when rebasing and executing docker from forks we get errors messages.
The root cause was this: https://github.com/apache/superset/pull/26766/files#diff-bcd99032795eb96dd42d38ceeeec262f6d4ab3952e3dbfb75905763c116cd0d7R133-R134
Where I used the
apache/superset-cache
DockerHub instead of the main one, as it was recommended for optimization purposes. In this PR, I'll point it back toapache/superset
after confirming the issue, so I can confirm the fix.Error looked like this on cache-push:
This is confusing as we're able to push images and layers, but not use the hub as cache. Probably some permission setting of some kind. Though I think the security is a bit reversed, meaning people shouldn't be able to publish an actual image, say to
apache/superset:latest
from a fork, but the "using the repo as a cache" is less of an issue as no one would pull from random cache. Probably one for the ASF infra folks