Skip to content

Commit 7e6e403

Browse files
committed
Add make directive for opening PR on OpenShift community operators
Signed-off-by: Kevin <[email protected]>
1 parent d03836b commit 7e6e403

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

Diff for: Makefile

+23
Original file line numberDiff line numberDiff line change
@@ -155,18 +155,31 @@ KUSTOMIZE ?= $(LOCALBIN)/kustomize
155155
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
156156
ENVTEST ?= $(LOCALBIN)/setup-envtest
157157
OPERATOR_SDK ?= $(LOCALBIN)/operator-sdk
158+
GH_CLI ?= $(LOCALBIN)/gh
158159

159160
## Tool Versions
160161
KUSTOMIZE_VERSION ?= v3.8.7
161162
CONTROLLER_TOOLS_VERSION ?= v0.9.2
162163
OPERATOR_SDK_VERSION ?= v1.27.0
164+
GH_CLI_VERSION ?= 2.30.0
163165

164166
KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
165167
.PHONY: kustomize
166168
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
167169
$(KUSTOMIZE): $(LOCALBIN)
168170
test -s $(LOCALBIN)/kustomize || { curl -s $(KUSTOMIZE_INSTALL_SCRIPT) | bash -s -- $(subst v,,$(KUSTOMIZE_VERSION)) $(LOCALBIN); }
169171

172+
GH_CLI_DL_URL := https://github.com/cli/cli/releases/download/v$(GH_CLI_VERSION)
173+
GH_CLI_DL_FILENAME := gh_$(GH_CLI_VERSION)_$(shell go env GOOS)_$(shell go env GOARCH)
174+
.PHONY: install-gh-cli
175+
install-gh-cli: $(GH_CLI)
176+
$(GH_CLI): $(LOCALBIN)
177+
curl -L $(GH_CLI_DL_URL)/$(GH_CLI_DL_FILENAME).tar.gz --output $(GH_CLI_DL_FILENAME).tar.gz
178+
tar -xvzf $(GH_CLI_DL_FILENAME).tar.gz
179+
cp $(GH_CLI_DL_FILENAME)/bin/gh $(GH_CLI)
180+
rm -rf $(GH_CLI_DL_FILENAME)
181+
rm -rf $(GH_CLI_DL_FILENAME).tar.gz
182+
170183
.PHONY: controller-gen
171184
controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary.
172185
$(CONTROLLER_GEN): $(LOCALBIN)
@@ -204,6 +217,16 @@ bundle-build: ## Build the bundle image.
204217
bundle-push: ## Push the bundle image.
205218
$(MAKE) image-push IMG=$(BUNDLE_IMG)
206219

220+
.PHONY: openshift-community-operator-releases
221+
openshift-community-operator-release: install-gh-cli bundle ## build bundle and create PR in openshift communityh
222+
gh repo clone [email protected]:project-codeflare/community-operators-prod.git
223+
cd community-operators-prod && git pull upstream main && git push origin main
224+
cp -r bundle community-operators-prod/operators/codeflare-operator/$(VERSION)
225+
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)
226+
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
227+
rm -rf community-operators-prod
228+
229+
207230
.PHONY: opm
208231
OPM = ./bin/opm
209232
opm: ## Download opm locally if necessary.

0 commit comments

Comments
 (0)