Skip to content
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

feat: switch to file-based OLM catalogs #191

Closed
wants to merge 1 commit into from

Conversation

sthaha
Copy link
Collaborator

@sthaha sthaha commented Sep 13, 2022

In order to switch to new file-based OLM catalogs, following changes were made

  • upgrade to newer version of operator-sdk tools (operator-sdk, olm)

  • Generate existing bundles

  • Add 0.0.13 bundle to the new catalog image by

    • creating new catalog index dockerfile
    • adding package definition for observability-operator * add 0.0.13 bundle and channels
  • Add olm/update-channels.sh script to update olm catalog channels

  • Fix GitHub workflow to adapt to constraints introduced by the new file-based catalog

NOTE: This PR introduces a change to CI post-merge action - release.

Previously, when a commit is merged to main, the CI job used to publish a catalog image which did not require any change to the code. With the file-based catalog, the new bundle that is published needs to be added to the catalog index.yaml file. Hence, the CI job release that calls the olm-publish action now adds a commit on top the commit that got merged into main and pushes that commit to the repo if a catalog image could be published successfully.

JIRA: https://issues.redhat.com/browse/MON-2791

Signed-off-by: Sunil Thaha sthaha@redhat.com

@sthaha sthaha requested a review from a team as a code owner September 13, 2022 04:26
@sthaha sthaha force-pushed the feat-olm-catalog-2791 branch 3 times, most recently from f21a94a to b94daea Compare September 13, 2022 04:38
name: development
entries:
- name: observability-operator.v0.0.13
### DEVELOPMENT_CHANNEL_MARKER ###
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once this patch merges and we can release 0.0.14 successfully, we should probably revisit this part and see if we can cause kustomize to add the entries.
For every new version we add it should add something like

  - name: observability-operator.v<new-version>
    replaces: observability-operator.v<previous-version>

to appropriate channels.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 yep was thinking the same when I looked at update-channels.sh :)
If kustomize doesn't work maybe at least something else that actually interprets yaml.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have seen other teams write (python) script to parse and update yaml
but I think maintaining separate files for channels and using kustomize to assemble it might work. I took the easy route (as you can see :D )

@sthaha sthaha force-pushed the feat-olm-catalog-2791 branch 2 times, most recently from 68bdad6 to ab5b19e Compare September 13, 2022 07:55
npx standard-version -i RELEASE_BODY.md --release-as $(cat VERSION) --skip.commit
npx standard-version -i RELEASE_BODY.md \
--release-as $(cat VERSION) \
--skip.commit
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: unlike old release workflow, this one does not push the tag and only creates a draft release without a git tag. The git tag gets created only after the commit that updates index.yaml is added (after running olm-publish workflow) and pushed

@tremes
Copy link
Contributor

tremes commented Sep 13, 2022

I tried to release my custom catalog image and deploy it to my 4.12 cluster and it works fine.

In order to switch to new file-based OLM catalogs, following changes
were made

  * upgrade to newer version of operator-sdk tools (operator-sdk, olm)
  * Generate existing bundles
  * Add 0.0.13 bundle to the new catalog image by
    *  creating new catalog index dockerfile
    *  adding package definition for observability-operator
    *  add 0.0.13 bundle and channels

  *  Add olm/update-channels.sh script to update olm catalog channels
  * Fix GitHub workflow to adapt to constraints introduced by the new
    file-based catalog

**NOTE:** This PR introduces a change to CI post-merge action - release.

Previously, when a commit is merged to main, the CI job used to publish
a catalog image which did not require any change to the code. With the
file-based catalog, the new bundle that is published needs to be added
to the catalog index.yaml file. Hence, the CI job release that calls the
`olm-publish` action now adds a commit on top the commit that got merged
into `main` and **pushes** that commit to the repo if a catalog image
could be published successfully.

JIRA: https://issues.redhat.com/browse/MON-2791

Signed-off-by: Sunil Thaha <sthaha@redhat.com>
declare -r CATALOG_INDEX_FILE="olm/observability-operator-index/index.yaml"

update_channel() {
local channel=$1; shift
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
local channel=$1; shift
local channel="$1"; shift


update_channel() {
local channel=$1; shift
local bundle=$1; shift
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
local bundle=$1; shift
local bundle="$1"; shift


echo "channels: $channels | bundle: $bundle"

# convert coma seperated list to an array
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# convert coma seperated list to an array
# convert comma seperated list to an array

.github/olm-publish/action.yaml Show resolved Hide resolved
Copy link
Collaborator

@jan--f jan--f left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!
I think it would be great to have more comments around the opm usage, especially the Dockerfile and opm serve. The documentation wasn't super straight forward to find and outlining what these pieces actually do might be a service to future developers.

name: development
entries:
- name: observability-operator.v0.0.13
### DEVELOPMENT_CHANNEL_MARKER ###
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 yep was thinking the same when I looked at update-channels.sh :)
If kustomize doesn't work maybe at least something else that actually interprets yaml.

@sthaha
Copy link
Collaborator Author

sthaha commented Sep 14, 2022

@jan--f

I think it would be great to have more comments around the opm usage, especially the Dockerfile and opm serve. The documentation wasn't super straight forward to find and outlining what these pieces actually do might be a service to future developers.

As soon as this merges, I am happy to write a docs/ops/release.md where we can explain the release workflow.

For OLM Catalog I used the following refs

Where do we want these references to be updated?

@sthaha
Copy link
Collaborator Author

sthaha commented Sep 16, 2022

Closing this in favour of #195 where the catalog index file will be maintained in the olm-catalog branch

@sthaha sthaha closed this Sep 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants