Skip to content

Commit

Permalink
Merge pull request #191 from clobrano/automate-rh-community-bundle-0
Browse files Browse the repository at this point in the history
Automate RH Community bundle creation
  • Loading branch information
openshift-merge-bot[bot] authored Feb 26, 2024
2 parents 27560cb + 584445c commit a85cb96
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 4 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Release bundles
on:
workflow_dispatch:
inputs:
version:
description: "The version to release, without the leading `v`"
required: true
type: string
previous_version:
description: "The previous version, used for the CVS's `replaces` field, without the leading `v`"
required: true
type: string

jobs:
make_rh_community_bundle:
uses: medik8s/.github/.github/workflows/release_rh_community_bundle.yml@main
secrets: inherit
with:
version: ${{ inputs.version }}
previous_version: ${{ inputs.previous_version }}
25 changes: 21 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ KUSTOMIZE_VERSION = v5.2.1
# versions at https://github.com/slintes/sort-imports/tags
SORT_IMPORTS_VERSION = v0.2.1

# version at https://github.com/a8m/envsubst/releases
ENVSUBST_VERSION = v1.4.2

# OCP Version: for Red Hat bundle community
OCP_VERSION = 4.12

OPERATOR_NAME ?= self-node-remediation

# VERSION defines the project version for the bundle.
Expand Down Expand Up @@ -224,9 +230,9 @@ uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified
$(KUSTOMIZE) build config/crd | $(KUBECTL) delete -f -

.PHONY: deploy
deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
deploy: manifests kustomize envsubst ## Deploy controller to the K8s cluster specified in ~/.kube/config.
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
$(KUSTOMIZE) build config/default | envsubst | $(KUBECTL) apply -f -
$(KUSTOMIZE) build config/default | $(ENVSUBST) | $(KUBECTL) apply -f -

.PHONY: undeploy
undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config.
Expand All @@ -246,6 +252,12 @@ ifeq (,$(wildcard $(CONTROLLER_GEN)))
}
endif

ENVSUBST_BIN_FOLDER = $(shell pwd)/bin/envsubst
ENVSUBST = $(ENVSUBST_BIN_FOLDER)/$(ENVSUBST_VERSION)/envsubst
.PHONY: envsubst
envsubst: ## Download envsubst locally if necessary.
$(call go-install-tool,$(ENVSUBST),github.com/a8m/envsubst/cmd/envsubst@${ENVSUBST_VERSION}) ;\

KUSTOMIZE_BIN_FOLDER = $(shell pwd)/bin/kustomize
KUSTOMIZE = $(KUSTOMIZE_BIN_FOLDER)/$(KUSTOMIZE_VERSION)/kustomize
.PHONY: kustomize
Expand Down Expand Up @@ -282,10 +294,10 @@ DEFAULT_ICON_BASE64 := $(shell base64 --wrap=0 ./config/assets/snr_icon_blue.png
export ICON_BASE64 ?= ${DEFAULT_ICON_BASE64}
export BUNDLE_CSV ?= "./bundle/manifests/$(OPERATOR_NAME).clusterserviceversion.yaml"
.PHONY: bundle
bundle: manifests operator-sdk kustomize ## Generate bundle manifests and metadata, then validate generated files.
bundle: manifests operator-sdk kustomize envsubst ## Generate bundle manifests and metadata, then validate generated files.
$(OPERATOR_SDK) generate kustomize manifests -q
cd config/manager && $(KUSTOMIZE) edit set image controller=$(IMG)
$(KUSTOMIZE) build config/manifests | envsubst | $(OPERATOR_SDK) generate bundle -q --overwrite --version $(VERSION) $(BUNDLE_METADATA_OPTS)
$(KUSTOMIZE) build config/manifests | $(ENVSUBST) | $(OPERATOR_SDK) generate bundle -q --overwrite --version $(VERSION) $(BUNDLE_METADATA_OPTS)
$(MAKE) bundle-validate

.PHONY: bundle-community-k8s
Expand All @@ -294,6 +306,11 @@ bundle-community-k8s: bundle-community ## Generate bundle manifests and metadata
sed -r -i "s|by default\.|by default.\n Note that prior to installing SNR on a Kubernetes 1.25+ cluster, a user must manually set a [privileged PSA label](https://kubernetes.io/docs/tasks/configure-pod-container/enforce-standards-namespace-labels/) on SNR's namespace. It gives SNR's agents permissions to reboot the node (in case it needs to be remediated).|;" ${BUNDLE_CSV}
$(MAKE) bundle-update

.PHONY: bundle-community-rh
bundle-community-rh: bundle-community ## Generate bundle manifests and metadata customized to Red Hat community release
echo -e "\n # Annotations for OCP\n com.redhat.openshift.versions: \"v${OCP_VERSION}\"" >> bundle/metadata/annotations.yaml
$(MAKE) bundle-update

.PHONY: bundle-community
bundle-community: bundle ##Add Community Edition suffix to operator name
sed -r -i "s|displayName: Self Node Remediation Operator.*|displayName: Self Node Remediation Operator - Community Edition|;" ${BUNDLE_CSV}
Expand Down

0 comments on commit a85cb96

Please sign in to comment.