Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
117 commits
Select commit Hold shift + click to select a range
f7abddb
WIP script to generate catalog-template.yaml
kurlov Jul 1, 2025
9077e29
Drop previous approach
kurlov Jul 7, 2025
7f45122
Remove redundant bash script
kurlov Jul 7, 2025
fb74d4e
Improve
kurlov Jul 8, 2025
67f98d8
Fix generation bugs
kurlov Jul 8, 2025
da2882f
Use latest yaml library
kurlov Jul 9, 2025
52ecdd5
Merge branch 'master' into akurlov/add-catalog-generation-from-folder…
kurlov Jul 9, 2025
cacdf62
Merge branch 'master' into akurlov/add-catalog-generation-from-folder…
kurlov Jul 9, 2025
742e929
Drop unused structs and rename existing
kurlov Jul 9, 2025
9f7710d
Simplify file writting
kurlov Jul 9, 2025
38543b2
use semver library instead
kurlov Jul 9, 2025
d8a4da6
Add tests
kurlov Jul 9, 2025
09226f7
Add additional comment and replace original catalog-temlate
kurlov Jul 10, 2025
f76395d
Merge branch 'master' into akurlov/add-catalog-generation-from-folder…
kurlov Jul 14, 2025
b057e1a
Move files and address review comments
kurlov Jul 15, 2025
9a6e92f
Use Parse for validating image reference
kurlov Jul 15, 2025
237dbe6
Merge branch 'master' into akurlov/add-catalog-generation-from-folder…
kurlov Jul 15, 2025
31a607a
Rollback catalog-template
kurlov Jul 22, 2025
a1e067b
Add 4.7.5
kurlov Jul 22, 2025
af2bfe4
Change adding skips, channel entries and refactor channel entry creation
kurlov Jul 22, 2025
2b59601
Merge branch 'master' into akurlov/add-catalog-generation-from-folder…
kurlov Jul 22, 2025
b918400
Update catalogs
kurlov Jul 22, 2025
d0e2db7
Merge branch 'master' into akurlov/add-catalog-generation-from-folder…
kurlov Jul 22, 2025
4f95a47
Update input format and use latest catalog teplate
kurlov Jul 29, 2025
2dc269d
Merge branch 'master' into akurlov/add-catalog-generation-from-folder…
kurlov Jul 29, 2025
01fb9df
Add vscode settings to gitignore
kurlov Jul 29, 2025
5433ddb
Use input for broken versions and bundle deprecations
kurlov Jul 29, 2025
5463281
Update catalogs
kurlov Jul 29, 2025
7e3075b
Fail if bundle images are not sorted in ascending order
kurlov Jul 29, 2025
91c80bd
Merge branch 'master' into akurlov/add-catalog-generation-from-folder…
kurlov Jul 29, 2025
14143c7
Apply suggestions from code review
kurlov Jul 30, 2025
6aef397
Move types
kurlov Jul 31, 2025
2d03d0e
Fix go.mod structure
kurlov Jul 31, 2025
d8f5f8a
Add 4.6.8 version
kurlov Jul 31, 2025
38b5248
Update catalogs
kurlov Jul 31, 2025
f510eb5
Fix latest channel duplication
kurlov Jul 31, 2025
04dabf1
Update catalogs
kurlov Jul 31, 2025
4654434
Add command for running the script
kurlov Aug 4, 2025
37c5f66
Add CI checks
kurlov Aug 4, 2025
b73cd41
Update tests
kurlov Aug 4, 2025
3099d33
Review comments
kurlov Aug 4, 2025
7996361
Create channel for 3.63
kurlov Aug 4, 2025
68d7e59
Merge branch 'master' into akurlov/add-catalog-generation-from-folder…
kurlov Aug 4, 2025
bae55c6
Update catalog-template.yaml perms
kurlov Aug 4, 2025
4306cef
Update catalogs
kurlov Aug 4, 2025
39fb840
Add CI catalog-tempalte.yaml permissions
kurlov Aug 4, 2025
dad7c44
Remove the out file to handle permission issues
kurlov Aug 4, 2025
e456fd1
Drop the output file before writting
kurlov Aug 4, 2025
52d7c72
Move catalog-template.yaml to folder
kurlov Aug 4, 2025
d1e10cb
Use another image
kurlov Aug 4, 2025
a33aae2
Use another image
kurlov Aug 4, 2025
c7d4021
Use another image
kurlov Aug 4, 2025
550db6b
use go-toolset image
kurlov Aug 4, 2025
9b027c6
Change workdir
kurlov Aug 4, 2025
482a2aa
Change workdir
kurlov Aug 4, 2025
149a3a3
Change workdir
kurlov Aug 4, 2025
2dbd845
Fix perms
kurlov Aug 4, 2025
06b92a8
move catalog-template to root
kurlov Aug 4, 2025
0335a94
Configre CI for unittests
kurlov Aug 4, 2025
238c4fc
Run push unit test only for master
kurlov Aug 4, 2025
66b89ed
Apply suggestions from code review
kurlov Aug 6, 2025
263f30c
Update cmd/generate-catalog/generate.go
kurlov Aug 6, 2025
4262df9
Fix
kurlov Aug 6, 2025
3bf1197
Merge branch 'akurlov/add-catalog-generation-from-folder-structure' o…
kurlov Aug 6, 2025
5658181
Review comments
kurlov Aug 6, 2025
0163cab
Update deprecation messages
kurlov Aug 6, 2025
b0b9d59
Add separte message for broken versions
kurlov Aug 6, 2025
5c8758c
Review comment
kurlov Aug 6, 2025
cf68c40
Change channel deprecation
kurlov Aug 6, 2025
a7021af
Apply suggestions from code review
kurlov Aug 6, 2025
c3cf3c2
Add constants for 3.62.0 and 4.0.0
kurlov Aug 6, 2025
0adc804
Update CI
kurlov Aug 6, 2025
b94b2bd
Merge branch 'master' into akurlov/add-catalog-generation-from-folder…
kurlov Aug 6, 2025
931e23f
Move catalog-template generation to check files up-to-date
kurlov Aug 6, 2025
9c2178a
Add a separate step for checkking catalog-template
kurlov Aug 6, 2025
95500b4
Update catalogs and remove github actions
kurlov Aug 6, 2025
1fa69e6
Remove redundant pipelinerun
kurlov Aug 6, 2025
383e2e4
Update README.md
kurlov Aug 6, 2025
439b924
Update Makefile
kurlov Aug 7, 2025
38a53cc
Merge branch 'master' into akurlov/add-catalog-generation-from-folder…
kurlov Aug 7, 2025
5d93cd5
Add .go files dependency to catalog-template.yaml command
kurlov Aug 7, 2025
ff0f25d
Move go unit tests to a separate task
kurlov Aug 7, 2025
efcf1a0
Add use-trusted-artifact
kurlov Aug 7, 2025
0d4605f
Fix CI
kurlov Aug 7, 2025
bd6fff8
Update cmd/generate-catalog/generate.go
kurlov Aug 7, 2025
e2c5449
Update CI
kurlov Aug 7, 2025
0eb9e54
Add variable for generate-catalog folder
kurlov Aug 7, 2025
f98da74
Add variable for generate-catalog folder
kurlov Aug 7, 2025
8be8c44
Update catalogs
kurlov Aug 7, 2025
9f2cb4c
Update deprecation messages
kurlov Aug 7, 2025
4455902
Apply suggestions from code review
kurlov Aug 8, 2025
b9b9f3c
Review comments
kurlov Aug 11, 2025
178bd76
Update docs for oldest supported version
kurlov Aug 12, 2025
211a321
Update catalogs
kurlov Aug 12, 2025
6239203
Add tests for reading input file
kurlov Aug 12, 2025
6dfcb9e
Rework channel generation
kurlov Aug 12, 2025
ca7b4bd
Merge branch 'master' into akurlov/add-catalog-generation-from-folder…
kurlov Aug 12, 2025
bc87179
Apply suggestions from code review
kurlov Aug 18, 2025
9c152fb
Fix README
kurlov Aug 18, 2025
265043e
Change head comment
kurlov Aug 18, 2025
b7ad9b5
Add end line space
kurlov Aug 18, 2025
f9d49e7
Merge branch 'akurlov/add-catalog-generation-from-folder-structure' o…
kurlov Aug 18, 2025
4454f14
Review comments
kurlov Aug 18, 2025
08deccb
Apply suggestions from code review
kurlov Aug 19, 2025
259c9ce
Review comments
kurlov Aug 19, 2025
b9850bf
Use StrictNewVersion
kurlov Aug 19, 2025
87ba005
Drop redundant patch == 0
kurlov Aug 19, 2025
fbe2c74
Resolve conflicts
kurlov Aug 20, 2025
9930683
Review comments
kurlov Aug 21, 2025
44a2530
Add TODO
kurlov Aug 21, 2025
d5b08cb
Update catalogs
kurlov Aug 21, 2025
cc03d50
Add brokenVersionSkippingOffset constant
kurlov Aug 21, 2025
4ae9576
Apply suggestions from code review
kurlov Aug 21, 2025
5c47c24
Fix compiling
kurlov Aug 21, 2025
c7673cb
Review comments
kurlov Aug 21, 2025
aaa6b2f
Review comments
kurlov Aug 21, 2025
0aff37c
Fix newline
kurlov Aug 28, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@

# Leftover staging directory for importing legacy catalog. Can be safely deleted
/catalog-migrate/

# Ignore VS code local settings
.vscode
8 changes: 3 additions & 5 deletions .tekton/check-generated-files-up-to-date-task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,15 @@ spec:
- use
- $(params.SOURCE_ARTIFACT)=/var/workdir/source
- name: check-generated-files-up-to-date
image: registry.access.redhat.com/ubi9:latest@sha256:8851294389a8641bd6efcd60f615c69e54fb0e2216ec8259448b35e3d9a11b06
image: registry.redhat.io/ubi9/go-toolset@sha256:3ce6311380d5180599a3016031a9112542d43715244816d1d0eabc937952667b
workingDir: /var/workdir/source
securityContext:
runAsUser: 0
script: |
#!/usr/bin/env bash
set -euo pipefail
set -x

time dnf -y upgrade --nobest
# TODO: find an image with these preinstalled to reduce flakiness
time dnf -y install git make jq

time make clean
cmd="make valid-catalogs"
time $cmd
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: tekton.dev/v1
kind: Task
metadata:
name: check-catalog-template-has-only-released-images
name: check-operator-images-are-only-released-images
namespace: rh-acs-tenant
spec:
description: This task is to prevent operator bundle images from quay.io or any repositories other than release ones to be added to the `master` branch. This is to make sure `master` is in good state to be released and would not require first cleaning unreleased bundles from it.
Expand Down Expand Up @@ -30,7 +30,7 @@ spec:
#!/usr/bin/env bash
set -euo pipefail

if yq eval '.. | select(has("image")) | .image' catalog-template.yaml | grep -vE '^registry\.redhat\.io/advanced-cluster-security/rhacs-operator-bundle(:|@)'; then
echo >&2 "catalog-template.yaml has image(s) not from registry.redhat.io/advanced-cluster-security/rhacs-operator-bundle. It is not allowed to merge such bundle images to master branch because it will no longer be releasable."
if yq eval '.images[].image' bundles.yaml | grep -vE '^registry\.redhat\.io/advanced-cluster-security/rhacs-operator-bundle(:|@)'; then
echo >&2 "bundles.yaml has image(s) not from registry.redhat.io/advanced-cluster-security/rhacs-operator-bundle. It is not allowed to merge such bundle images to master branch because it will no longer be releasable."
exit 1
fi
27 changes: 24 additions & 3 deletions .tekton/checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,28 @@ spec:
- name: basic-auth
workspace: git-auth

- name: run-go-unit-tests
taskSpec:
metadata:
name: run-go-unit-tests
volumes:
- name: workdir
emptyDir: { }
stepTemplate:
volumeMounts:
- mountPath: /var/workdir
name: workdir
steps:
- name: use-trusted-artifact
image: quay.io/redhat-appstudio/build-trusted-artifacts:latest@sha256:9b180776a41d9a22a1c51539f1647c60defbbd55b44bbebdd4130e33512d8b0d
args:
- use
- $(tasks.clone-repository.results.SOURCE_ARTIFACT)=/var/workdir/source
- name: run-go-tests
image: registry.redhat.io/ubi9/go-toolset@sha256:3ce6311380d5180599a3016031a9112542d43715244816d1d0eabc937952667b
workingDir: /var/workdir/source
script: time make go-test

- name: check-generated-files-up-to-date
params:
- name: SOURCE_ARTIFACT
Expand All @@ -92,10 +114,9 @@ spec:
taskRef:
name: check-generated-files-up-to-date

- name: check-catalog-template-has-only-released-images
- name: check-operator-images-are-only-released-images
params:
- name: SOURCE_ARTIFACT
value: $(tasks.clone-repository.results.SOURCE_ARTIFACT)
retries: 3
taskRef:
name: check-catalog-template-has-only-released-images
name: check-operator-images-are-only-released-images
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,18 @@ MAKEFLAGS += "-j 2"

OPM = .bin/opm-$(OPM_VERSION)

GO := go

GENERATE_SCRIPT_FOLDER = ./cmd/generate-catalog/

.PHONY: valid-catalogs
valid-catalogs: $(CATALOGS) $(OPM)
$(OPM) validate catalog-bundle-object
$(OPM) validate catalog-csv-metadata

.PHONY: clean
clean:
rm -f catalog-template.yaml
rm -f $(CATALOGS)
rm -rf $$(dirname $(OPM))

Expand All @@ -24,6 +29,13 @@ catalog-csv-metadata/rhacs-operator/catalog.json: catalog-template.yaml $(OPM)
mkdir -p "$$(dirname "$@")"
$(OPM) alpha render-template basic --migrate-level bundle-object-to-csv-metadata $< > $@

# update template/catalog-template.yaml based on bundles.yaml file.
catalog-template.yaml: bundles.yaml $(wildcard $(GENERATE_SCRIPT_FOLDER)/*.go)
@$(GO) run $(GENERATE_SCRIPT_FOLDER)

go-test:
@$(GO) test -cover -v ./cmd/...

$(OPM):
mkdir -p "$$(dirname $@)"
os_name="$$(uname | tr '[:upper:]' '[:lower:]')"; \
Expand Down
109 changes: 22 additions & 87 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,97 +13,32 @@ See more in [our docs](https://spaces.redhat.com/display/StackRox/How+to+everyth

### <a name="add-bundle"></a> Adding new ACS operator version

Do the following changes in the `catalog-template.yaml` file.

1. Add bundle image.
1. Find entries with `schema: olm.bundle` towards the end of the file.
2. Add a new entry for your bundle image.
It should look something like this:
```yaml
- schema: olm.bundle
# 4.7.9
image: brew.registry.redhat.io/rh-osbs/rhacs-operator-bundle@sha256:c82e8330c257e56eb43cb5fa7b0c842a7f7f0414e32e26a792ef36817cb5ca02
```
* Note that the image must be referenced by digest, not by tag.
* Keep entries sorted according to version.
* Add a comment stating the version, see how it's done for other items there.
* You may add bundle images from `quay.io`, `brew.registry.redhat.io` and so on (provided they exist and are
pullable) during development and/or when preparing to release.
Ultimately, all released bundle images must come from
`registry.redhat.io/advanced-cluster-security/rhacs-operator-bundle` repo because this is where customers expect
to find them. There's a CI check which prevents pushing to `master` if there's any bundle from
a different repo.
* If you're adding a bundle as part of downstream release, you will find bundle image's digest in the email with
a subject `[CVP] (SUCCESS) cvp-redhatadvancedclustersecurity: rhacs-operator-bundle-container-4.Y.Z-x`. Open the
link in `Brew Build Info` and find the digest of the
`registry-proxy.engineering.redhat.com/rh-osbs/rhacs-operator-bundle` image. Take that image and replace
`registry-proxy.engineering.redhat.com` with `brew.registry.redhat.io`.
2. Add entry to the `stable` channel.
1. Find the `stable` channel block. It starts with:
```yaml
- schema: olm.channel
name: stable
```
2. Add a new item into its `entries` list.
* Entries must be sorted by version (e.g., you must insert `4.8.2` after `4.8.1` but before `4.9.0`).
* Ensure there are consistent blank lines between entries of different Y-streams.
* Entry format is
```yaml
- &bundle-4-Y-Z
name: rhacs-operator.v4.Y.Z
replaces: rhacs-operator.v4.PREVIOUS_Y.PREVIOUS_Z
skipRange: '>= 4.(Y-1).0 < 4.Y.Z'
```
Replace
* `Y` with minor version (e.g., `8` in `4.8.2`),
* `Z` with patch version (e.g., `2` in `4.8.2`),
* `PREVIOUS_Y` and `PREVIOUS_Z` with minor and patch versions of the previous item (e.g., when you add `4.8.2`
after `4.8.1`, that'd be `8` and `1`; when you add `4.9.0` after `4.8.3`, that'd be `8` and `3`),
* `(Y-1)` with the value of `Y` minus 1 (e.g., when you add `4.8.2`, that'd be `7`).
3. If the item you added is not the last one in the `entries` list, i.e., not the highest version, adjust the next
item in the `entries` list.
Set its `replaces:` to be `rhacs-operator.v4.Y.Z`.
For example:
```yaml
- &bundle-4-7-4 # <-------- this was already there
name: rhacs-operator.v4.7.4
replaces: rhacs-operator.v4.7.3
skipRange: '>= 4.6.0 < 4.7.4'
- &bundle-4-7-5 # <-------- this one I'm adding
name: rhacs-operator.v4.7.5
replaces: rhacs-operator.v4.7.4
skipRange: '>= 4.6.0 < 4.7.5'

- &bundle-4-8-0 # <-------- this was already there
name: rhacs-operator.v4.8.0
replaces: rhacs-operator.v4.7.4 # <-------- must change here to rhacs-operator.v4.7.5
skipRange: '>= 4.7.0 < 4.8.0'
```
3. Add entry to `rhacs-4.?` channels.
* For every `schema: olm.channel` with `name` like `rhacs-4.?` where `?` is >= `Y`,
* add `- *bundle-4-Y-Z` to the `entries:` list (replacing `Y` and `Z` with minor and patch versions).
* Maintain the entries sorted and with consistent linebreaks.
4. Add `rhacs-4.Y` channel. Skip this step if the channel already exists (i.e., when `Z` > `0`).
* Keep the channels sorted.
* In the `entries:`, reference all items from `4.0.0` up to (and including) `4.Y.Z`.

It should look something like this (replacing `Y`, `Z` as appropriate):
1. Open `bundles.yaml` file.
2. Add a new operator bundle image with version:
```yaml
- schema: olm.channel
name: rhacs-4.Y
package: rhacs-operator
entries:
- *bundle-4-0-0
- *bundle-4-0-1
# ... and so on ...

- *bundle-4-Y-Z
- image: brew.registry.redhat.io/rh-osbs/rhacs-operator-bundle@sha256:c82e8330c257e56eb43cb5fa7b0c842a7f7f0414e32e26a792ef36817cb5ca02
version: X.Y.Z
```
* Note that the image must be referenced by digest, not by tag.
* Keep entries sorted by version.
* You may add bundle images from `quay.io`, `brew.registry.redhat.io` and so on (provided they exist and are pullable) during development and/or when preparing to release.
Ultimately, all released bundle images must come from
`registry.redhat.io/advanced-cluster-security/rhacs-operator-bundle` repo because this is where customers expect
to find them. There's a CI check which should make it impossible to push to `master` if there's any bundle from
a different repo.
* If you're adding a bundle as part of downstream release, you will find bundle image's digest in
`[CVP] (SUCCESS) cvp-redhatadvancedclustersecurity: rhacs-operator-bundle-container-4.Y.Z-x` email. Open the
link in `Brew Build Info` and find the digest of the
`registry-proxy.engineering.redhat.com/rh-osbs/rhacs-operator-bundle` image. Take that image and replace
`registry-proxy.engineering.redhat.com` with `brew.registry.redhat.io`.
3. Update `oldest_supported_version` value:
* Check `Life Cycle Dates` table in [Red Hat Advanced Cluster Security for Kubernetes Support Policy](https://access.redhat.com/support/policy/updates/rhacs).
* Set `oldest_supported_version` to be the oldest Y-Stream version still in support according to that table, including Maintenance Support. Patch number should always be `.0`. For example, if 4.6 is the oldest in support (maintenance phase), set `oldest_supported_version: 4.6.0`.
4. Run `make catalog-template.yaml`. This step should update `catalog-template.yaml` with the new version.
5. Update catalogs (follow [updating catalogs steps](#updating-catalogs))
6. Open a PR with `Add 4.Y.Z version` title.

Once done with `catalog-template.yaml`:

1. Update catalogs (follow [updating catalogs](#updating-catalogs) steps below).
2. Open a PR with `Add 4.Y.Z version` title.

### Updating catalogs

Expand Down
Loading