-
Notifications
You must be signed in to change notification settings - Fork 0
Add workflow to promote artifacts upon QA-approval #241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: rc/ncw-4
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,126 @@ | ||||||||||||||||||||||||||||||||||||
| name: Promote QA-approved artifacts to stable branch | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| # - Takes a commit SHA as input | ||||||||||||||||||||||||||||||||||||
| # - Fast-forward merges it to ionos-stable (no new commits) | ||||||||||||||||||||||||||||||||||||
| # - Promotes the exact artifact from Artifactory (no rebuild) | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||||||||||||
| workflow_dispatch: | ||||||||||||||||||||||||||||||||||||
| inputs: | ||||||||||||||||||||||||||||||||||||
| sha: | ||||||||||||||||||||||||||||||||||||
| description: 'Commit SHA to promote from ionos-dev to ionos-stable and copy artifacts for' | ||||||||||||||||||||||||||||||||||||
| required: true | ||||||||||||||||||||||||||||||||||||
| type: string | ||||||||||||||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||||||||||||||
| REGISTRY: ghcr.io | ||||||||||||||||||||||||||||||||||||
| SHA: ${{ inputs.sha }} | ||||||||||||||||||||||||||||||||||||
| ARTIFACTORY_REPOSITORY_SNAPSHOT: ionos-productivity-ncwserver-snapshot | ||||||||||||||||||||||||||||||||||||
| ARTIFACTORY_REPOSITORY_RELEASE: ionos-productivity-ncwserver-release | ||||||||||||||||||||||||||||||||||||
| CACHE_VERSION: v1.0 | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| permissions: | ||||||||||||||||||||||||||||||||||||
| contents: write | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
| concurrency: | |
| group: promote-artifact | |
| cancel-in-progress: false |
Copilot
AI
Feb 27, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
permissions: contents: write is granted at the workflow level, so both jobs (including the one that uses external secrets for Artifactory) receive a write-capable GITHUB_TOKEN. For least privilege, set workflow permissions to contents: read (or none) and override to contents: write only on the promote-git job that actually pushes.
| contents: write | |
| jobs: | |
| promote-git: | |
| # Fast-forward merge SHA from ionos-dev into ionos-stable | |
| # (This ensures commit-hash is identical) | |
| contents: read | |
| jobs: | |
| promote-git: | |
| # Fast-forward merge SHA from ionos-dev into ionos-stable | |
| # (This ensures commit-hash is identical) | |
| permissions: | |
| contents: write |
Copilot
AI
Feb 27, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
git merge --ff-only "$SHA" can exit successfully with "Already up to date." when the provided SHA is behind the current ionos-stable head (i.e., SHA is an ancestor of stable). In that case the branch is not moved to the requested SHA, but the workflow still proceeds to promote artifacts for it, breaking the "git SHA == promoted artifact" guarantee. Add an explicit check that origin/ionos-stable is an ancestor of $SHA before merging, or verify after the merge that HEAD equals $SHA and fail otherwise.
| else | |
| git push origin HEAD:ionos-stable | |
| fi | |
| fi | |
| # Ensure that the resulting HEAD is exactly the requested SHA. | |
| # This prevents the case where SHA is behind ionos-stable and | |
| # 'git merge --ff-only' reports "Already up to date" without | |
| # moving the branch to $SHA. | |
| HEAD_SHA="$(git rev-parse HEAD)" | |
| if [ "$HEAD_SHA" != "$SHA" ]; then | |
| echo "Error: After merge, HEAD ($HEAD_SHA) does not match requested SHA ($SHA)." | |
| echo "Refusing to push ionos-stable or promote artifacts for a mismatched commit." | |
| exit 1 | |
| fi | |
| git push origin HEAD:ionos-stable |
Copilot
AI
Feb 27, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Artifactory search path and expected file type don’t match the upload layout documented/implemented in build-artifact.yml (it uploads a .zip under .../dev/ncw-<version>/<shortSha>/..., not .tar.gz under .../dev/<branch>/$SHA/). As written, this step will not find any artifacts for valid builds. Align the search with the actual snapshot layout (or search by the stored vcs.revision property) and copy the exact matching build output.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
REGISTRYandCACHE_VERSIONare defined inenv:but are unused in this workflow. Removing unused env vars makes the workflow easier to understand and avoids confusion about whether registry/caching is involved in promotion.