fix: Split local image build into build and publish workflows#730
Merged
lindnerby merged 5 commits intoMay 7, 2026
Conversation
Adds image-builder-local.yml to build and publish runtime-watcher images to ghcr.io/kyma-project/runtime-watcher for fast local testing on arm64 (Apple M-series) and amd64 machines. Closes kyma-project#709
- Rename image-builder-local.yml → build-image-local.yml - Remove draft PR guard — builds run for draft PRs too - Rename workflow display name to "Build Image (Local testing / ghcr.io)"
Addresses the pull_request_target supply-chain vulnerability flagged by GitHub code scanning. Follows the workflow_run split pattern: - build-image-local.yml: runs on pull_request (untrusted, no secrets), builds multi-arch OCI tarball and uploads as artifact - publish-image-local.yml: runs on workflow_run (privileged, never executes fork code), pushes tarball to ghcr.io via skopeo Improvements over the original fix: - Guard against empty tags with explicit error message - Push from OCI archive directly to all tags (no registry round-trip) - Print image digest in job summary for digest pinning
72c6708 to
529b69d
Compare
Remove metadata.json from the build workflow entirely — fork code could forge event_name/ref to hijack the :latest tag. Tag decisions are now derived exclusively from github.event.workflow_run.* (trusted GitHub context) in the publish workflow, which never executes untrusted code.
Move workflow_run context values (head_branch, head_sha, event) from
inline ${{ }} expressions into env variables to prevent shell injection
via maliciously-named branches.
lindnerby
approved these changes
May 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Addresses the
pull_request_targetsupply-chain vulnerability flagged by GitHub code scanning after #711 was merged.The single workflow is split into two:
build-image-local.yml: runs onpull_request(untrusted context, no secrets) — builds multi-arch OCI tarball and uploads as a GitHub Actions artifactpublish-image-local.yml: runs onworkflow_run(privileged, base branch context) — downloads the pre-built artifact and pushes toghcr.ioviaskopeo. Never checks out fork code.This eliminates the risk of fork-controlled
Dockerfilecontent executing in a context withpackages: write.Additional improvements over the baseline fix:
tagswith an explicit error message