Skip to content

Commit

Permalink
Add update-bundle make target
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikołaj Świątek committed Jun 28, 2023
1 parent 2fa423c commit a8a7599
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Refer to the [Operator SDK documentation](https://sdk.operatorframework.io/docs/

Build the manifests, install the CRD and run the operator as a local process:
```bash
make bundle install run
make install run
```

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

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

Your operator will be available in the `opentelemetry-operator-system` namespace.
Expand Down
15 changes: 10 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,10 @@ SED ?= $(shell which gsed 2>/dev/null || which sed)
.PHONY: ensure-generate-is-noop
ensure-generate-is-noop: VERSION=$(OPERATOR_VERSION)
ensure-generate-is-noop: USER=open-telemetry
ensure-generate-is-noop: bundle
@# on make bundle config/manager/kustomization.yaml includes changes, which should be ignored for the below check
@git restore config/manager/kustomization.yaml
ensure-generate-is-noop: update-bundle
@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)
@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)
@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)
@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)
@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)
@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)

.PHONY: all
Expand Down Expand Up @@ -392,6 +390,13 @@ bundle: kustomize operator-sdk manifests set-image-controller
$(OPERATOR_SDK) generate kustomize manifests -q
$(KUSTOMIZE) build $(KUSTOMIZATION_DIR) | $(OPERATOR_SDK) generate bundle -q --overwrite --version $(VERSION) $(BUNDLE_METADATA_OPTS)
$(OPERATOR_SDK) bundle validate ./bundle

# Update the bundle with semantic changes. This will intentionally ignore some changes to metadata, like creation time.
.PHONY: update-bundle
update-bundle: KUSTOMIZATION_BASE = config/manifests
update-bundle: VERSION = $(shell cat versions.txt | grep "operator=" | cut -d "=" -f 2) # the most recent release
update-bundle: USER = open-telemetry
update-bundle: bundle
./hack/ignore-createdAt-bundle.sh

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

0 comments on commit a8a7599

Please sign in to comment.