Skip to content

Commit

Permalink
feat: switch to file-based OLM catalogs
Browse files Browse the repository at this point in the history
The Catalog index yaml file for the new file-based catalog will be
maintained in the olm-catalog branch. The PR introduces the changes
needed to generate new catalog index entry for new releases to the
development, candidate, and the stable channel and to push the updated
index to the olm-catalog git branch.

 To switch to new file-based OLM catalogs, following changes have been made

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

  * Generate catalog for existing 0.0.13 bundle by
    * creating new catalog index dockerfile
    * adding package definition for observability-operator
    * adding channel definitions for all 3 channels
    see: #194

  * Modify GitHub workflow to adapt to the new file-based catalog

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

Signed-off-by: Sunil Thaha <sthaha@redhat.com>
  • Loading branch information
sthaha committed Sep 20, 2022
1 parent ece8d8c commit d953460
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 15 deletions.
28 changes: 26 additions & 2 deletions .github/olm-publish/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ runs:
using: composite
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup Go environment
uses: actions/setup-go@v3
Expand All @@ -33,6 +35,18 @@ runs:
username: ${{ inputs.quay_login }}
password: ${{ inputs.quay_token }}

- name: Git merge olm-catalog branch
shell: bash
run: |
git config user.name rhobs-release-bot
git config user.email release-bot@monitoring.rhobs.io
# NOTE: uses strategy-option=ours as bundle created for a release using
# make initiate-release conflicts with the previous bundle created for
# development branch, so the version in main takes precedence over the
# one in olm-catalog branch
git merge -Xours origin/olm-catalog -m "ci: merge olm-catalog branch"
- name: Build Operator Image
shell: bash
run: make operator-image
Expand All @@ -49,10 +63,20 @@ runs:
shell: bash
run: make bundle-push


- name: Build Catalog Image
shell: bash
run: make catalog-image FIRST_OLM_RELEASE=true
run: |
make catalog-image
# NOTE: add a commit only if the catalog can built sucessfully
git add bundle/ olm/
git commit -m "ci(bot): update catalog image"
- name: Publish catalog image
shell: bash
run: make catalog-push
run: |
make catalog-push
# update olm-catalog only if catalog could be successfully published
git push origin HEAD:olm-catalog
4 changes: 2 additions & 2 deletions .github/tools
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ golangci-lint v1.45.2
controller-gen v0.9.2
kustomize v4.5.2
oc v4.8.11
operator-sdk v1.13.0
opm v1.15.1
operator-sdk v1.23.0
opm v1.26.1
promq v0.0.1
crdoc v0.5.2
jsonnet v0.17.0
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/olm-candidate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ jobs:
runs-on: ubuntu-latest
environment: quay
steps:
- uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
token: ${{ secrets.REPOSITORY_PUSH_TOKEN }}

- name: Import common environment variables
run: cat ".github/env" >> $GITHUB_ENV
Expand All @@ -22,7 +26,7 @@ jobs:
version="$(cat VERSION)-rc"
echo "::set-output name=version::$version"
- name: publish
- name: publish catalog
uses: ./.github/olm-publish
env:
IMAGE_BASE: ${{ secrets.IMAGE_BASE }}
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/olm-stable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ jobs:
environment: quay
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Import common environment variables
run: cat ".github/env" >> $GITHUB_ENV
Expand Down
15 changes: 13 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ jobs:
quay_login: ${{ secrets.QUAY_LOGIN }}
quay_token: ${{ secrets.QUAY_TOKEN }}

- name: Push catalog index changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.REPOSITORY_PUSH_TOKEN }}
branch: olm-catalog

create-github-prerelease:
needs:
- e2e-tests-olm
Expand Down Expand Up @@ -87,11 +93,16 @@ jobs:
# Create the release notes for the Github release
git config user.name rhobs-release-bot
git config user.email release-bot@monitoring.rhobs.io
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
- name: Publish tag
id: publish_tag
run: |
# NOTE tag is created by standard-version and points to the
# chore(release): commit as opposed to pointing to the commit added
# to olm-catalog branch after images are built and pushed
git push --follow-tags
echo ::set-output name=tag_name::$(git describe HEAD --abbrev=0)
Expand All @@ -103,5 +114,5 @@ jobs:
release_name: ${{ steps.publish_tag.outputs.tag_name }}
tag_name: ${{ steps.publish_tag.outputs.tag_name }}
body_path: RELEASE_BODY.md
# We always generate pre-releases and mark them as releases manually
# NOTE: We always generate pre-releases and mark them as releases manually
prerelease: true
4 changes: 2 additions & 2 deletions Makefile.tools
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ KUSTOMIZE=$(TOOLS_DIR)/kustomize
KUSTOMIZE_VERSION= v4.5.2

OPERATOR_SDK = $(TOOLS_DIR)/operator-sdk
OPERATOR_SDK_VERSION = v1.13.0
OPERATOR_SDK_VERSION = v1.23.0

OPM=$(TOOLS_DIR)/opm
OPM_VERSION = v1.15.1
OPM_VERSION = v1.26.1

GOLANGCI_LINT=$(TOOLS_DIR)/golangci-lint
GOLANGCI_LINT_VERSION = v1.45.2
Expand Down
15 changes: 12 additions & 3 deletions bundle/manifests/observability-operator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ metadata:
}
]
capabilities: Basic Install
operators.operatorframework.io/builder: operator-sdk-v1.12.0+git
operators.operatorframework.io/builder: operator-sdk-v1.23.0
operators.operatorframework.io/project_layout: unknown
name: observability-operator.v0.0.13
namespace: placeholder
Expand Down Expand Up @@ -308,7 +308,11 @@ spec:
- use
serviceAccountName: observability-operator-sa
deployments:
- name: observability-operator
- label:
app.kubernetes.io/component: operator
app.kubernetes.io/name: observability-operator
app.kubernetes.io/version: 0.0.1
name: observability-operator
spec:
replicas: 1
selector:
Expand Down Expand Up @@ -366,7 +370,12 @@ spec:
runAsNonRoot: true
serviceAccountName: observability-operator-sa
terminationGracePeriodSeconds: 30
- name: observability-operator-prometheus-operator
- label:
app.kubernetes.io/component: controller
app.kubernetes.io/name: prometheus-operator
app.kubernetes.io/part-of: observability-operator
app.kubernetes.io/version: 0.57.0
name: observability-operator-prometheus-operator
spec:
replicas: 1
selector:
Expand Down
2 changes: 1 addition & 1 deletion bundle/metadata/annotations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ annotations:
operators.operatorframework.io.bundle.package.v1: observability-operator
operators.operatorframework.io.bundle.channels.v1: development
operators.operatorframework.io.bundle.channel.default.v1: development
operators.operatorframework.io.metrics.builder: operator-sdk-v1.12.0+git
operators.operatorframework.io.metrics.builder: operator-sdk-v1.23.0
operators.operatorframework.io.metrics.mediatype.v1: metrics+v1
operators.operatorframework.io.metrics.project_layout: unknown

Expand Down
2 changes: 1 addition & 1 deletion hack/olm/subscription.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
name: observability-operator
namespace: openshift-operators
spec:
channel: stable
channel: development
installPlanApproval: Automatic
name: observability-operator
source: observability-operator
Expand Down

0 comments on commit d953460

Please sign in to comment.