Skip to content

Commit 512167e

Browse files
Mikołaj Świątekswiatekm
Mikołaj Świątek
authored andcommitted
Add update-bundle make target
1 parent f787b65 commit 512167e

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

CONTRIBUTING.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,13 @@ The repository structure MUST be compliant with `operator-sdk` scaffolding, whic
3232

3333
Refer to the [Operator SDK documentation](https://sdk.operatorframework.io/docs/building-operators/golang/) how to generate new APIs, Webhook and other parts of the project.
3434

35+
If you make any change to the api definitions, please run `make update-bundle` to update the bundle manifest accordingly.
36+
3537
### Local run
3638

3739
Build the manifests, install the CRD and run the operator as a local process:
3840
```bash
39-
make bundle install run
41+
make install run
4042
```
4143

4244
### Deployment with webhooks
@@ -66,7 +68,7 @@ When deploying the operator into the cluster using `make deploy`, an image in th
6668
* `IMG`, to override the entire image specification
6769

6870
```bash
69-
IMG=docker.io/${USER}/opentelemetry-operator:dev-$(git rev-parse --short HEAD)-$(date +%s) make generate bundle container container-push deploy
71+
IMG=docker.io/${USER}/opentelemetry-operator:dev-$(git rev-parse --short HEAD)-$(date +%s) make generate container container-push deploy
7072
```
7173

7274
Your operator will be available in the `opentelemetry-operator-system` namespace.

Makefile

+10-5
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,10 @@ SED ?= $(shell which gsed 2>/dev/null || which sed)
8888
.PHONY: ensure-generate-is-noop
8989
ensure-generate-is-noop: VERSION=$(OPERATOR_VERSION)
9090
ensure-generate-is-noop: USER=open-telemetry
91-
ensure-generate-is-noop: bundle
92-
@# on make bundle config/manager/kustomization.yaml includes changes, which should be ignored for the below check
93-
@git restore config/manager/kustomization.yaml
91+
ensure-generate-is-noop: update-bundle
9492
@git diff -s --exit-code apis/v1alpha1/zz_generated.*.go || (echo "Build failed: a model has been changed but the generated resources aren't up to date. Run 'make generate' and update your PR." && exit 1)
95-
@git diff -s --exit-code bundle config || (echo "Build failed: the bundle, config files has been changed but the generated bundle, config files aren't up to date. Run 'make bundle' and update your PR." && git diff && exit 1)
96-
@git diff -s --exit-code bundle.Dockerfile || (echo "Build failed: the bundle.Dockerfile file has been changed. The file should be the same as generated one. Run 'make bundle' and update your PR." && git diff && exit 1)
93+
@git diff -s --exit-code bundle config || (echo "Build failed: the bundle, config files has been changed but the generated bundle, config files aren't up to date. Run 'make update-bundle' and update your PR." && git diff && exit 1)
94+
@git diff -s --exit-code bundle.Dockerfile || (echo "Build failed: the bundle.Dockerfile file has been changed. The file should be the same as generated one. Run 'make update-bundle' and update your PR." && git diff && exit 1)
9795
@git diff -s --exit-code docs/api.md || (echo "Build failed: the api.md file has been changed but the generated api.md file isn't up to date. Run 'make api-docs' and update your PR." && git diff && exit 1)
9896

9997
.PHONY: all
@@ -451,6 +449,13 @@ bundle: kustomize operator-sdk manifests set-image-controller
451449
$(OPERATOR_SDK) generate kustomize manifests -q
452450
$(KUSTOMIZE) build $(KUSTOMIZATION_DIR) | $(OPERATOR_SDK) generate bundle -q --overwrite --version $(VERSION) $(BUNDLE_METADATA_OPTS)
453451
$(OPERATOR_SDK) bundle validate ./bundle
452+
453+
# Update the bundle with semantic changes. This will intentionally ignore some changes to metadata, like creation time.
454+
.PHONY: update-bundle
455+
update-bundle: KUSTOMIZATION_BASE = config/manifests
456+
update-bundle: VERSION = $(shell cat versions.txt | grep "operator=" | cut -d "=" -f 2) # the most recent release
457+
update-bundle: USER = open-telemetry
458+
update-bundle: bundle
454459
./hack/ignore-createdAt-bundle.sh
455460

456461
# Build the bundle image, used only for local dev purposes

0 commit comments

Comments
 (0)