Skip to content

SREP-3558: Fix setup-envtest installation and usage#681

Merged
openshift-merge-bot[bot] merged 3 commits intoopenshift:masterfrom
eth1030:setup-envtest-bug
Feb 25, 2026
Merged

SREP-3558: Fix setup-envtest installation and usage#681
openshift-merge-bot[bot] merged 3 commits intoopenshift:masterfrom
eth1030:setup-envtest-bug

Conversation

@eth1030
Copy link
Contributor

@eth1030 eth1030 commented Feb 24, 2026

This PR addresses the CI failures encountered when bumping boilerplate to b1b2a7f89ab7147bf8782b1fd1554126c567f2d4. The base image was updated which broke envtest.

  • Update ENVTEST_K8S_VERSION to 1.28.0 and ENVTEST_VERSION to release-0.23
  • Install setup-envtest to GOPATH/bin if not present
  • Improve kubebuilder test assets setup with proper error handling
  • Specify architecture and OS for cross-platform compatibility

🤖 Generated with Claude Code

Testing

build local boilerplate image

[3/3] COMMIT boilerplate:latest
--> 3a247921778c
Successfully tagged localhost/boilerplate:latest
3a247921778cbd064feaabc400e60bacc798cb87af5ff4d791310d50c5460a40

build gcp-project-operator using local boilerplate image

podman build -f build/Dockerfile    -t gcp-project-operator:test .

[1/2] STEP 1/5: FROM localhost/boilerplate:latest AS builder
[1/2] STEP 2/5: ENV OPERATOR_PATH=/gcp-project-operator
--> Using cache 1c6379e7967664891f19398cd06bb32e0cd7f6b20c021899082a62a3f487e511
--> 1c6379e79676
[1/2] STEP 3/5: COPY . ${OPERATOR_PATH}
--> Using cache aac2cbb4a39aeee9bef2ab7f010d7de544af192d4723e4c2cd50374af22c54bc
--> aac2cbb4a39a
[1/2] STEP 4/5: WORKDIR ${OPERATOR_PATH}
--> Using cache 4755c65fd6fbd12b1d1a112cfa91bdfc314635b387601d21f543e36587433874
--> 4755c65fd6fb
[1/2] STEP 5/5: RUN make go-build
--> Using cache bca755acb023ec88b26724e7705865432abd65c2bff876e89875ad47e8635d59
--> bca755acb023
[2/2] STEP 1/6: FROM registry.access.redhat.com/ubi9/ubi-minimal:9.7-1771346502
[2/2] STEP 2/6: ENV OPERATOR_PATH=/gcp-project-operator     OPERATOR_BIN=gcp-project-operator
--> Using cache 6e2691deb5739d434806330a959d87e6525de81316f0079da0b6404c8b9304db
--> 6e2691deb573
[2/2] STEP 3/6: WORKDIR /root/
--> Using cache 0423a5e9ace396c5fe78aa1048f6f76ad25175ce7b14b26e51c8db8baed59c0f
--> 0423a5e9ace3
[2/2] STEP 4/6: COPY --from=builder /gcp-project-operator/build/_output/bin/${OPERATOR_BIN} /usr/local/bin/${OPERATOR_BIN}
--> Using cache 923700ab0b52e2ae3f70851c502e04b8c02c32d85d0e8cca74801e9625d9e528
--> 923700ab0b52
[2/2] STEP 5/6: LABEL io.openshift.managed.name="gcp-project-operator"     io.openshift.managed.description="This operator will be responsible for managing GCP project and credentials."
--> Using cache 42b8e46e2f8c751f9b4ae8e9524c76f2ec40fb459fd28a2cca15852c425e5862
--> 42b8e46e2f8c
[2/2] STEP 6/6: ENTRYPOINT ["/usr/local/bin/gcp-project-operator"]
--> Using cache a8333addcf0d532e49508300a79d9459afa7dd8a71fab638a5fd510a5a85d59f
[2/2] COMMIT gcp-project-operator:test
--> a8333addcf0d
Successfully tagged localhost/gcp-project-operator:test
a8333addcf0d532e49508300a79d9459afa7dd8a71fab638a5fd510a5a85d59f

run tests

ALLOW_DIRTY_CHECKOUT=true make go-test

boilerplate/openshift/golang-osd-operator/standard.mk:107: Setting GOEXPERIMENT=boringcrypto - this generally causes builds to fail unless building inside the provided Dockerfile. If building locally consider calling 'go build .'
# If for any reason we've made it this far and TESTTARGETS is still empty, fail early.
GOOS=darwin GOARCH=arm64 CGO_ENABLED=1 GOFLAGS="-tags=fips_enabled" GOEXPERIMENT=boringcrypto KUBEBUILDER_ASSETS="/tmp/envtest/bin/k8s/1.23.5-darwin-arm64" go test  github.com/openshift/gcp-project-operator github.com/openshift/gcp-project-operator/api/v1alpha1 github.com/openshift/gcp-project-operator/config github.com/openshift/gcp-project-operator/controllers/projectclaim github.com/openshift/gcp-project-operator/controllers/projectreference github.com/openshift/gcp-project-operator/pkg/condition github.com/openshift/gcp-project-operator/pkg/configmap github.com/openshift/gcp-project-operator/pkg/gcpclient github.com/openshift/gcp-project-operator/pkg/util github.com/openshift/gcp-project-operator/pkg/util/errors github.com/openshift/gcp-project-operator/pkg/util/mocks github.com/openshift/gcp-project-operator/pkg/util/mocks/condition github.com/openshift/gcp-project-operator/pkg/util/mocks/gcpclient github.com/openshift/gcp-project-operator/pkg/util/mocks/projectclaim github.com/openshift/gcp-project-operator/pkg/util/mocks/structs
?       github.com/openshift/gcp-project-operator       [no test files]
?       github.com/openshift/gcp-project-operator/api/v1alpha1  [no test files]
?       github.com/openshift/gcp-project-operator/config        [no test files]
ok      github.com/openshift/gcp-project-operator/controllers/projectclaim      (cached)
?       github.com/openshift/gcp-project-operator/pkg/gcpclient [no test files]
?       github.com/openshift/gcp-project-operator/pkg/util/mocks        [no test files]
?       github.com/openshift/gcp-project-operator/pkg/util/mocks/condition      [no test files]
?       github.com/openshift/gcp-project-operator/pkg/util/mocks/gcpclient      [no test files]
?       github.com/openshift/gcp-project-operator/pkg/util/mocks/structs        [no test files]
?       github.com/openshift/gcp-project-operator/pkg/util/mocks/projectclaim   [no test files]
ok      github.com/openshift/gcp-project-operator/controllers/projectreference  (cached)
ok      github.com/openshift/gcp-project-operator/pkg/condition (cached)
ok      github.com/openshift/gcp-project-operator/pkg/configmap (cached)
ok      github.com/openshift/gcp-project-operator/pkg/util      (cached)
ok      github.com/openshift/gcp-project-operator/pkg/util/errors       (cached)

all tests also pass when running

IMAGE_PULL_PATH=3a247921778c   ALLOW_DIRTY_CHECKOUT=true NONINTERACTIVE=true make container-test

- Update ENVTEST_K8S_VERSION to 1.28.0 and ENVTEST_VERSION to release-0.23
- Install setup-envtest to GOPATH/bin if not present
- Improve kubebuilder test assets setup with proper error handling
- Specify architecture and OS for cross-platform compatibility

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 24, 2026
$(eval KUBEBUILDER_ASSETS := "$(shell $(SETUP_ENVTEST) use $(ENVTEST_K8S_VERSION) -p path --bin-dir /tmp/envtest/bin)")
@if [ ! -f "$(SETUP_ENVTEST)" ]; then \
echo "Installing setup-envtest..."; \
GOBIN=$(GOPATH)/bin go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest; \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we installing the latest version?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated it to match the version used in the Dockerfile

CONTROLLER_GEN_VERSION="v0.16.4" \
OPENAPI_GEN_VERSION="v0.29.15" \
ENVTEST_VERSION="release-0.18" \
ENVTEST_VERSION="release-0.23" \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you build the dockerfile locally to see if it passes?

@eth1030
Copy link
Contributor Author

eth1030 commented Feb 24, 2026

/label tide/merge-method-squash

@openshift-ci openshift-ci bot added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Feb 24, 2026
@eth1030
Copy link
Contributor Author

eth1030 commented Feb 24, 2026

/retest

@abyrne55
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Feb 25, 2026
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 25, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: abyrne55, eth1030

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot bot merged commit 9c29602 into openshift:master Feb 25, 2026
4 checks passed
@eth1030 eth1030 deleted the setup-envtest-bug branch February 25, 2026 16:32
@eth1030 eth1030 changed the title Fix setup-envtest installation and usage SREP-3558: Fix setup-envtest installation and usage Feb 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants