Skip to content

Allow skipping of Spring Build Pack image builds and tests #712

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 26 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ TEST_APPLICATION_IMAGE_SPRING_CNBP := $(OPERATOR_IMAGE_REGISTRY)/operator-test
TEST_APPLICATION_IMAGE_SPRING_2 := $(OPERATOR_IMAGE_REGISTRY)/operator-test-spring-2:1.0.0
TEST_APPLICATION_IMAGE_SPRING_FAT_2 := $(OPERATOR_IMAGE_REGISTRY)/operator-test-spring-fat-2:1.0.0
TEST_APPLICATION_IMAGE_SPRING_CNBP_2 := $(OPERATOR_IMAGE_REGISTRY)/operator-test-spring-cnbp-2:1.0.0
SKIP_SPRING_CNBP := false

# ----------------------------------------------------------------------------------------------------------------------
# Operator Lifecycle Manager properties
Expand Down Expand Up @@ -596,26 +597,17 @@ build-helidon-test-images: $(BUILD_TARGETS)/java ## Build the Helidon test image
$(MAVEN_BUILD_OPTS)

.PHONY: build-spring-test-images
build-spring-test-images: $(BUILD_TARGETS)/java ## Build the Spring test images
# Spring Boot 3.x JIB
./mvnw -B -f java/operator-test-spring package jib:dockerBuild -DskipTests \
-Djib.dockerClient.executable=$(JIB_EXECUTABLE) \
-Djib.to.image=$(TEST_APPLICATION_IMAGE_SPRING) $(MAVEN_BUILD_OPTS)
# Spring Boot 3.x CNBP
./mvnw -B -f java/operator-test-spring package spring-boot:build-image -DskipTests -Dcnbp-image-name=$(TEST_APPLICATION_IMAGE_SPRING_CNBP) $(MAVEN_BUILD_OPTS)
build-spring-test-images: $(BUILD_TARGETS)/java build-spring-jib-images build-spring-fat-images build-spring-cnbp-images ## Build the Spring test images

.PHONY: build-spring-fat-images
build-spring-fat-images: $(BUILD_TARGETS)/java ## Build the Spring Fat Jar test images
# Spring Boot 3.x fat jar
$(DOCKER_CMD) build -f java/operator-test-spring/target/FatJar.Dockerfile -t $(TEST_APPLICATION_IMAGE_SPRING_FAT) --load java/operator-test-spring/target
# Spring Boot 3.x exploded fat jar
rm -rf java/operator-test-spring/target/spring || true && mkdir java/operator-test-spring/target/spring
cp java/operator-test-spring/target/operator-test-spring-$(MVN_VERSION).jar java/operator-test-spring/target/spring/operator-test-spring-$(MVN_VERSION).jar
cd java/operator-test-spring/target/spring && jar -xvf operator-test-spring-$(MVN_VERSION).jar && rm -f operator-test-spring-$(MVN_VERSION).jar
$(DOCKER_CMD) build -f java/operator-test-spring/target/Dir.Dockerfile -t $(TEST_APPLICATION_IMAGE_SPRING) --load java/operator-test-spring/target
# Spring Boot 2.x JIB
./mvnw -B -f java/operator-test-spring-2 package jib:dockerBuild -DskipTests \
-Djib.dockerClient.executable=$(JIB_EXECUTABLE) \
-Djib.to.image=$(TEST_APPLICATION_IMAGE_SPRING_2) $(MAVEN_BUILD_OPTS)
# Spring Boot 2.x CNBP
./mvnw -B -f java/operator-test-spring-2 package spring-boot:build-image -DskipTests -Dcnbp-image-name=$(TEST_APPLICATION_IMAGE_SPRING_CNBP_2) $(MAVEN_BUILD_OPTS)
# Spring Boot 2.x fat jar
$(DOCKER_CMD) build -f java/operator-test-spring-2/target/FatJar.Dockerfile -t $(TEST_APPLICATION_IMAGE_SPRING_FAT_2) --load java/operator-test-spring-2/target
# Spring Boot 2.x exploded fat jar
Expand All @@ -624,6 +616,26 @@ build-spring-test-images: $(BUILD_TARGETS)/java ## Build the Spring test images
cd java/operator-test-spring-2/target/spring && jar -xvf operator-test-spring-2-$(MVN_VERSION).jar && rm -f operator-test-spring-2-$(MVN_VERSION).jar
$(DOCKER_CMD) build -f java/operator-test-spring-2/target/Dir.Dockerfile -t $(TEST_APPLICATION_IMAGE_SPRING_2) --load java/operator-test-spring-2/target

.PHONY: build-spring-jib-images
build-spring-jib-images: $(BUILD_TARGETS)/java ## Build the Spring JIB test images
# Spring Boot 3.x JIB
./mvnw -B -f java/operator-test-spring package jib:dockerBuild -DskipTests \
-Djib.dockerClient.executable=$(JIB_EXECUTABLE) \
-Djib.to.image=$(TEST_APPLICATION_IMAGE_SPRING) $(MAVEN_BUILD_OPTS)
# Spring Boot 2.x JIB
./mvnw -B -f java/operator-test-spring-2 package jib:dockerBuild -DskipTests \
-Djib.dockerClient.executable=$(JIB_EXECUTABLE) \
-Djib.to.image=$(TEST_APPLICATION_IMAGE_SPRING_2) $(MAVEN_BUILD_OPTS)

.PHONY: build-spring-cnbp-images
build-spring-cnbp-images: $(BUILD_TARGETS)/java ## Build the Spring CNBP test images
ifneq (true,$(SKIP_SPRING_CNBP))
# Spring Boot 3.x CNBP
./mvnw -B -f java/operator-test-spring package spring-boot:build-image -DskipTests -Dcnbp-image-name=$(TEST_APPLICATION_IMAGE_SPRING_CNBP) $(MAVEN_BUILD_OPTS)
# Spring Boot 2.x CNBP
./mvnw -B -f java/operator-test-spring-2 package spring-boot:build-image -DskipTests -Dcnbp-image-name=$(TEST_APPLICATION_IMAGE_SPRING_CNBP_2) $(MAVEN_BUILD_OPTS)
endif

# ----------------------------------------------------------------------------------------------------------------------
# Build the basic Operator Test image
# ----------------------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -1240,6 +1252,7 @@ e2e-local-test: export VERSION := $(VERSION)
e2e-local-test: export MVN_VERSION := $(MVN_VERSION)
e2e-local-test: export OPERATOR_IMAGE := $(OPERATOR_IMAGE)
e2e-local-test: export COHERENCE_IMAGE := $(COHERENCE_IMAGE)
e2e-local-test: export SKIP_SPRING_CNBP := $(SKIP_SPRING_CNBP)
e2e-local-test: $(BUILD_TARGETS)/build-operator undeploy reset-namespace create-ssl-secrets gotestsum install-crds ensure-pull-secret ## Run the Operator end-to-end 'local' functional tests using a local Operator instance
$(GOTESTSUM) --format standard-verbose --junitfile $(TEST_LOGS_DIR)/operator-e2e-local-test.xml \
-- $(GO_TEST_FLAGS_E2E) ./test/e2e/local/...
Expand Down
9 changes: 9 additions & 0 deletions test/e2e/local/spring_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/oracle/coherence-operator/test/e2e/helper"
corev1 "k8s.io/api/core/v1"
"net/http"
"os"
"testing"
)

Expand All @@ -28,6 +29,10 @@ func TestStartSpringFatJarCluster(t *testing.T) {
}

func TestStartSpringBuildpacksCluster(t *testing.T) {
skip := os.Getenv("SKIP_SPRING_CNBP")
if skip == "true" {
return
}
testContext.CleanupAfterTest(t)
_, pods := helper.AssertDeployments(testContext, t, "spring-buildpack-cluster.yaml")
AssertSpringEndpoint(t, pods)
Expand All @@ -46,6 +51,10 @@ func TestStartSpringTwoFatJarCluster(t *testing.T) {
}

func TestStartSpringTwoBuildpacksCluster(t *testing.T) {
skip := os.Getenv("SKIP_SPRING_CNBP")
if skip == "true" {
return
}
testContext.CleanupAfterTest(t)
_, pods := helper.AssertDeployments(testContext, t, "spring-buildpack-cluster-2.yaml")
AssertSpringEndpoint(t, pods)
Expand Down
Loading