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
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 13 additions & 2 deletions .github/olm-publish/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,19 @@ runs:

- name: Build Catalog Image
shell: bash
run: make catalog-image FIRST_OLM_RELEASE=true
run: |
make catalog-image

# NOTE: add the index.yaml only if the catalog could be built sucessfully
git config user.name rhobs-release-bot
git config user.email release-bot@monitoring.rhobs.io

git add olm/observability-operator-index/index.yaml
git commit -m "ci(bot): update catalog image"

- name: Publish catalog image
shell: bash
run: make catalog-push
run: |
make catalog-push
# update main only if catalog could be successfully published
git push origin HEAD:main
sthaha marked this conversation as resolved.
Show resolved Hide resolved
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: 8 additions & 0 deletions .github/workflows/olm-candidate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,11 @@ jobs:
quay_login: ${{ secrets.QUAY_LOGIN }}
quay_token: ${{ secrets.QUAY_TOKEN }}
go-version: ${{ env.go-version }}

- name: Publish tag
id: publish_tag
run: |
git config user.name rhobs-release-bot
git config user.email release-bot@monitoring.rhobs.io
git tag -a "$(cat VERSION)" -m "$(cat VERSION) release candidate"
git push --follow-tags
15 changes: 7 additions & 8 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
go-version: ${{ env.go-version }}

publish-olm-development:
if: "!startsWith(github.event.head_commit.message, 'chore(release):')"
if: "!startsWith(github.event.head_commit.message, 'chore(release):') && !startsWith(github.event.head_commit.message, 'ci(bot): update catalog image')"
runs-on: ubuntu-latest
environment: quay
needs:
Expand Down Expand Up @@ -83,25 +83,24 @@ jobs:
go-version: ${{ env.go-version }}

- name: Generate release notes
id: release_notes
run: |
# 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
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


- name: Publish tag
id: publish_tag
run: |
git push --follow-tags
sthaha marked this conversation as resolved.
Show resolved Hide resolved
echo ::set-output name=tag_name::$(git describe HEAD --abbrev=0)

- name: Create Github release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.REPOSITORY_PUSH_TOKEN }}
with:
release_name: ${{ steps.publish_tag.outputs.tag_name }}
tag_name: ${{ steps.publish_tag.outputs.tag_name }}
release_name: ${{ steps.release_notes.outputs.tag_name }}
tag_name: ${{ steps.release_notes.outputs.tag_name }}
body_path: RELEASE_BODY.md
# We always generate pre-releases and mark them as releases manually
prerelease: true
35 changes: 10 additions & 25 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ IMAGE_BASE ?= observability-operator

VERSION ?= $(shell cat VERSION)
OPERATOR_IMG = $(IMAGE_BASE):$(VERSION)
OPERATOR_BUNDLE=observability-operator.v$(VERSION)
CONTAINER_RUNTIME := $(shell command -v podman 2> /dev/null || echo docker)

# running `make` builds the operator (default target)
Expand Down Expand Up @@ -163,12 +164,6 @@ bundle-image: bundle ## Build the bundle image.
bundle-push: ## Build the bundle image.
$(CONTAINER_RUNTIME) push $(PUSH_OPTIONS) $(BUNDLE_IMG)

# A comma-separated list of bundle images e.g.
# make catalog-build BUNDLE_IMGS=example.com/operator-bundle:v0.1.0,example.com/operator-bundle:v0.2.0).
#
# NOTE: These images MUST exist in a registry and be pull-able.
BUNDLE_IMGS ?= $(BUNDLE_IMG)

# The image tag given to the resulting catalog image
CATALOG_IMG ?= $(IMAGE_BASE)-catalog:$(VERSION)

Expand All @@ -177,29 +172,19 @@ CATALOG_IMG ?= $(IMAGE_BASE)-catalog:$(VERSION)
CATALOG_IMG_LATEST ?= $(IMAGE_BASE)-catalog:latest


# mark release as first by setting FIRST_OLM_RELEASE to true. This results in a
# root catalog image (i.e. no previous catalog images/ --from-index)
FIRST_OLM_RELEASE ?= false

# Set CATALOG_BASE_IMG to an existing catalog image tag to add $BUNDLE_IMGS to
# that image except for FIRST_OLM_RELEASE
ifeq ($(FIRST_OLM_RELEASE), false)
FROM_INDEX_OPT := --from-index $(CATALOG_IMG_LATEST)
endif

# Build a catalog image by adding bundle images to an empty catalog using the
# operator package manager tool, 'opm'.
#
# NOTE: This recipe invokes 'opm' in 'semver' bundle add mode. For more information
# on add modes, see:
# https://github.com/operator-framework/community-operators/blob/7f1438c/docs/packaging-operator.md#updating-your-existing-operator
.PHONY: catalog-image
sthaha marked this conversation as resolved.
Show resolved Hide resolved
catalog-image: $(OPM)
$(OPM) index add \
--container-tool $(CONTAINER_RUNTIME) \
--mode semver \
--tag $(CATALOG_IMG) \
--bundles $(BUNDLE_IMGS) $(FROM_INDEX_OPT)
$(OPM) render $(BUNDLE_IMG) \
--output=yaml >> olm/observability-operator-index/index.yaml
./olm/update-channels.sh $(CHANNELS) $(OPERATOR_BUNDLE)
$(OPM) validate ./olm/observability-operator-index

$(CONTAINER_RUNTIME) build \
-f olm/observability-operator-index.Dockerfile \
-t $(CATALOG_IMG)

# tag the catalog img:version as latest so that continious release
# is possible by refering to latest tag instead of a version
$(CONTAINER_RUNTIME) tag $(CATALOG_IMG) $(CATALOG_IMG_LATEST)
Expand Down
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
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
Loading