Skip to content

Commit

Permalink
[opm] Unifying opm tool and catalog dockerfile version and arch
Browse files Browse the repository at this point in the history
Signed-off-by: dd di cesare <[email protected]>
  • Loading branch information
didierofrivia committed Nov 7, 2024
1 parent 00be7ee commit 4506ed2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 16 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/build-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -204,15 +204,17 @@ jobs:
VERSION=${{ env.VERSION }} \
IMAGE_TAG=${{ github.sha }} \
AUTHORINO_VERSION=${{ env.LATEST_AUTHORINO_GITREF }} \
CHANNELS=${{ inputs.channels }}
CHANNELS=${{ inputs.channels }} \
OPM_DOCKERFILE_TAG=latest
- name: Run make catalog (release)
if: ${{ github.ref_name != env.MAIN_BRANCH_NAME }}
run: |
make catalog \
REGISTRY=${{ env.IMG_REGISTRY_HOST }} ORG=${{ env.IMG_REGISTRY_ORG }} \
VERSION=${{ env.VERSION }} \
AUTHORINO_VERSION=${{ github.event.inputs.authorinoVersion }} \
CHANNELS=${{ inputs.channels }}
CHANNELS=${{ inputs.channels }} \
OPM_DOCKERFILE_TAG=latest
- name: Git diff
run: git diff
- name: Build Image
Expand Down Expand Up @@ -288,7 +290,7 @@ jobs:
IMAGE_TAG=${{ github.sha }} \
AUTHORINO_VERSION=${{ env.LATEST_AUTHORINO_GITREF }} \
CHANNELS=${{ inputs.channels }} \
CATALOG_ARCH=${{ matrix.arch }}
ARCH=${{ matrix.arch }}
- name: Run make catalog (release)
if: ${{ github.ref_name != env.MAIN_BRANCH_NAME }}
run: |
Expand All @@ -297,7 +299,7 @@ jobs:
VERSION=${{ env.VERSION }} \
AUTHORINO_VERSION=${{ github.event.inputs.authorinoVersion }} \
CHANNELS=${{ inputs.channels }} \
CATALOG_ARCH=${{ matrix.arch }}
ARCH=${{ matrix.arch }}
- name: Git diff
run: git diff
- name: Build Image
Expand Down
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,15 @@ $(YQ):
.PHONY: yq
yq: $(YQ) ## Download yq locally if necessary.

ARCH ?= $(shell go env GOARCH)
OPM = $(PROJECT_DIR)/bin/opm
OPM_VERSION = v1.26.2
OPM_VERSION ?= 1.48.0
$(OPM):
@{ \
set -e ;\
mkdir -p $(dir $(OPM)) ;\
OS=$(shell go env GOOS) && ARCH=$(shell go env GOARCH) && \
curl -sSLo $(OPM) https://github.com/operator-framework/operator-registry/releases/download/$(OPM_VERSION)/$${OS}-$${ARCH}-opm ;\
OS=$(shell go env GOOS) && \
curl -sSLo $(OPM) https://github.com/operator-framework/operator-registry/releases/download/v$(OPM_VERSION)/$${OS}-$(ARCH)-opm ;\
chmod +x $(OPM) ;\
}

Expand Down
11 changes: 2 additions & 9 deletions make/catalog.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,13 @@
# The image tag given to the resulting catalog image (e.g. make catalog-build CATALOG_IMG=example.com/operator-catalog:v0.2.0).
CATALOG_IMG ?= $(IMAGE_TAG_BASE)-catalog:$(IMAGE_TAG)

OPM_DOCKERFILE_VERSION ?= 1.28.0

ifeq ($(origin CATALOG_ARCH),undefined)
OPM_DOCKERFILE_TAG = latest
else
OPM_DOCKERFILE_TAG = v$(OPM_DOCKERFILE_VERSION)-$(CATALOG_ARCH)
endif

CATALOG_FILE = $(PROJECT_DIR)/catalog/authorino-operator-catalog/operator.yaml
CATALOG_DOCKERFILE = $(PROJECT_DIR)/catalog/authorino-operator-catalog.Dockerfile

OPM_DOCKERFILE_TAG ?= v$(OPM_VERSION)-$(ARCH)
$(CATALOG_DOCKERFILE): $(OPM)
-mkdir -p $(PROJECT_DIR)/catalog/authorino-operator-catalog
cd $(PROJECT_DIR)/catalog && $(OPM) generate dockerfile authorino-operator-catalog -i "quay.io/operator-framework/opm:${OPM_DOCKERFILE_TAG}"
cd $(PROJECT_DIR)/catalog && $(OPM) generate dockerfile authorino-operator-catalog -b "quay.io/operator-framework/opm:${OPM_DOCKERFILE_TAG}" -i "quay.io/operator-framework/opm:${OPM_DOCKERFILE_TAG}"
catalog-dockerfile: $(CATALOG_DOCKERFILE) ## Generate catalog dockerfile.

$(CATALOG_FILE): $(OPM) $(YQ)
Expand Down

0 comments on commit 4506ed2

Please sign in to comment.