Skip to content

Commit 7732903

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 and TESTS_EXT_OUTPUT variables - 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/openshift-apiserver-tests-ext Dockerfile changes: - Updated gzip path: test/extended/tests-extension/openshift-apiserver-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/openshift-apiserver-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 d33f57d commit 7732903

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
/openshift-apiserver
22
/_output
33
.idea
4-
/openshift-apiserver-tests-ext
4+
/test/extended/tests-extension/openshift-apiserver-tests-ext

Makefile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ IMAGE_REGISTRY?=registry.svc.ci.openshift.org
1414
# OpenShift Tests Extension (OpenShift API Server)
1515
# -------------------------------------------------------------------
1616
TESTS_EXT_BINARY := openshift-apiserver-tests-ext
17+
TESTS_EXT_DIR := ./test/extended/tests-extension
18+
TESTS_EXT_OUTPUT := $(TESTS_EXT_DIR)/$(TESTS_EXT_BINARY)
1719
TESTS_EXT_PACKAGE := ./cmd/openshift-apiserver-tests-ext
1820

1921
TESTS_EXT_GIT_COMMIT := $(shell git rev-parse --short HEAD)
@@ -59,6 +61,7 @@ verify:
5961
# -------------------------------------------------------------------
6062
.PHONY: tests-ext-build
6163
tests-ext-build:
64+
cd $(TESTS_EXT_DIR) && \
6265
GOOS=$(GOOS) GOARCH=$(GOARCH) GO_COMPLIANCE_POLICY=exempt_all CGO_ENABLED=0 \
6366
go build -o $(TESTS_EXT_BINARY) -ldflags "$(TESTS_EXT_LDFLAGS)" $(TESTS_EXT_PACKAGE)
6467

@@ -67,7 +70,7 @@ tests-ext-build:
6770
# -------------------------------------------------------------------
6871
.PHONY: tests-ext-update
6972
tests-ext-update: tests-ext-build
70-
./$(TESTS_EXT_BINARY) update
71-
for f in .openshift-tests-extension/*.json; do \
72-
jq 'map(del(.codeLocations))' "$f" > tmpp && mv tmpp "$f"; \
73+
cd $(TESTS_EXT_DIR) && ./$(TESTS_EXT_BINARY) update
74+
for f in $(TESTS_EXT_DIR)/.openshift-tests-extension/*.json; do \
75+
jq 'map(del(.codeLocations))' "$$f" > tmpp && mv tmpp "$$f"; \
7376
done

images/Dockerfile.rhel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ WORKDIR /go/src/github.com/openshift/openshift-apiserver
33
COPY . .
44
RUN make build --warn-undefined-variables \
55
&& make tests-ext-build \
6-
&& gzip openshift-apiserver-tests-ext
6+
&& gzip test/extended/tests-extension/openshift-apiserver-tests-ext
77

88
FROM registry.ci.openshift.org/ocp/4.21:base-rhel9
99
COPY --from=builder /go/src/github.com/openshift/openshift-apiserver/openshift-apiserver /usr/bin/
10-
COPY --from=builder /go/src/github.com/openshift/openshift-apiserver/openshift-apiserver-tests-ext.gz /usr/bin/
10+
COPY --from=builder /go/src/github.com/openshift/openshift-apiserver/test/extended/tests-extension/openshift-apiserver-tests-ext.gz /usr/bin/
1111
ENTRYPOINT ["/usr/bin/openshift-apiserver"]
1212
LABEL io.k8s.display-name="OpenShift API Server Command" \
1313
io.k8s.description="OpenShift is a platform for developing, building, and deploying containerized applications." \

0 commit comments

Comments
 (0)