@@ -399,16 +399,29 @@ FROM openfeature-provider-js-base AS openfeature-provider-js.test
399399COPY confidence-resolver/protos ../../../confidence-resolver/protos
400400COPY wasm/resolver_state.pb ../../../wasm/resolver_state.pb
401401
402+ # Run tests
403+ RUN make test
404+
405+ # ==============================================================================
406+ # E2E Test OpenFeature Provider (CI only - requires credentials)
407+ # ==============================================================================
408+ FROM openfeature-provider-js.test AS openfeature-provider-js.test_e2e
409+
402410# Accept e2e test credentials as build args (not persisted in image)
403411ARG JS_E2E_CONFIDENCE_API_CLIENT_ID
404412ARG JS_E2E_CONFIDENCE_API_CLIENT_SECRET
405413
406- # Run tests with secrets passed as environment variables
414+ # Run e2e tests with secrets passed as environment variables
415+ # If credentials are not provided, skip e2e tests (exit 0)
407416# Using ARG in RUN means they're only available during this command execution
408417RUN --mount=type=cache,target=/root/.yarn \
409- JS_E2E_CONFIDENCE_API_CLIENT_ID="${JS_E2E_CONFIDENCE_API_CLIENT_ID}" \
410- JS_E2E_CONFIDENCE_API_CLIENT_SECRET="${JS_E2E_CONFIDENCE_API_CLIENT_SECRET}" \
411- make test
418+ if [ -n "${JS_E2E_CONFIDENCE_API_CLIENT_ID}" ] && [ -n "${JS_E2E_CONFIDENCE_API_CLIENT_SECRET}" ]; then \
419+ JS_E2E_CONFIDENCE_API_CLIENT_ID="${JS_E2E_CONFIDENCE_API_CLIENT_ID}" \
420+ JS_E2E_CONFIDENCE_API_CLIENT_SECRET="${JS_E2E_CONFIDENCE_API_CLIENT_SECRET}" \
421+ make test-e2e; \
422+ else \
423+ echo "Skipping e2e tests (credentials not provided)" ; \
424+ fi
412425
413426# ==============================================================================
414427# Build OpenFeature Provider
@@ -466,7 +479,7 @@ FROM openfeature-provider-java-base AS openfeature-provider-java.build
466479RUN make build
467480
468481# ==============================================================================
469- # All - Build and validate everything (default target)
482+ # All - Build and validate everything (default target - no e2e tests )
470483# ==============================================================================
471484FROM scratch AS all
472485
@@ -494,3 +507,15 @@ COPY --from=wasm-rust-guest.lint /workspace/Cargo.toml /markers/lint-guest
494507COPY --from=openfeature-provider-js.build /app/dist/index.node.js /artifacts/openfeature-js/
495508COPY --from=openfeature-provider-java.build /app/target/*.jar /artifacts/openfeature-java/
496509COPY --from=confidence-cloudflare-resolver.lint /workspace/Cargo.toml /markers/lint-cloudflare
510+
511+ # ==============================================================================
512+ # All E2E - Build and validate everything including e2e tests (CI only)
513+ # ==============================================================================
514+ FROM scratch AS all-e2e
515+
516+ # Copy everything from main all target
517+ COPY --from=all /artifacts /artifacts
518+ COPY --from=all /markers /markers
519+
520+ # Additionally force e2e test stage to run
521+ COPY --from=openfeature-provider-js.test_e2e /app/package.json /markers/test-openfeature-js-e2e
0 commit comments