Skip to content

Commit d10357a

Browse files
refactor(e2e): enhance build skipping logic for operator images
- Updated the environment variable for skipping operator image builds in the GitHub Actions workflow. - Introduced a new function to determine if only the operator image build should be skipped, improving clarity and maintainability. - Modified the operator deployment logic to utilize the new skipping function, allowing for more flexible build configurations.
1 parent c817b82 commit d10357a

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,5 +74,5 @@ jobs:
7474
- name: Run E2E tests
7575
run: make test-e2e
7676
env:
77-
E2E_SKIP_BUILD: "true"
77+
E2E_SKIP_OPERATOR_BUILD: "true"
7878
E2E_OPERATOR_IMAGE: "ghcr.io/${{ github.repository }}:${{ github.sha }}"

test/e2e/framework/config.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,20 @@ func GetProjectRoot() string {
4444
return "../.."
4545
}
4646

47+
// SkipBuild returns true if all local builds should be skipped.
48+
// This affects both operator and mock server builds.
4749
func SkipBuild() bool {
4850
val := strings.ToLower(os.Getenv("E2E_SKIP_BUILD"))
4951
return val == "true" || val == "1" || val == "yes"
5052
}
5153

54+
// SkipOperatorBuild returns true if only the operator image build should be skipped.
55+
// Use this when pulling a pre-built operator image from registry but still need to build mock server locally.
56+
func SkipOperatorBuild() bool {
57+
val := strings.ToLower(os.Getenv("E2E_SKIP_OPERATOR_BUILD"))
58+
return val == "true" || val == "1" || val == "yes"
59+
}
60+
5261
func SkipOperatorDeploy() bool {
5362
val := strings.ToLower(os.Getenv("E2E_SKIP_OPERATOR"))
5463
return val == "true" || val == "1" || val == "yes"

test/e2e/framework/operator.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,8 @@ func DeployOperatorSetup(clusterName string) func(ctx context.Context, cfg *envc
195195

196196
image := GetOperatorImage()
197197

198-
if SkipBuild() {
199-
fmt.Printf("Skipping image build (E2E_SKIP_BUILD=true), using existing image: %s\n", image)
198+
if SkipBuild() || SkipOperatorBuild() {
199+
fmt.Printf("Skipping operator image build, using existing image: %s\n", image)
200200
} else {
201201
fmt.Printf("Building operator image: %s\n", image)
202202
if err := BuildOperatorImage(projectRoot, image); err != nil {

0 commit comments

Comments
 (0)