Fix quay-proxy ServiceAccount login username - #1941
Conversation
PR openshift-metal3#1933 switched the default CI registry to quay-proxy.ci.openshift.org and added a podman login in write_pull_secret() using --username "$(oc whoami)". For a ServiceAccount that returns system:serviceaccount:<ns>:<name>. The colons break HTTP Basic Auth password parsing on quay-proxy, so login fails with "invalid username/password" even when the CI token is valid. CI docs warn against this username form. Use a colon-free username ("image-puller"); the password remains the ServiceAccount token from oc whoami -t. Follow-up to openshift-metal3#1933. Independent of openshift-metal3#1937 (REGISTRY_CREDS). Signed-off-by: tusharjadhav3302 <tjadhav@redhat.com> Co-authored-by: Cursor <cursoragent@cursor.com>
|
Hi @tusharjadhav3302. Thanks for your PR. I'm waiting for a openshift-metal3 member to verify that this patch is reasonable to test. If it is, they should reply with Regular contributors should join the org to skip this step. Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/ok-to-test |
| oc --kubeconfig="$tmpkubeconfig" whoami -t | \ | ||
| podman login "${CI_REGISTRY}" \ | ||
| --username "$(oc --kubeconfig="$tmpkubeconfig" whoami)" \ | ||
| --username "image-puller" \ |
There was a problem hiding this comment.
I'm not sure that quay-proxy manages all the user via the hard-coded image-puller, since the docs explicitly mention the needs of registering a rover group.
In that case, I'd suggest implementing a solution that could support both cases (humans via rover group and service accounts), ie something like (just a suggestion from Claude):
--username "$(oc --kubeconfig="$tmpkubeconfig" whoami | tr ':' '_')" \
Hardcoding "image-puller" only covers the ServiceAccount CI path. Human users authenticate via Rover groups and should keep their oc whoami identity. Replace ':' with '_' in the username so ServiceAccount names stay Basic Auth safe while human usernames are unchanged when they contain no colons. Signed-off-by: tusharjadhav3302 <tjadhav@redhat.com> Co-authored-by: Cursor <cursoragent@cursor.com>
|
Thanks @andfasano — updated. Dropped the hardcoded --username "$(oc --kubeconfig="$tmpkubeconfig" whoami | tr ':' '_')"That keeps human / Rover identities intact when |
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dtantsur The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/retest |
|
@tusharjadhav3302: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Summary
Follow-up to #1933: fix
write_pull_secret()so quay-proxy login works for ServiceAccount CI tokens.#1933 correctly switched the default CI registry to
quay-proxy.ci.openshift.organd added apodman loginstep. The username it used breaks auth for ServiceAccounts.Problem
For a CI ServiceAccount,
oc whoamireturns:The
:characters corrupt HTTP Basic Auth password parsing on quay-proxy, so login fails with:The CI token itself is fine (
oc loginandoc registry loginsucceed; the SA can see projects). Only the username format is wrong.CI docs explicitly warn about this:
https://docs.ci.openshift.org/how-tos/use-registries-in-build-farm/
Change
File:
utils.sh(write_pull_secret())Password is unchanged: still piped from
oc whoami -t.Impact
Without this, any non-
OPENSHIFT_CIpath that callswrite_pull_secret()after #1933 fails atbuild_installerwhen authenticating to quay-proxy (e.g. ShiftStack/RHOSO Zuul jobs on serval70 usingdevscripts_ci_token).Reproduction / validation
Test plan
-u image-pullersucceeds03_build_installer.sh/write_pull_secretRelated
REGISTRY_CREDS/ local registry — still needed separately)Made with Cursor