IONOS(ci): refresh pr/ artifact slot from branch pushes - #305
Open
printminion-co wants to merge 1 commit into
Open
IONOS(ci): refresh pr/ artifact slot from branch pushes#305printminion-co wants to merge 1 commit into
printminion-co wants to merge 1 commit into
Conversation
The flat `pr/hidrive-next-pr-<N>.zip` slot in JFrog was only ever written by the pull_request run. When a PR becomes CONFLICTING, GitHub cannot compute refs/pull/<N>/merge and therefore creates NO pull_request run at all, so the slot silently went stale on every subsequent push while only the immutable devs/<prefix>/<version>/<sha>/ artifact kept updating. Resolve the open PR for a pushed `*/dev/*` branch and mirror the freshly uploaded devs/ artifact into the pr/ slot with a server-side `jf rt copy`, so the slot tracks the branch head regardless of PR mergeability. - gate the lookup to `*/dev/*`: protected branches use a unique-per-run-id concurrency key, so their push and pull_request runs would race for the slot - non-fatal by design; trigger-remote-dev-workflow gates on this job's success and must not lose GitLab dev deployments over a convenience mirror - ARTIFACTORY_LAST_BUILD_PATH keeps pointing at the immutable devs/ path - record build.from_merge_ref / build.source_event so consumers can tell a merge-ref build from a branch-head build of the same slot
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.
Problem
ionos-productivity-hdnext-snapshot/pr/hidrive-next-pr-<N>.zipgoes silently stale once a PR develops a merge conflict.The flat
pr/slot is only ever written by thepull_requestrun. When a PR becomesCONFLICTING(mergeStateStatus: DIRTY), GitHub cannot computerefs/pull/<N>/mergeand therefore creates nopull_requestrun at all — so nothing refreshes the slot, while the push run keeps happily uploading the immutabledevs/<prefix>/<version>/<sha>/artifact.Observed on #294 (
kh/dev/add-simplenavigation-v33, submodule gitlink conflict inIONOS):pushrunpull_requestrunf4bb552pr/…-294.zip491da87devs/kh/…Change
Resolve the open PR for a pushed
*/dev/*branch, then mirror the freshly uploadeddevs/artifact into thepr/slot with a server-sidejf rt copy(the zip is not re-transferred). The slot now tracks the branch head regardless of PR mergeability.*/dev/*. Protected branches (ionos-dev/ionos-stable/rc/*) use a unique-per-run-id concurrency key, so their push andpull_requestruns execute in parallel and would race for the same slot.trigger-remote-dev-workflowgates onneeds.upload-to-artifactory.result == 'success'; failing the job over a convenience mirror would block GitLab dev deployments even though the canonical artifact uploaded fine. Reported via::error::+ step summary instead. Oneexit 1flips this if the team prefers hard failure.ARTIFACTORY_LAST_BUILD_PATHunchanged — still the immutabledevs/<sha>/path, since GitLab is handedGITHUB_SHAalongside it and must not receive a mutable slot.actions/github-scriptfor the lookup rather thangh/jq: this job isruns-on: self-hosted, where neither tool is provably installed (every existingjqcall in this workflow is in anubuntu-latestjob). Node is already required here bycheckout/download-artifact/setup-jfrog-cli.permissions:— note these replace the workflow-level map, socontents: readis repeated foractions/checkout.build.from_merge_ref/build.source_eventmake the caveat below machine-readable.Caveat (documented in the workflow)
The
pr/slot now has two possible producers with different content:pull_requestrun → built fromrefs/pull/<N>/merge(head merged into base)push/workflow_dispatchrun → built from the branch head only, base changes not includedbuild.from_merge_ref=(true|false)records which produced a given zip, and the step summary warns whoever downloads it.Verification
actionlint+shellcheck(via podman) against the base as baseline: no new errors or warnings. The only delta isSC2086:info56 → 60 — unquoted$GITHUB_OUTPUTin redirects, the convention already used 56× in this file.Runtime check, no merge required (
workflow_dispatchignores thepaths:filter and carries no PR number, so it takes the new push path):Expect
Resolved PR #<N>,✅ PR slot refreshed on attempt 1, andpr.number/build.from_merge_ref=false/vcs.revision=<pushed sha>on the slot.jf rt copy's target semantics.--flat=trueis load-bearing — without it the source hierarchy is recreated underneath the target, producing a directory named like the slot. Thejf rt s | grep -qcheck plus the direct-upload fallback cover the failure, but confirm the layout on the first real run.Not included
The symmetric half — having the
pull_requestrun also publish thedevs/<sha>/artifact — is left out deliberately. Today a push to a*/dev/*branch with a healthy PR is cancelled by the PR run, so nodevs/<sha>/artifact exists for that push. Worth a follow-up; it needsgithub.event.pull_request.head.sharather thangithub.sha(the latter is the ephemeral merge commit, which exists on no branch).