-
Notifications
You must be signed in to change notification settings - Fork 0
Update "latest" tagged images on new tag #248
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
Changes from all commits
2adceb7
b9117ca
5881f63
9855563
ff6a9c7
aa293dd
5d0d269
7f6e570
0b19a43
f0d10ad
e3d4758
c956205
f732abb
0d2dfa1
d08ee9a
7a0bdf9
489be72
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,31 @@ | ||
| name: Promote to stable | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| version: | ||
| description: "Version to promote (e.g. 0.5.7). Defaults to 'latest'." | ||
| required: false | ||
| default: "latest" | ||
|
|
||
| env: | ||
| QUAY_STACKROX_IO_RW_USERNAME: ${{ secrets.QUAY_STACKROX_IO_RW_USERNAME }} | ||
| QUAY_STACKROX_IO_RW_PASSWORD: ${{ secrets.QUAY_STACKROX_IO_RW_PASSWORD }} | ||
|
|
||
| jobs: | ||
| promote-stable: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Log in to Quay | ||
| run: | | ||
| docker login -u "$QUAY_STACKROX_IO_RW_USERNAME" --password-stdin <<<"$QUAY_STACKROX_IO_RW_PASSWORD" quay.io | ||
| - name: Retag all flavors as stable | ||
| run: | | ||
| VERSION="${{ inputs.version }}" | ||
| VERSION="${VERSION:-latest}" | ||
| for flavor in scanner-build scanner-test stackrox-build stackrox-test stackrox-ui-test jenkins-plugin; do | ||
| SRC="quay.io/stackrox-io/apollo-ci:${flavor}-${VERSION}" | ||
| DST="quay.io/stackrox-io/apollo-ci:${flavor}-stable" | ||
| echo "Promoting ${SRC} → ${DST}" | ||
| docker buildx imagetools create --tag "${DST}" "${SRC}" | ||
| done |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -7,6 +7,79 @@ This repository holds the Dockerfiles for images used in StackRox CI & builds. | |||||
| [gha-badge]: https://github.com/stackrox/rox-ci-image/actions/workflows/build.yaml/badge.svg | ||||||
| [gha-link]: https://github.com/stackrox/rox-ci-image/actions/workflows/build.yaml | ||||||
|
|
||||||
| ## Image Tags and Release Process | ||||||
|
|
||||||
| Each image flavor (e.g. `stackrox-test`, `scanner-test`) is pushed to | ||||||
| `quay.io/stackrox-io/apollo-ci` with three types of tags: | ||||||
|
|
||||||
| | Tag | Example | Updated when | Use in | | ||||||
| |-----|---------|-------------|--------| | ||||||
| | **versioned** | `stackrox-test-0.5.7` | Every merge to main (auto-tagged) | Release branch prow configs, pinned references | | ||||||
| | **latest** | `stackrox-test-latest` | Every new version tag on main | Testing rox-ci-image version in openshift/release PRs with `/pj-rehearse` before promoting to stable. | | ||||||
| | **stable** | `stackrox-test-stable` | Manual promotion via workflow | Master/nightly prow configs in openshift/release | | ||||||
|
|
||||||
| ### How it works | ||||||
|
|
||||||
| 1. **Merge to main** -- `tag.yaml` auto-creates a semver tag (e.g. `0.5.8`) | ||||||
| 2. **Tag push** -- `build.yaml` builds all images, pushes versioned tags, and | ||||||
| updates `latest` (only if the tag is the highest version on main) | ||||||
| 3. **Promote to stable** -- [run manually](https://github.com/stackrox/rox-ci-image/actions/workflows/promote-stable.yaml) when ready: | ||||||
| ```bash | ||||||
| gh workflow run promote-stable.yaml | ||||||
| # or with a specific version: | ||||||
| gh workflow run promote-stable.yaml -f version=0.5.8 | ||||||
| ``` | ||||||
| This does a server-side retag (no rebuild) of all image flavors from the | ||||||
| specified version (default: `latest`) to `stable`. | ||||||
|
|
||||||
| ### Updating prow jobs in openshift/release | ||||||
|
|
||||||
| Prow [job configs](https://github.com/openshift/release/tree/main/ci-operator/config/stackrox/stackrox) in the `openshift/release` repository reference these images via | ||||||
| `build_root.image_stream_tag`. The tags must first be mirrored in | ||||||
| `core-services/image-mirroring/_config.yaml`. | ||||||
|
|
||||||
| - **Master/nightly configs**: use `stable` tag -- periodically, automatically picks up | ||||||
| promoted versions without config changes. | ||||||
| - **Release branch configs**: pin to a specific version (e.g. `scanner-test-0.5.7`) | ||||||
| for reproducibility. | ||||||
| - **`latest` tag**: use only for testing PRs against openshift/release. | ||||||
| `latest` is a moving target and should not be used for required jobs -- | ||||||
| it is intended only for validation before promoting to `stable`. | ||||||
|
|
||||||
| ### Mirroring new versions to openshift CI | ||||||
|
|
||||||
| To mirror a new versioned tag for release branch use: | ||||||
|
|
||||||
| 1. Add an entry to `core-services/image-mirroring/_config.yaml` in openshift/release | ||||||
| 2. PR requires testplatform team review | ||||||
|
|
||||||
| The `latest` and `stable` floating tags are mirrored once and do not need | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| updates per version. | ||||||
|
|
||||||
| ## Step-by-step: Making a CI Image Change | ||||||
|
|
||||||
| Example: you need to bump a dependency or add a tool to the CI image. | ||||||
|
|
||||||
| 1. **Make your change** on a branch and open a PR in this repo. | ||||||
| 2. **Merge to main** -- once approved, merge the PR. The `tag.yaml` workflow | ||||||
| auto-creates a semver tag (e.g. `0.5.8`). | ||||||
| 3. **Wait for the build** -- the `build.yaml` workflow builds all image flavors | ||||||
| and pushes both versioned and `latest` tags to quay.io. | ||||||
| 4. **Test in openshift/release** -- open a PR in `openshift/release` that | ||||||
| references the `latest` tag and run `/pj-rehearse` to validate affected | ||||||
| prow jobs. No config change is needed if the jobs already use `latest`. | ||||||
|
Comment on lines
+67
to
+70
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe mention that mirroring can take some time and thus a pause may be necessary between 3 and 4? |
||||||
| 5. **Promote to stable** -- once rehearsals pass, [run the promote-stable | ||||||
| workflow](https://github.com/stackrox/rox-ci-image/actions/workflows/promote-stable.yaml) | ||||||
| (or `gh workflow run promote-stable.yaml`). This retags `latest` → `stable`. | ||||||
| Master/nightly prow jobs pick up the new image automatically. | ||||||
| 6. **Pin release branches** (if needed) -- for release branch configs, update | ||||||
| `openshift/release` to reference the specific versioned tag | ||||||
| (e.g. `stackrox-test-0.5.8`). This requires testplatform review. | ||||||
|
|
||||||
| > **Note:** There is only one `latest` tag per flavor, so only one | ||||||
| > rox-ci-image change can be tested via rehearsal at a time. Coordinate | ||||||
| > with others if multiple changes are in flight. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| ## Updating the Go Version | ||||||
|
|
||||||
| To bump the Go version across all Docker images in this repository, use the automated script: | ||||||
|
|
||||||
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.
This is all very nice and describes various bits and pieces. But what a random person who wants to bump a random dependency would look for is a step-by-step guide on how to get it out of the door.
We also need to agree on some sort of synchronization against multiple changes to this repo that are in flight. because there can only be one latest tag at a time so a single change to openshift/release can be tested at a given moment.
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.
Understood. I'll add a step-by-step walkthrough
And you're right, if someone is testing a
latest(current master of rox-ci-image) and a PR merges to rox-ci-image and pushes a new latest image and that gets mirrored, then the testing could get a newer "latest" than they expected.However, I think that is rare because we do not change these images often. Would it be helped or prevented if I add a GHA check that warns on PRs if the "stable" tag is older than the last "latest" tag on master? (So the PR creator could look at master to see what other changes are "in-flight" and not promoted to stable yet)
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.
@porridge I merged this to unblock m.clasmeier. Does the updated readme look better, or what can be improved?
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.
Much better. Though I have some nitpicks.