Skip to content

ci: derive ghcr.io push target from GITHUB_REPOSITORY_OWNER - #235

Open
hh24k wants to merge 3 commits into
cloudnative-pg:mainfrom
hh24k:dev/233
Open

ci: derive ghcr.io push target from GITHUB_REPOSITORY_OWNER#235
hh24k wants to merge 3 commits into
cloudnative-pg:mainfrom
hh24k:dev/233

Conversation

@hh24k

@hh24k hh24k commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Fixes #233.

CI hardcoded ghcr.io/cloudnative-pg as the image push target in Taskfile.yml, so a fork running CI on its own repo (a push to the fork's own main, or a manual workflow_dispatch run) fails at the push step: the fork's GITHUB_TOKEN has packages: write on its own ghcr.io/<owner> namespace, not on cloudnative-pg's.

Added a REGISTRY_OWNER var derived from GITHUB_REPOSITORY_OWNER (falling back to cloudnative-pg outside CI) and used it everywhere the registry was hardcoded: core/operator containerize-snapshot/containerize-main, the olm:* image-push tasks, operator:helm-publish, and the OpenShift e2e job's operand image pull default, which needs to match whatever namespace the image was actually pushed to.

release-publish.yml's tasks didn't need this on their own merits, since those jobs are already gated on github.repository_owner == 'cloudnative-pg', but got the same mechanical substitution for consistency.

@hh24k

hh24k commented Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

@gabriele-wolfox gabriele-wolfox changed the title fix: derive ghcr.io push target from GITHUB_REPOSITORY_OWNER ci: derive ghcr.io push target from GITHUB_REPOSITORY_OWNER Sep 8, 2026
hh24k and others added 3 commits September 9, 2026 14:23
CI hardcoded ghcr.io/cloudnative-pg as the image push target in
Taskfile.yml, so a fork running CI on its own repo (a push to the
fork's own main, or a manual workflow_dispatch run) fails at the
push step: the fork's GITHUB_TOKEN has packages:write on its own
ghcr.io/<owner> namespace, not on cloudnative-pg's.

Add a REGISTRY_OWNER var derived from GITHUB_REPOSITORY_OWNER
(falling back to "cloudnative-pg" outside CI) and use it everywhere
the registry was hardcoded: core/operator containerize-snapshot and
containerize-main, the olm:* image-push tasks, operator:helm-publish,
and the OpenShift e2e job's operand image pull default, which needs
to match whatever namespace the image was actually pushed to.

release-publish.yml's tasks didn't need this fix on their own merits,
since those jobs are already gated on
github.repository_owner == 'cloudnative-pg', but got the same
mechanical substitution for consistency.

Fixes cloudnative-pg#233

Assisted-by: Claude

Signed-off-by: Hai He <hai.he@enterprisedb.com>
Signed-off-by: huyantian <yantian.hu@enterprisedb.com>
Core CI, Operator CI, and OLM Bundle & Catalog push built images to
ghcr.io, but a pull_request from a fork always resolves
GITHUB_REPOSITORY_OWNER against the base repository, and GitHub always
issues a read-only GITHUB_TOKEN for fork pull_request runs regardless of
the permissions requested in the job. Every push attempt from a fork PR
is denied, blocking any external contribution that touches core or
operator code.

Add a same-repo output to change-triage and thread it into a PUSH flag:
core:ci/operator:ci build and test as before but skip --push when it is
false, the preflight step (which needs a pushed image) is skipped with
it, and the whole olm job (which needs both images pushed to resolve
digests) is skipped rather than failed. openshift-e2e already had its
own equivalent check inline; it now reuses the same output.

This mirrors how cloudnative-pg/cloudnative-pg handles the same
situation in continuous-integration.yml: only require the build step
that can genuinely succeed without registry write access, and skip
(never fail) anything that structurally needs a pushed image.

Assisted-by: Claude

Signed-off-by: Gabriele Quaresima <gabriele.quaresima@enterprisedb.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CI hardcodes ghcr.io/cloudnative-pg as the image push target, blocking forks

3 participants