Skip to content

Commit

Permalink
Automatically adjust default release channel
Browse files Browse the repository at this point in the history
This will make sure that the channel field is pre-populated with a good
default when we run the release workflow.

Signed-off-by: Daniel Grimm <dgrimm@redhat.com>
  • Loading branch information
dgn committed Sep 23, 2024
1 parent c5e8021 commit 0fc7047
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
bundle_channels:
description: "Bundle channels"
required: true
default: "candidates"
default: 0.2-dev
is_draft_release:
description: "Draft release"
type: boolean
Expand Down
16 changes: 13 additions & 3 deletions Makefile.core.mk
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,12 @@ GINKGO_FLAGS := $(if $(VERBOSE),-v) $(if $(CI),--no-color)
# To re-generate a bundle for other specific channels without changing the standard setup, you can:
# - use the CHANNELS as arg of the bundle target (e.g make bundle CHANNELS=candidate,fast,stable)
# - use environment variables to overwrite this value (e.g export CHANNELS="candidate,fast,stable")
CHANNELS ?= ${MINOR_VERSION}
CHANNEL_SUFFIX := dev
ifneq (,$(findstring release-,$(shell git rev-parse --abbrev-ref HEAD)))
CHANNEL_SUFFIX = stable
endif

CHANNELS ?= $(MINOR_VERSION)-$(CHANNEL_SUFFIX)
ifneq ($(origin CHANNELS), undefined)
BUNDLE_CHANNELS = --channels=\"$(CHANNELS)\"
endif
Expand All @@ -89,6 +94,8 @@ endif
# To re-generate a bundle for any other default channel without changing the default setup, you can:
# - use the DEFAULT_CHANNEL as arg of the bundle target (e.g make bundle DEFAULT_CHANNEL=stable)
# - use environment variables to overwrite this value (e.g export DEFAULT_CHANNEL="stable")
comma := ,
DEFAULT_CHANNEL ?= $(firstword $(subst $(comma), ,$(CHANNELS)))
ifneq ($(origin DEFAULT_CHANNEL), undefined)
BUNDLE_DEFAULT_CHANNEL := --default-channel=$(DEFAULT_CHANNEL)
endif
Expand Down Expand Up @@ -381,7 +388,7 @@ gen-charts: ## Pull charts from istio repository.
gen: gen-all-except-bundle bundle ## Generate everything.

.PHONY: gen-all-except-bundle
gen-all-except-bundle: operator-name operator-chart controller-gen gen-api gen-charts gen-manifests gen-code gen-api-docs
gen-all-except-bundle: operator-name operator-chart controller-gen gen-api gen-charts gen-manifests gen-code gen-api-docs github-workflow

.PHONY: gen-check
gen-check: gen restore-manifest-dates check-clean-repo ## Verify that changes in generated resources have been checked in.
Expand Down Expand Up @@ -425,6 +432,9 @@ operator-chart:
sed -i -e "s|^\(image: \).*$$|\1${IMAGE}|g" \
-e "s/^\( version: \).*$$/\1${VERSION}/g" chart/values.yaml

github-workflow:
sed -i -e '1,/default:/ s/^\(.*default:\).*$$/\1 ${DEFAULT_CHANNEL}/' .github/workflows/release.yaml

.PHONY: update-istio
update-istio: ## Update the Istio commit hash in the 'latest' entry in versions.yaml to the latest commit in the branch.
@hack/update-istio.sh
Expand Down Expand Up @@ -624,7 +634,7 @@ git-hook: gitleaks ## Installs gitleaks as a git pre-commit hook.
chmod +x .git/hooks/pre-commit; \
fi

.SILENT: helm $(HELM) $(LOCALBIN) deploy-yaml gen-api operator-name operator-chart
.SILENT: helm $(HELM) $(LOCALBIN) deploy-yaml gen-api operator-name operator-chart github-workflow

COMMON_IMPORTS ?= lint-all lint-scripts lint-copyright-banner lint-go lint-yaml lint-helm format-go tidy-go check-clean-repo update-common
.PHONY: $(COMMON_IMPORTS)
Expand Down
3 changes: 2 additions & 1 deletion bundle.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ LABEL operators.operatorframework.io.bundle.mediatype.v1=registry+v1
LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/
LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
LABEL operators.operatorframework.io.bundle.package.v1=sailoperator
LABEL operators.operatorframework.io.bundle.channels.v1="0.2"
LABEL operators.operatorframework.io.bundle.channels.v1="0.2-dev"
LABEL operators.operatorframework.io.bundle.channel.default.v1=0.2-dev
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.36.1
LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1
LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v4
Expand Down
3 changes: 2 additions & 1 deletion bundle/metadata/annotations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ annotations:
operators.operatorframework.io.bundle.manifests.v1: manifests/
operators.operatorframework.io.bundle.metadata.v1: metadata/
operators.operatorframework.io.bundle.package.v1: sailoperator
operators.operatorframework.io.bundle.channels.v1: "0.2"
operators.operatorframework.io.bundle.channels.v1: "0.2-dev"
operators.operatorframework.io.bundle.channel.default.v1: 0.2-dev
operators.operatorframework.io.metrics.builder: operator-sdk-v1.36.1
operators.operatorframework.io.metrics.mediatype.v1: metrics+v1
operators.operatorframework.io.metrics.project_layout: go.kubebuilder.io/v4
Expand Down

0 comments on commit 0fc7047

Please sign in to comment.