Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

Commit

Permalink
Merge pull request #155 from font/release-v0.1.2-rc.0
Browse files Browse the repository at this point in the history
Release v0.1.2-rc.0: use replaces for building index image
  • Loading branch information
font authored May 6, 2021
2 parents be2554e + 7c43b9a commit eb4acc2
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,6 @@ jobs:

- name: Build and Push Bundle Index Image
run: |
make bundle-index-build VERSION=master
PREV_BUNDLE_INDEX_IMG_VERSION=$(make prev-bundle-index-image-version)
make bundle-index-build VERSION=master REPLACES_VERSION=${PREV_BUNDLE_INDEX_IMG_VERSION}
make docker-push IMG=${WORKFLOW_BUNDLE_INDEX_IMG}:master
10 changes: 7 additions & 3 deletions .github/workflows/olm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,14 @@ jobs:
- name: Build and Push Test Container Image and Bundle/Bundle Index Images
run: |
# TODO: Use operator-sdk run bundle commands for testing with OLM.
sed -i '/ replaces:/d' ./config/manifests/bases/gatekeeper-operator.clusterserviceversion.yaml
# TODO: Use operator-sdk run bundle and bundle-upgrade commands for
# testing with OLM.
PREV_BUNDLE_INDEX_IMG_VERSION=$(make prev-bundle-index-image-version)
OPERATOR_VERSION=$(awk '/^VERSION/ {print $3}' Makefile)
make build-and-push-bundle-images IMG=localhost:5000/gatekeeper-operator:$GITHUB_SHA REPO=localhost:5000 VERSION=$GITHUB_SHA OPERATOR_VERSION=${OPERATOR_VERSION}
REPO=localhost:5000
IMG=${REPO}/gatekeeper-operator:${GITHUB_SHA}
PREV_BUNDLE_INDEX_IMG=quay.io/gatekeeper/gatekeeper-operator-bundle-index:${PREV_BUNDLE_INDEX_IMG_VERSION}
make build-and-push-bundle-images IMG=${IMG} REPO=${REPO} VERSION=${GITHUB_SHA} OPERATOR_VERSION=${OPERATOR_VERSION} PREV_BUNDLE_INDEX_IMG=${PREV_BUNDLE_INDEX_IMG}
- name: Deploy resources on KIND cluster to install Gatekeeper
run: |
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ jobs:

- name: Build and Push Bundle Index Image
run: |
make bundle-index-build VERSION=${RELEASE_VERSION}
PREV_BUNDLE_INDEX_IMG_VERSION=$(make prev-bundle-index-image-version)
make bundle-index-build VERSION=${RELEASE_VERSION} REPLACES_VERSION=${PREV_BUNDLE_INDEX_IMG_VERSION}
docker tag ${RELEASE_BUNDLE_INDEX_IMG}:${RELEASE_VERSION} ${RELEASE_BUNDLE_INDEX_IMG}:latest
make docker-push IMG=${RELEASE_BUNDLE_INDEX_IMG}:${RELEASE_VERSION}
make docker-push IMG=${RELEASE_BUNDLE_INDEX_IMG}:latest
Expand Down
12 changes: 11 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ SHELL := /bin/bash
OS_NAME = $(shell uname -s)
# Current Operator version
VERSION ?= v0.1.2-rc.0
# Replaces Operator version
REPLACES_VERSION ?= $(VERSION)
# Current Gatekeeper version
GATEKEEPER_VERSION ?= v3.3.0
# Default image repo
Expand All @@ -11,6 +13,8 @@ REPO ?= quay.io/gatekeeper
BUNDLE_IMG ?= $(REPO)/gatekeeper-operator-bundle:$(VERSION)
# Default bundle index image tag
BUNDLE_INDEX_IMG ?= $(REPO)/gatekeeper-operator-bundle-index:$(VERSION)
# Default previous bundle index image tag
PREV_BUNDLE_INDEX_IMG ?= $(REPO)/gatekeeper-operator-bundle-index:$(REPLACES_VERSION)
# Default namespace
NAMESPACE ?= gatekeeper-system
# Default Kubernetes distribution
Expand Down Expand Up @@ -305,10 +309,16 @@ bundle: operator-sdk manifests
bundle-build:
docker build -f bundle.Dockerfile -t $(BUNDLE_IMG) .

# Get previous index image version
.PHONY: prev-bundle-index-image-version
prev-bundle-index-image-version:
@REPLACES=$$(grep replaces ./config/manifests/bases/gatekeeper-operator.clusterserviceversion.yaml); \
echo $${REPLACES#*.}

# Build the bundle index image.
.PHONY: bundle-index-build
bundle-index-build: opm
$(OPM) index add --bundles $(BUNDLE_IMG) --tag $(BUNDLE_INDEX_IMG) -c docker
$(OPM) index add --bundles $(BUNDLE_IMG) --from-index $(PREV_BUNDLE_INDEX_IMG) --tag $(BUNDLE_INDEX_IMG) -c docker

# Generate and push bundle image and bundle index image
# Note: OPERATOR_VERSION is an arbitrary number and does not need to match any official versions
Expand Down

0 comments on commit eb4acc2

Please sign in to comment.