Skip to content

Commit 7952081

Browse files
KPostOfficeanishasthana
authored andcommitted
Add make directive for opening PR on OpenShift community operators
Signed-off-by: Kevin <[email protected]>
1 parent 094529c commit 7952081

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

Diff for: Makefile

+22
Original file line numberDiff line numberDiff line change
@@ -187,18 +187,31 @@ KUSTOMIZE ?= $(LOCALBIN)/kustomize
187187
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
188188
ENVTEST ?= $(LOCALBIN)/setup-envtest
189189
OPERATOR_SDK ?= $(LOCALBIN)/operator-sdk
190+
GH_CLI ?= $(LOCALBIN)/gh
190191

191192
## Tool Versions
192193
KUSTOMIZE_VERSION ?= v4.5.4
193194
CONTROLLER_TOOLS_VERSION ?= v0.9.2
194195
OPERATOR_SDK_VERSION ?= v1.27.0
196+
GH_CLI_VERSION ?= 2.30.0
195197

196198
KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
197199
.PHONY: kustomize
198200
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
199201
$(KUSTOMIZE): $(LOCALBIN)
200202
test -s $(LOCALBIN)/kustomize || { curl -s $(KUSTOMIZE_INSTALL_SCRIPT) | bash -s -- $(subst v,,$(KUSTOMIZE_VERSION)) $(LOCALBIN); }
201203

204+
GH_CLI_DL_URL := https://github.com/cli/cli/releases/download/v$(GH_CLI_VERSION)
205+
GH_CLI_DL_FILENAME := gh_$(GH_CLI_VERSION)_$(shell go env GOOS)_$(shell go env GOARCH)
206+
.PHONY: install-gh-cli
207+
install-gh-cli: $(GH_CLI)
208+
$(GH_CLI): $(LOCALBIN)
209+
curl -L $(GH_CLI_DL_URL)/$(GH_CLI_DL_FILENAME).tar.gz --output $(GH_CLI_DL_FILENAME).tar.gz
210+
tar -xvzf $(GH_CLI_DL_FILENAME).tar.gz
211+
cp $(GH_CLI_DL_FILENAME)/bin/gh $(GH_CLI)
212+
rm -rf $(GH_CLI_DL_FILENAME)
213+
rm $(GH_CLI_DL_FILENAME).tar.gz
214+
202215
.PHONY: controller-gen
203216
controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary.
204217
$(CONTROLLER_GEN): $(LOCALBIN)
@@ -237,6 +250,15 @@ bundle-build: bundle ## Build the bundle image.
237250
bundle-push: ## Push the bundle image.
238251
$(MAKE) image-push IMG=$(BUNDLE_IMG)
239252

253+
.PHONY: openshift-community-operator-releases
254+
openshift-community-operator-release: install-gh-cli bundle ## build bundle and create PR in OpenShift community operators repository
255+
gh repo clone [email protected]:project-codeflare/community-operators-prod.git
256+
cd community-operators-prod && git pull upstream main && git push origin main
257+
cp -r bundle community-operators-prod/operators/codeflare-operator/$(VERSION)
258+
cd community-operators-prod && git checkout -b codeflare-release-$(VERSION) && git add operators/codeflare-operator/$(VERSION)/* && git commit -m "add bundle manifests codeflare version $(VERSION)" && git push origin codeflare-release-$(VERSION)
259+
gh pr create --repo redhat-openshift-ecosystem/community-operators-prod --title "CodeFlare $(VERSION)" --body "New release of codeflare operator" --head project-codeflare:codeflare-release-$(VERSION) --base main
260+
rm -rf community-operators-prod
261+
240262
.PHONY: opm
241263
OPM = ./bin/opm
242264
opm: ## Download opm locally if necessary.

0 commit comments

Comments
 (0)