Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update downstream code generation and docs #216

Merged
merged 2 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -288,8 +288,7 @@ UPSTREAM_UPPERCASE = Koku
DOWNSTREAM_LOWERCASE = costmanagement
DOWNSTREAM_UPPERCASE = CostManagement
.PHONY: downstream
downstream:
go mod vendor
downstream: ## Generate the code changes necessary for the downstream image.
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' {} +
Expand All @@ -304,6 +303,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
Expand Down
24 changes: 21 additions & 3 deletions docs/generate-downstream.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.