Skip to content

Propagate same-run parent images to child builds via OCI artifacts - #578

Merged
Kanti merged 13 commits into
masterfrom
copilot/fix-docker-image-relationship
Oct 1, 2026
Merged

Kanti merged 13 commits into
masterfrom
copilot/fix-docker-image-relationship

Conversation

Copilot AI commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Child images (e.g. webdevops/php-nginx:8.4) build FROM webdevops/php:8.4 which, outside of master, resolves to the last published Docker Hub image — not the parent image just built and tested in the same workflow run. PR changes to a parent image therefore never reach its children's tests.

CI generator (ci/src/)

  • GithubCommand::traverse() now passes hasChildren (via Node::hasChildren()) to the job builder, so it knows without recomputing the graph.
  • GithubJobBuilder gained small helpers — hasInternalParent, getCiImageArtifactName, getCiImagePath, parentBuildContext, buildPushWith — replacing inline string concatenation.

Parent jobs (nodes with children)

  • On non-master refs only, export the built image as an OCI layout (type=oci,tar=false, reusing cache-from: type=gha so it's effectively cache-only) and upload it with actions/upload-artifact, named per image+tag+arch:
docker-parent-php_8-4-${{ matrix.arch }}
  • 1-day retention, no compression (OCI layers are already compressed).

Child jobs (nodes with an internal parent)

  • Download the matching-arch parent artifact and add a second docker/build-push-action invocation with a named build context mapping the exact FROM reference to the downloaded layout:
build-contexts: 'webdevops/php:8.4=oci-layout://${{ runner.temp }}/ci-oci-image/php_8-4:ci-parent-image'
  • The original (master) build step is untouched; the override only applies if: github.ref != 'refs/heads/master'.
  • needs now explicitly includes both the parent build and parent publish jobs ([php_8-4, php_8-4_publish]) instead of just _publish, so children wait on the real build while still running when publish is skipped (non-master) via the existing !failure() && !cancelled() guard.

Artifact names/paths are keyed by image+tag+architecture, so amd64/arm64 and different images/tags never collide, and deep chains (php → php-nginx → php-nginx-dev) each consume their direct parent's artifact only.

No registry write permissions, secrets, or pull_request_target are involved — propagation is entirely via workflow artifacts, so it works for fork PRs. Master's publish flow is unchanged.

.github/workflows/build.yaml is regenerated via ci/console github:generate-ci to match.

Copilot AI and others added 2 commits October 1, 2026 09:17
…tifacts

Co-authored-by: Kanti <471387+Kanti@users.noreply.github.com>
… write advisory)

Co-authored-by: Kanti <471387+Kanti@users.noreply.github.com>
Co-authored-by: Kanti <471387+Kanti@users.noreply.github.com>
Copilot AI and others added 2 commits October 1, 2026 11:15
…image-relationship

Co-authored-by: Kanti <471387+Kanti@users.noreply.github.com>
…-only

Co-authored-by: Kanti <471387+Kanti@users.noreply.github.com>
@Kanti
Kanti marked this pull request as ready for review October 1, 2026 11:19
…/__w)

Co-authored-by: Kanti <471387+Kanti@users.noreply.github.com>
Copilot AI and others added 5 commits October 1, 2026 14:02
…only OCI gating

Co-authored-by: Kanti <471387+Kanti@users.noreply.github.com>
Co-authored-by: Kanti <471387+Kanti@users.noreply.github.com>
…ntext key correct

Co-authored-by: Kanti <471387+Kanti@users.noreply.github.com>
…lly) step

Co-authored-by: Kanti <471387+Kanti@users.noreply.github.com>
…ment

Co-authored-by: Kanti <471387+Kanti@users.noreply.github.com>
Co-authored-by: Kanti <471387+Kanti@users.noreply.github.com>
Use freshly built dependency images for pull requests and manual branch
runs. Keep master builds on published images and remove the PR-only gates.
@sonarqubecloud

sonarqubecloud Bot commented Oct 1, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
C Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@Kanti
Kanti merged commit 2021f8d into master Oct 1, 2026
217 of 219 checks passed
@Kanti
Kanti deleted the copilot/fix-docker-image-relationship branch October 1, 2026 18:17
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.

2 participants