Repository navigation
Fix: declare secrets in compose-maven-merge - #897
ModeSevenIndustrialSolutions merged 1 commit into
Conversation
compose-maven-merge reads secrets.NEXUS_*, secrets.CENTRAL_*,
secrets.ARTIFACTORY_ACCESS_TOKEN and secrets.SIGUL_* but declared no
secrets block, so callers had to rely on "secrets: inherit".
That keyword only propagates secrets to a reusable workflow in the same
organisation or enterprise. A caller in another organisation inherits
nothing, and every secret arrives empty.
opendaylight/infrautils hit exactly this: the shared workflow resolved
vars.NEXUS_SERVER and vars.NEXUS_REPO correctly, because vars are not
subject to that restriction, while nexus-publish-action aborted with
"Error: nexus_password is required". The sibling
gerrit-ci-management-merge workflow already avoids the problem by
declaring its secrets and having callers pass them by name.
Declare all twelve secrets the workflow consumes. Each is optional, so a
caller supplies only the ones its enabled PUSH_*/SIGUL_SIGN paths need,
and same-organisation callers using "secrets: inherit" keep working.
Verified the declared set matches the referenced set exactly, twelve
names, with no undeclared uses and no dead declarations:
python3 - <<'PY'
import re, yaml
raw = open(".github/workflows/compose-maven-merge.yaml").read()
d = yaml.safe_load(raw)
on = d.get("on", d.get(True))
declared = set((on["workflow_call"].get("secrets") or {}).keys())
used = set(re.findall(r"secrets\.([A-Za-z_][A-Za-z0-9_]*)", raw))
assert used == declared, (used ^ declared)
PY
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Anil Belur <abelur@linuxfoundation.org>
93b11c1 to
94c1e05
Compare
|
Flagging this as review-blocking rather than routine.
Net effect: infrautils SNAPSHOTs are not being published at all right now — Jenkins is off, and the GHA path cannot authenticate. Nexus still shows This PR is the fix, and the dependent caller change is staged at infrautils 125669 (held WIP until this merges). The change is additive and low risk:
All 12 checks are green. A review whenever someone has a moment would be much appreciated. |
compose-maven-merge reads
secrets.NEXUS_*,secrets.CENTRAL_*,secrets.ARTIFACTORY_ACCESS_TOKENandsecrets.SIGUL_*but declares nosecrets:block, so callers had to rely onsecrets: inherit.inheritonly propagates secrets to a reusable workflow in the same organisation or enterprise. A caller in another organisation inherits nothing and every secret arrives empty.Observed failure
opendaylight/infrautils(orgopendaylight) calling this workflow (orglfit) — run 33520727430:The
vars.*lookups resolved fine in the same run (nexus_server=https://nexus.opendaylight.org,repository_name=opendaylight.snapshot) becausevarsare not subject to that restriction — onlysecretsare. That contrast is what pinpoints the cause.The sibling
gerrit-ci-management-merge.yamlalready avoids this: it declares its secrets, andopendaylight/releng-builderpasses them by name.Change
Declare all twelve secrets the workflow consumes. Every one is
required: false, so:PUSH_*/SIGUL_SIGNpaths actually consume;secrets: inheritare unaffected.Verification
Declared set matches referenced set exactly (12 names, no undeclared uses, no dead declarations):
pre-commit run --files .github/workflows/compose-maven-merge.yamlpasses (yamllint, actionlint, workflow validators).