Skip to content

Commit

Permalink
add verify steps to capture data needing updates
Browse files Browse the repository at this point in the history
Can't figure out a way to get GNU Make to make sure that the update-vendored-crds target runs before the update-bindata target (every run of make seems to trigger the update-bindata steps very early no matter what).
This means you need to run 'make update' twice. Once to generate bindata, then copy the vendored CRDS (then the bindata generation is potentially out of date), then a second time so that the early bindata generation catches the previous run's changes.
This means someone will forget to do this (namely me).

Add some verify target to catch these missing steps.

Fix unreturned error.
  • Loading branch information
Joel Diaz committed Jul 29, 2020
1 parent 17bd3ee commit e57e6a3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -77,23 +77,30 @@ $(call add-crd-gen,cloudcredential-manifests,./pkg/apis/cloudcredential/v1,./man
$(call add-crd-gen,cloudcredential-bindata,./pkg/apis/cloudcredential/v1,./bindata/bootstrap,./bindata/bootstrap)

update: update-vendored-crds update-codegen update-bindata
.PHONY: update

update-vendored-crds:
# copy config CRD from openshift/api
cp vendor/github.com/openshift/api/operator/v1/0000_40_cloud-credential-operator_00_config.crd.yaml ./manifests/00-config-crd.yaml
# ...and into where we generate bindata from
cp vendor/github.com/openshift/api/operator/v1/0000_40_cloud-credential-operator_00_config.crd.yaml ./bindata/bootstrap/cloudcredential_v1_operator_config_crd.yaml
.PHONY: update-vendored-crds

update-codegen: update-codegen-crds
./hack/update-codegen.sh
.PHONY: update-codegen

verify: verify-codegen
verify: verify-vendored-crds verify-codegen verify-bindata

verify-codegen: verify-codegen-crds
./hack/verify-codegen.sh
.PHONY: verify-codegen

verify-vendored-crds:
diff vendor/github.com/openshift/api/operator/v1/0000_40_cloud-credential-operator_00_config.crd.yaml ./manifests/00-config-crd.yaml
diff vendor/github.com/openshift/api/operator/v1/0000_40_cloud-credential-operator_00_config.crd.yaml ./bindata/bootstrap/cloudcredential_v1_operator_config_crd.yaml
.PHONY: verify-vendored-crds

clean:
$(RM) ./cloud-credential-operator
.PHONY: clean
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/render/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ func render() error {

// need at least the empty dir so the installer bootkube.sh script works as expected
if err := os.Mkdir(filepath.Join(ccoRenderDir, bootstrapManifestsDir), 0775); err != nil {
errors.Wrap(err, "error creating bootstrap-manifests directory")
return errors.Wrap(err, "error creating bootstrap-manifests directory")
}
if effectiveMode != operatorv1.CloudCredentialsModeManual {
log.Info("Rendering static pod")
Expand Down

0 comments on commit e57e6a3

Please sign in to comment.