Log in to artifactapi with a Vault identity OIDC token #2
Reference in New Issue
Block a user
Delete Branch "benvin/artifactapi-vault-login"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
artifactapi is moving to require a Vault identity OIDC token for docker push, and ~33 repos push with this plugin without credentials. The plugin now logs itself in so no repo needs changing.
artifactapi-login.sh: on non-dry-run pushes to artifactapi with no artifactapi creds configured, log in to Vault with the pod SA token and append the OIDC token toPLUGIN_LOGINSvault_addr,vault_role,vault_oidc_roleoverridescurl/jqand amake testharness covering the entrypoint handoffRequires the terraform-vault artifactapi-writer role applied first.
PLUGIN_USERNAME/PLUGIN_PASSWORDskip the login even whenregistry:is another host (e.g. git.unkin.net) andrepo:also targets artifactapi; upstream applies those creds only toregistry:, so the artifactapi push goes anonymous → only skip whenPLUGIN_REGISTRYcontains$ARTIFACTAPI_HOST.jq --argargv (visible in/proc/*/cmdline) → pass via--rawfile/stdin orenv.in jq.exechandoff (dockerd-entrypoint.sh plugin-docker-buildx "$@") or the Dockerfile ENTRYPOINT, the parts that break every push if wrong → add one test that runs the entrypoint with a stubdockerd-entrypoint.shand asserts args andPLUGIN_LOGINSreach it.exec dockerd-entrypoint.sh plugin-docker-buildxhardcodes upstream ENTRYPOINT whileFROM ...:latestis unpinned, and the handoff test uses a stub, so upstream drift passesmake test→ assert upstream.Config.Entrypointin the test, or pin the tag.PLUGIN_LOGINS(artifactapi-login.sh:29 branch),PLUGIN_VAULT_ADDR/PLUGIN_VAULT_OIDC_ROLEoverrides, or that the exportedPLUGIN_LOGINSreaches the exec'd process → add them; extend the Makefile handoff test withPLUGIN_REGISTRYset and a stub that echoes$PLUGIN_LOGINS.DOCKER_REGISTRY/DOCKER_USERNAME/DOCKER_PASSWORDaliases, so creds set that way are not seen as explicit → also check those or drop the claim of explicit-creds detection.