Skip to content

Commit

Permalink
Spliting e2e tests; add custom config to use quay
Browse files Browse the repository at this point in the history
Signed-off-by: Ricardo Zanini <[email protected]>
  • Loading branch information
ricardozanini committed Jun 26, 2024
1 parent af6f8e4 commit d03aaf8
Show file tree
Hide file tree
Showing 22 changed files with 92 additions and 416 deletions.
20 changes: 18 additions & 2 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,24 @@ jobs:
make deploy IMG=${{ env.OPERATOR_IMAGE_NAME }}
kubectl wait pod -A -l control-plane=sonataflow-operator --for condition=Ready
- name: Run tests
run: make test-e2e
- name: Run tests for workflows without persistence
run: make test-e2e label=flows-non-persistence

- name: Retrieve cluster events and list pods
if: failure()
run: |
kubectl get events
kubectl get pod -A
- name: Run tests for workflows with persistence
run: make test-e2e label=flows-persistence

- name: Retrieve cluster events and list pods
if: failure()
run: |
kubectl get events
kubectl get pod -A
- name: Run tests for platform use cases
run: make test-e2e label=platform

- name: Retrieve cluster events and list pods
if: failure()
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,9 @@ addheaders:
generate-all: generate generate-deploy bundle addheaders vet fmt

.PHONY: test-e2e # You will need to have a Minikube/Kind cluster up in running to run this target, and run container-builder before the test
label = "flows-non-persistence" # possible values are flows-non-persistence, flows-persistence, platform
test-e2e:
go test ./test/e2e/* -v -ginkgo.v -ginkgo.no-color -ginkgo.junit-report=./e2e-test-report.xml -timeout 60m
go test ./test/e2e/* -v -ginkgo.v -ginkgo.no-color -ginkgo.label-filter=$(label) -ginkgo.junit-report=./e2e-test-report.xml -timeout 60m

.PHONY: before-pr
before-pr: test generate-all
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,26 @@ data:
kanikoDefaultWarmerImageTag: gcr.io/kaniko-project/warmer:v1.9.0
# Default image used internally by the Operator Managed Kaniko builder to create the executor pods
kanikoExecutorImageTag: gcr.io/kaniko-project/executor:v1.9.0
# TODO: Temporary use the images from quay, once we have the dockerhub images we can revert this back: https://github.com/apache/incubator-kie-kogito-serverless-operator/issues/498
# The Jobs Service image to use, if empty the operator will use the default Apache Community one based on the current operator's version
jobsServicePostgreSQLImageTag: ""
jobsServiceEphemeralImageTag: ""
jobsServicePostgreSQLImageTag: quay.io/kiegroup/kogito-jobs-service-postgresql:weekly-latest
jobsServiceEphemeralImageTag: quay.io/kiegroup/kogito-jobs-service-ephemeral:weekly-latest
# The Data Index image to use, if empty the operator will use the default Apache Community one based on the current operator's version
dataIndexPostgreSQLImageTag: ""
dataIndexEphemeralImageTag: ""
dataIndexPostgreSQLImageTag: quay.io/kiegroup/kogito-data-index-postgresql:weekly-latest
dataIndexEphemeralImageTag: quay.io/kiegroup/kogito-data-index-ephemeral:weekly-latest
# SonataFlow base builder image used in the internal Dockerfile to build workflow applications in preview profile
# Order of precedence is:
# 1. SonataFlowPlatform in the given namespace
# 2. This configuration
# 3. The FROM in the Dockerfile in the operator's namespace "sonataflow-operator-builder-config" configMap.
# If 1 or 2, the FROM tag will be replaced by the tag se there.
# If empty the operator will use the default Apache Community one based on the current operator's version.
sonataFlowBaseBuilderImageTag: ""
sonataFlowBaseBuilderImageTag: quay.io/kiegroup/kogito-swf-builder-nightly:latest
# The image to use to deploy SonataFlow workflow images in devmode profile.
# If empty the operator will use the default Apache Community one based on the current operator's version.
sonataFlowDevModeImageTag: ""
sonataFlowDevModeImageTag: quay.io/kiegroup/kogito-swf-devmode-nightly:latest
# The default name of the builder configMap in the operator's namespace
builderConfigMapName: "sonataflow-operator-builder-config"
# Quarkus extensions required for workflows persistence. These extensions are used by the SonataFlow build system,
Expand Down
15 changes: 9 additions & 6 deletions config/manager/controllers_cfg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,26 @@ healthFailureThresholdDevMode: 50
kanikoDefaultWarmerImageTag: gcr.io/kaniko-project/warmer:v1.9.0
# Default image used internally by the Operator Managed Kaniko builder to create the executor pods
kanikoExecutorImageTag: gcr.io/kaniko-project/executor:v1.9.0

# TODO: Temporary use the images from quay, once we have the dockerhub images we can revert this back: https://github.com/apache/incubator-kie-kogito-serverless-operator/issues/498

# The Jobs Service image to use, if empty the operator will use the default Apache Community one based on the current operator's version
jobsServicePostgreSQLImageTag: ""
jobsServiceEphemeralImageTag: ""
jobsServicePostgreSQLImageTag: quay.io/kiegroup/kogito-jobs-service-postgresql:weekly-latest
jobsServiceEphemeralImageTag: quay.io/kiegroup/kogito-jobs-service-ephemeral:weekly-latest
# The Data Index image to use, if empty the operator will use the default Apache Community one based on the current operator's version
dataIndexPostgreSQLImageTag: ""
dataIndexEphemeralImageTag: ""
dataIndexPostgreSQLImageTag: quay.io/kiegroup/kogito-data-index-postgresql:weekly-latest
dataIndexEphemeralImageTag: quay.io/kiegroup/kogito-data-index-ephemeral:weekly-latest
# SonataFlow base builder image used in the internal Dockerfile to build workflow applications in preview profile
# Order of precedence is:
# 1. SonataFlowPlatform in the given namespace
# 2. This configuration
# 3. The FROM in the Dockerfile in the operator's namespace "sonataflow-operator-builder-config" configMap.
# If 1 or 2, the FROM tag will be replaced by the tag se there.
# If empty the operator will use the default Apache Community one based on the current operator's version.
sonataFlowBaseBuilderImageTag: ""
sonataFlowBaseBuilderImageTag: quay.io/kiegroup/kogito-swf-builder-nightly:latest
# The image to use to deploy SonataFlow workflow images in devmode profile.
# If empty the operator will use the default Apache Community one based on the current operator's version.
sonataFlowDevModeImageTag: ""
sonataFlowDevModeImageTag: quay.io/kiegroup/kogito-swf-devmode-nightly:latest
# The default name of the builder configMap in the operator's namespace
builderConfigMapName: "sonataflow-operator-builder-config"
# Quarkus extensions required for workflows persistence. These extensions are used by the SonataFlow build system,
Expand Down
11 changes: 6 additions & 5 deletions controllers/platform/platformutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,14 @@ import (
"strings"
"time"

"github.com/apache/incubator-kie-kogito-serverless-operator/controllers/workflowdef"
corev1 "k8s.io/api/core/v1"
k8serrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/klog/v2"
ctrl "sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/yaml"

"github.com/apache/incubator-kie-kogito-serverless-operator/controllers/workflowdef"

"github.com/apache/incubator-kie-kogito-serverless-operator/container-builder/client"
"github.com/apache/incubator-kie-kogito-serverless-operator/log"

Expand Down Expand Up @@ -93,9 +92,10 @@ func setPlatformDefaults(p *operatorapi.SonataFlowPlatform, verbose bool) error

if p.Spec.Build.Config.IsStrategyOptionEnabled(kanikoBuildCacheEnabled) {
p.Spec.Build.Config.BuildStrategyOptions[kanikoPVCName] = p.Name
if len(p.Spec.Build.Config.BaseImage) == 0 {
p.Spec.Build.Config.BaseImage = workflowdef.GetDefaultWorkflowBuilderImageTag()
}
}

if len(p.Spec.Build.Config.BaseImage) == 0 {
p.Spec.Build.Config.BaseImage = workflowdef.GetDefaultWorkflowBuilderImageTag()
}

if p.Spec.Build.Config.BuildStrategy == operatorapi.OperatorBuildStrategy && !p.Spec.Build.Config.IsStrategyOptionEnabled(kanikoBuildCacheEnabled) {
Expand Down Expand Up @@ -161,6 +161,7 @@ func GetRegistryAddress(ctx context.Context, c client.Client) (*string, error) {
// GetCustomizedBuilderDockerfile gets the Dockerfile as defined in the default platform ConfigMap, apply any custom requirements and return.
func GetCustomizedBuilderDockerfile(dockerfile string, platform operatorapi.SonataFlowPlatform) string {
if len(platform.Spec.Build.Config.BaseImage) > 0 {
klog.V(log.D).InfoS("Using Custom Dockerfile", "base image", platform.Spec.Build.Config.BaseImage)
dockerfile = strings.Replace(dockerfile, GetFromImageTagDockerfile(dockerfile), platform.Spec.Build.Config.BaseImage, 1)
}
return dockerfile
Expand Down
16 changes: 10 additions & 6 deletions hack/local/run-e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,23 @@
# runs the e2e locally
# You must have minikube installed
MINIKUBE_PROFILE=${1:-minikube}
SKIP_IMG_BUILD=${2:-0}
TEST_LABELS=${3:-"flows-non-persistence"} # possible values are flows-non-persistence, flows-persistence, platform

echo "Using minikube profile ${MINIKUBE_PROFILE}"
export OPERATOR_IMAGE_NAME=localhost/kogito-serverless-operator:0.0.1

# clean up previous runs
kubectl get namespaces -o name | awk -F/ '/^namespace\/test/ {print $2}' | xargs kubectl delete namespace
make undeploy ignore-not-found=true
make deploy IMG="${OPERATOR_IMAGE_NAME}"

eval "$(minikube -p "${MINIKUBE_PROFILE}" docker-env)"
if ! make container-build BUILDER=docker IMG="${OPERATOR_IMAGE_NAME}"; then
echo "Failure: Failed to build image, exiting " >&2
exit 1
if [ "${SKIP_IMG_BUILD}" = "0" ]; then
eval "$(minikube -p "${MINIKUBE_PROFILE}" docker-env)"
if ! make container-build BUILDER=docker IMG="${OPERATOR_IMAGE_NAME}"; then
echo "Failure: Failed to build image, exiting " >&2
exit 1
fi
fi

make deploy IMG="${OPERATOR_IMAGE_NAME}"
make test-e2e
make test-e2e label="${TEST_LABELS}"
15 changes: 9 additions & 6 deletions operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27020,23 +27020,26 @@ data:
kanikoDefaultWarmerImageTag: gcr.io/kaniko-project/warmer:v1.9.0
# Default image used internally by the Operator Managed Kaniko builder to create the executor pods
kanikoExecutorImageTag: gcr.io/kaniko-project/executor:v1.9.0

# TODO: Temporary use the images from quay, once we have the dockerhub images we can revert this back: https://github.com/apache/incubator-kie-kogito-serverless-operator/issues/498

# The Jobs Service image to use, if empty the operator will use the default Apache Community one based on the current operator's version
jobsServicePostgreSQLImageTag: ""
jobsServiceEphemeralImageTag: ""
jobsServicePostgreSQLImageTag: quay.io/kiegroup/kogito-jobs-service-postgresql:weekly-latest
jobsServiceEphemeralImageTag: quay.io/kiegroup/kogito-jobs-service-ephemeral:weekly-latest
# The Data Index image to use, if empty the operator will use the default Apache Community one based on the current operator's version
dataIndexPostgreSQLImageTag: ""
dataIndexEphemeralImageTag: ""
dataIndexPostgreSQLImageTag: quay.io/kiegroup/kogito-data-index-postgresql:weekly-latest
dataIndexEphemeralImageTag: quay.io/kiegroup/kogito-data-index-ephemeral:weekly-latest
# SonataFlow base builder image used in the internal Dockerfile to build workflow applications in preview profile
# Order of precedence is:
# 1. SonataFlowPlatform in the given namespace
# 2. This configuration
# 3. The FROM in the Dockerfile in the operator's namespace "sonataflow-operator-builder-config" configMap.
# If 1 or 2, the FROM tag will be replaced by the tag se there.
# If empty the operator will use the default Apache Community one based on the current operator's version.
sonataFlowBaseBuilderImageTag: ""
sonataFlowBaseBuilderImageTag: quay.io/kiegroup/kogito-swf-builder-nightly:latest
# The image to use to deploy SonataFlow workflow images in devmode profile.
# If empty the operator will use the default Apache Community one based on the current operator's version.
sonataFlowDevModeImageTag: ""
sonataFlowDevModeImageTag: quay.io/kiegroup/kogito-swf-devmode-nightly:latest
# The default name of the builder configMap in the operator's namespace
builderConfigMapName: "sonataflow-operator-builder-config"
# Quarkus extensions required for workflows persistence. These extensions are used by the SonataFlow build system,
Expand Down
63 changes: 0 additions & 63 deletions tekton/pipeline/kogito_serverless_operator_pipeline.yaml

This file was deleted.

26 changes: 0 additions & 26 deletions tekton/pipeline/kogito_serverless_operator_pipeline_run.yaml

This file was deleted.

Loading

0 comments on commit d03aaf8

Please sign in to comment.