Skip to content

Commit a2b6b64

Browse files
committed
Update build infrastructure for isolated test module
Updates Makefile, Dockerfile, and .gitignore to work with the new test extension module location. Makefile changes: - Added TESTS_EXT_DIR variable pointing to test/extended/tests-extension - tests-ext-build now builds from test/extended/tests-extension/ - tests-ext-update runs from and updates metadata in tests-extension dir - Binary output: test/extended/tests-extension/cluster-kube-apiserver-operator-tests-ext Dockerfile changes: - Updated gzip path: test/extended/tests-extension/cluster-kube-apiserver-operator-tests-ext - Updated COPY path for .gz file to match new location .gitignore changes: - Updated to ignore binary at new path: /test/extended/tests-extension/cluster-kube-apiserver-operator-tests-ext The build process now: 1. cd into test/extended/tests-extension/ (where the separate go.mod is) 2. Build the binary using the isolated dependencies 3. Output binary stays within the test module directory 4. Docker build references the new paths for gzip and copy operations
1 parent 871db88 commit a2b6b64

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/cluster-kube-apiserver-operator
2-
/cluster-kube-apiserver-operator-tests-ext
2+
/test/extended/tests-extension/cluster-kube-apiserver-operator-tests-ext
33
.idea/
44
/_output/
55
telepresence.log

Dockerfile.rhel7

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ COPY . .
44
ENV GO_PACKAGE github.com/openshift/cluster-kube-apiserver-operator
55
RUN make build --warn-undefined-variables \
66
&& make tests-ext-build \
7-
&& gzip cluster-kube-apiserver-operator-tests-ext
7+
&& gzip test/extended/tests-extension/cluster-kube-apiserver-operator-tests-ext
88

99
FROM registry.ci.openshift.org/ocp/4.21:base-rhel9
1010
COPY --from=builder /go/src/github.com/openshift/cluster-kube-apiserver-operator/bindata/bootkube/bootstrap-manifests /usr/share/bootkube/manifests/bootstrap-manifests/
@@ -13,7 +13,7 @@ COPY --from=builder /go/src/github.com/openshift/cluster-kube-apiserver-operator
1313
COPY --from=builder /go/src/github.com/openshift/cluster-kube-apiserver-operator/bindata/bootkube/scc-manifests /usr/share/bootkube/manifests/manifests/
1414
COPY --from=builder /go/src/github.com/openshift/cluster-kube-apiserver-operator/vendor/github.com/openshift/api/apiserver/v1/zz_generated.crd-manifests/kube-apiserver_apirequestcounts.crd.yaml /usr/share/bootkube/manifests/manifests/
1515
COPY --from=builder /go/src/github.com/openshift/cluster-kube-apiserver-operator/cluster-kube-apiserver-operator /usr/bin/
16-
COPY --from=builder /go/src/github.com/openshift/cluster-kube-apiserver-operator/cluster-kube-apiserver-operator-tests-ext.gz /usr/bin/
16+
COPY --from=builder /go/src/github.com/openshift/cluster-kube-apiserver-operator/test/extended/tests-extension/cluster-kube-apiserver-operator-tests-ext.gz /usr/bin/
1717

1818
COPY manifests /manifests
1919
COPY bindata/bootkube/scc-manifests /manifests

Makefile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ ENCRYPTION_PROVIDERS=aescbc aesgcm
1818
ENCRYPTION_PROVIDER?=aescbc
1919

2020
TESTS_EXT_BINARY := cluster-kube-apiserver-operator-tests-ext
21-
TESTS_EXT_PACKAGE := ./cmd/cluster-kube-apiserver-operator-tests-ext
21+
TESTS_EXT_DIR := ./test/extended/tests-extension
22+
TESTS_EXT_PACKAGE := ./cmd
2223

2324
TESTS_EXT_GIT_COMMIT := $(shell git rev-parse --short HEAD)
2425
TESTS_EXT_BUILD_DATE := $(shell date -u +'%Y-%m-%dT%H:%M:%SZ')
@@ -101,6 +102,7 @@ test-e2e-sno-disruptive: test-unit
101102
# -------------------------------------------------------------------
102103
.PHONY: tests-ext-build
103104
tests-ext-build:
105+
cd $(TESTS_EXT_DIR) && \
104106
GOOS=$(GOOS) GOARCH=$(GOARCH) GO_COMPLIANCE_POLICY=exempt_all CGO_ENABLED=0 \
105107
go build -o $(TESTS_EXT_BINARY) -ldflags "$(TESTS_EXT_LDFLAGS)" $(TESTS_EXT_PACKAGE)
106108

@@ -109,8 +111,8 @@ tests-ext-build:
109111
# -------------------------------------------------------------------
110112
.PHONY: tests-ext-update
111113
tests-ext-update: tests-ext-build
112-
./$(TESTS_EXT_BINARY) update
113-
for f in .openshift-tests-extension/*.json; do \
114+
cd $(TESTS_EXT_DIR) && ./$(TESTS_EXT_BINARY) update
115+
for f in $(TESTS_EXT_DIR)/.openshift-tests-extension/*.json; do \
114116
jq 'map(del(.codeLocations))' "$$f" > tmpp && mv tmpp "$$f"; \
115117
done
116118

0 commit comments

Comments
 (0)