From 26c17012c1abab9c0ac2a02e12efbe26eb9b56f3 Mon Sep 17 00:00:00 2001 From: maskarb Date: Tue, 17 Oct 2023 11:34:40 -0400 Subject: [PATCH 1/2] Update downstream code generation and docs --- Makefile | 10 +++++++--- docs/generate-downstream.md | 24 +++++++++++++++++++++--- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 6c4e16055..c175666ff 100644 --- a/Makefile +++ b/Makefile @@ -3,8 +3,8 @@ # To re-generate a bundle for another specific version without changing the standard setup, you can: # - use the VERSION as arg of the bundle target (e.g make bundle VERSION=0.0.2) # - use environment variables to overwrite this value (e.g export VERSION=0.0.2) -PREVIOUS_VERSION ?= 2.0.0 -VERSION ?= 3.0.0 +PREVIOUS_VERSION ?= 3.0.0 +VERSION ?= 3.0.1 # Default bundle image tag IMAGE_TAG_BASE ?= quay.io/project-koku/koku-metrics-operator @@ -288,7 +288,7 @@ UPSTREAM_UPPERCASE = Koku DOWNSTREAM_LOWERCASE = costmanagement DOWNSTREAM_UPPERCASE = CostManagement .PHONY: downstream -downstream: +downstream: ## Generate the code changes necessary for the downstream image. go mod vendor rm -rf $(REMOVE_FILES) # sed replace everything but the Makefile @@ -304,6 +304,10 @@ downstream: $(MAKE) generate $(MAKE) manifests +.PHONY: downstream-vendor +downstream-vendor: ## Run `go mod vendor`. + go mod vendor + ##@ Build Dependencies ## Location to install dependencies to diff --git a/docs/generate-downstream.md b/docs/generate-downstream.md index 48c938230..8bbb667b6 100644 --- a/docs/generate-downstream.md +++ b/docs/generate-downstream.md @@ -6,9 +6,27 @@ git push downstream-vX.Y.Z ``` 2. Branch `downstream-vX.Y.Z` so we can make the updates for the downstream code: + +When generating the downstream code, we must vendor the packages. This directory is very large and makes reviewing the PR in Github difficult. To make the review process easier, we should separate the code changes and the package vendoring into separate commits: + +a. Checkout a branch that will be merged into the `downstream-vX.Y.Z` branch: +``` +$ git checkout -b make-downstream-vX.Y.X (be sure to substitute the correct version for x.y.z, e.g. 2.0.0) +``` + +b. Generate the code changes: +``` +$ make downstream ``` -git checkout -b make-downstream-vX.Y.X (be sure to substitute the correct version for x.y.z, e.g. 2.0.0) -make downstream -git add/commit/push + +c. Vendor the packages: +``` +$ make downstream-vendor +``` + +d. Add/commit/push: +``` +$ git add/commit/push ``` + 3. Open PR against `downstream-vX.Y.Z` to merge the downstream code changes. From 25a33525219821a2bb5e9036b0c3404c56bdc9e5 Mon Sep 17 00:00:00 2001 From: maskarb Date: Tue, 17 Oct 2023 11:35:26 -0400 Subject: [PATCH 2/2] remove the `go mod vendor` from the `downstream` command --- Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/Makefile b/Makefile index c175666ff..2a7163efc 100644 --- a/Makefile +++ b/Makefile @@ -289,7 +289,6 @@ DOWNSTREAM_LOWERCASE = costmanagement DOWNSTREAM_UPPERCASE = CostManagement .PHONY: downstream downstream: ## Generate the code changes necessary for the downstream image. - go mod vendor rm -rf $(REMOVE_FILES) # sed replace everything but the Makefile - LC_ALL=C find api/v1beta1 config/* docs/* -type f -exec sed -i -- 's/$(UPSTREAM_UPPERCASE)/$(DOWNSTREAM_UPPERCASE)/g' {} +