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

document downstream code generation #204

Merged
merged 5 commits into from
Sep 8, 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
23 changes: 23 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -321,3 +321,26 @@ catalog-build: opm
.PHONY: catalog-push
catalog-push: ## Push the catalog image.
$(MAKE) docker-push IMG=$(CATALOG_IMG)


#### Updates code for downstream release
REMOVE_FILES = koku-metrics-operator/
UPSTREAM_LOWERCASE = koku
UPSTREAM_UPPERCASE = Koku
DOWNSTREAM_LOWERCASE = costmanagement
DOWNSTREAM_UPPERCASE = CostManagement
downstream:
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' {} +
- LC_ALL=C find api/v1beta1 config/* docs/* -type f -exec sed -i -- 's/$(UPSTREAM_LOWERCASE)/$(DOWNSTREAM_LOWERCASE)/g' {} +
# fix the cert
- sed -i -- 's/ca-certificates.crt/ca-bundle.crt/g' crhchttp/http_cloud_dot_redhat.go
- sed -i -- 's/isCertified bool = false/isCertified bool = true/g' packaging/packaging.go
# clean up the other files
- git clean -fx
# mv the sample to the correctly named file
cp config/samples/koku-metrics-cfg_v1beta1_kokumetricsconfig.yaml config/samples/costmanagement-metrics-cfg_v1beta1_costmanagementmetricsconfig.yaml
$(MAKE) generate
$(MAKE) manifests
2 changes: 1 addition & 1 deletion controllers/kokumetricsconfig_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ var _ = Describe("MetricsConfigController - CRD Handling", Ordered, func() {
mockpconn *mocks.MockPrometheusConnection

testConfigMap *corev1.ConfigMap
instCopy *metricscfgv1beta1.KokuMetricsConfig
instCopy *metricscfgv1beta1.MetricsConfig
testPVC *corev1.PersistentVolumeClaim
checkPVC bool = true
)
Expand Down
14 changes: 14 additions & 0 deletions docs/generate-downstream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
1. Create the `downstream-vX.Y.Z` branch based off main:
```
git fetch origin
git switch --no-track -c downstream-vX.Y.Z origin/main
git push downstream-vX.Y.Z
```

2. Branch `downstream-vX.Y.Z` so we can make the updates for the downstream code:
```
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
```
3. Open PR against `downstream-vX.Y.Z` to merge the downstream code changes.