-
Notifications
You must be signed in to change notification settings - Fork 109
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
e2e: Run on other architectures #799
Merged
openshift-merge-robot
merged 9 commits into
openshift:master
from
gquillar:e2e_multi-arch
Mar 14, 2022
Merged
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
8aa8aa2
e2e: Run on other architectures
gquillar 8b069ca
fix test failure
gquillar dfc27a5
Merge branch 'openshift:master' into e2e_multi-arch
gquillar 4d96f27
e2e: Run on other architectures
gquillar 3b9e897
fix test failure
gquillar 892c886
Merge branch 'e2e_multi-arch' of https://github.com/gquillar/complian…
gquillar 48cd821
fix tag usage for openscap-ocp
gquillar 2fb49f6
add push of latest tag for test-broken-content image
gquillar 214fa7a
change profile bundle definition for broken_os_detection image
gquillar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
# Operator variables | ||
DEFAULT_IMAGE_OPENSCAP_PATH=quay.io/compliance-operator/$(RELATED_IMAGE_OPENSCAP_NAME):$(RELATED_IMAGE_OPENSCAP_TAG) | ||
# ================== | ||
export APP_NAME=compliance-operator | ||
RELATED_IMAGE_OPENSCAP_NAME=openscap-ocp | ||
|
@@ -37,8 +38,10 @@ RELATED_IMAGE_OPENSCAP_TAG?=1.3.5 | |
# Image path to use. Set this if you want to use a specific path for building | ||
# or your e2e tests. This is overwritten if we bulid the image and push it to | ||
# the cluster or if we're on CI. | ||
DEFAULT_IMAGE_OPERATOR_PATH=quay.io/compliance-operator/$(APP_NAME):latest | ||
DEFAULT_IMAGE_OPENSCAP_PATH=quay.io/compliance-operator/$(RELATED_IMAGE_OPENSCAP_NAME):$(RELATED_IMAGE_OPENSCAP_TAG) | ||
RELATED_IMAGE_OPERATOR_PATH?=$(IMAGE_REPO)/$(APP_NAME) | ||
RELATED_IMAGE_OPENSCAP_PATH=$(IMAGE_REPO)/$(RELATED_IMAGE_OPENSCAP_NAME) | ||
RELATED_IMAGE_OPENSCAP_PATH?=$(IMAGE_REPO)/$(RELATED_IMAGE_OPENSCAP_NAME) | ||
OPENSCAP_DOCKER_CONTEXT=./images/openscap | ||
|
||
# Image tag to use. Set this if you want to use a specific tag for building | ||
|
@@ -112,8 +115,9 @@ E2E_GO_TEST_FLAGS?=-test.v -test.timeout 120m | |
# Specifies the image path to use for the content in the tests | ||
DEFAULT_CONTENT_IMAGE_PATH=quay.io/complianceascode/ocp4:latest | ||
E2E_CONTENT_IMAGE_PATH?=quay.io/complianceascode/ocp4:latest | ||
# We specifically omit the tag here since we only use this for testing. | ||
E2E_BROKEN_CONTENT_IMAGE_PATH?=quay.io/compliance-operator/test-broken-content:latest | ||
# We specifically omit the tag here since we use this for testing | ||
# different images referenced by different tags. | ||
E2E_BROKEN_CONTENT_IMAGE_PATH?=quay.io/compliance-operator/test-broken-content | ||
|
||
QUAY_NAMESPACE=compliance-operator | ||
OPERATOR_VERSION?= | ||
|
@@ -197,9 +201,13 @@ test-catalog: index-image-to-cluster | |
@oc apply -f deploy/olm-catalog/operator-group.yaml | ||
@oc apply -f deploy/olm-catalog/subscription.yaml | ||
|
||
.PHONY: test-broken-content-image | ||
test-broken-content-image: | ||
$(RUNTIME) build -t $(E2E_BROKEN_CONTENT_IMAGE_PATH) -f images/testcontent/broken-content.Dockerfile . | ||
.PHONY: e2e-content-images | ||
e2e-content-images: | ||
RUNTIME=$(RUNTIME) images/testcontent/broken-content.sh build ${E2E_BROKEN_CONTENT_IMAGE_PATH} | ||
|
||
.PHONY: push-e2e-content | ||
push-e2e-content: e2e-content-images | ||
RUNTIME=$(RUNTIME) images/testcontent/broken-content.sh push ${E2E_BROKEN_CONTENT_IMAGE_PATH} | ||
|
||
.PHONY: must-gather-image | ||
must-gather-image: | ||
|
@@ -300,24 +308,24 @@ test-benchmark: ## Run the benchmark tests -- Note that this can only be ran for | |
e2e: namespace tear-down operator-sdk image-to-cluster openshift-user deploy-crds ## Run the end-to-end tests | ||
@echo "WARNING: This will temporarily modify deploy/operator.yaml" | ||
@echo "Replacing workload references in deploy/operator.yaml" | ||
@$(SED) 's%$(IMAGE_REPO)/$(RELATED_IMAGE_OPENSCAP_NAME):$(RELATED_IMAGE_OPENSCAP_TAG)%$(RELATED_IMAGE_OPENSCAP_PATH)%' deploy/operator.yaml | ||
@$(SED) 's%$(IMAGE_REPO)/$(APP_NAME):latest%$(RELATED_IMAGE_OPERATOR_PATH)%' deploy/operator.yaml | ||
@$(SED) 's%$(DEFAULT_IMAGE_OPENSCAP_PATH)%$(RELATED_IMAGE_OPENSCAP_PATH):$(RELATED_IMAGE_OPENSCAP_TAG)%' deploy/operator.yaml | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, I wonder if this is the reason for failure I'm seeing..while running the e2e tests locally I see the tag twice in the scanner pods:
I guess this might also be the reason for the CI failing. I'm sorry I didn't have enough time to dive deeper into why this is failing.. |
||
@$(SED) 's%$(DEFAULT_IMAGE_OPERATOR_PATH)%$(RELATED_IMAGE_OPERATOR_PATH)%' deploy/operator.yaml | ||
@$(SED) 's%$(DEFAULT_CONTENT_IMAGE_PATH)%$(E2E_CONTENT_IMAGE_PATH)%' deploy/operator.yaml | ||
@echo "Running e2e tests" | ||
unset GOFLAGS && BROKEN_CONTENT_IMAGE=$(E2E_BROKEN_CONTENT_IMAGE_PATH) CONTENT_IMAGE=$(E2E_CONTENT_IMAGE_PATH) $(GOPATH)/bin/operator-sdk test local ./tests/e2e --skip-cleanup-error --image "$(RELATED_IMAGE_OPERATOR_PATH)" --go-test-flags "$(E2E_GO_TEST_FLAGS)" | ||
@echo "Restoring image references in deploy/operator.yaml" | ||
@$(SED) 's%$(RELATED_IMAGE_OPENSCAP_PATH)%$(IMAGE_REPO)/$(RELATED_IMAGE_OPENSCAP_NAME):$(RELATED_IMAGE_OPENSCAP_TAG)%' deploy/operator.yaml | ||
@$(SED) 's%$(RELATED_IMAGE_OPERATOR_PATH)%$(IMAGE_REPO)/$(APP_NAME):latest%' deploy/operator.yaml | ||
@$(SED) 's%$(RELATED_IMAGE_OPENSCAP_PATH):$(RELATED_IMAGE_OPENSCAP_TAG)%$(DEFAULT_IMAGE_OPENSCAP_PATH)%' deploy/operator.yaml | ||
@$(SED) 's%$(RELATED_IMAGE_OPERATOR_PATH)%$(DEFAULT_IMAGE_OPERATOR_PATH)%' deploy/operator.yaml | ||
@$(SED) 's%$(E2E_CONTENT_IMAGE_PATH)%$(DEFAULT_CONTENT_IMAGE_PATH)%' deploy/operator.yaml | ||
|
||
e2e-local: operator-sdk tear-down deploy-crds ## Run the end-to-end tests on a locally running operator (e.g. using make run) | ||
@echo "WARNING: This will temporarily modify deploy/operator.yaml" | ||
@echo "Replacing workload references in deploy/operator.yaml" | ||
@$(SED) 's%$(IMAGE_REPO)/$(APP_NAME):latest%$(RELATED_IMAGE_OPERATOR_PATH)%' deploy/operator.yaml | ||
@$(SED) 's%$(DEFAULT_IMAGE_OPERATOR_PATH)%$(RELATED_IMAGE_OPERATOR_PATH)%' deploy/operator.yaml | ||
@$(SED) 's%$(DEFAULT_CONTENT_IMAGE_PATH)%$(E2E_CONTENT_IMAGE_PATH)%' deploy/operator.yaml | ||
unset GOFLAGS && CONTENT_IMAGE=$(E2E_CONTENT_IMAGE_PATH) $(GOPATH)/bin/operator-sdk test local ./tests/e2e --up-local --skip-cleanup-error --image "$(RELATED_IMAGE_OPERATOR_PATH)" --go-test-flags "$(E2E_GO_TEST_FLAGS)" | ||
@echo "Restoring image references in deploy/operator.yaml" | ||
@$(SED) 's%$(RELATED_IMAGE_OPERATOR_PATH)%$(IMAGE_REPO)/$(APP_NAME):latest%' deploy/operator.yaml | ||
@$(SED) 's%$(RELATED_IMAGE_OPERATOR_PATH)%$(DEFAULT_IMAGE_OPERATOR_PATH)%' deploy/operator.yaml | ||
@$(SED) 's%$(E2E_CONTENT_IMAGE_PATH)%$(DEFAULT_CONTENT_IMAGE_PATH)%' deploy/operator.yaml | ||
|
||
# If IMAGE_FROM_CI is not defined, it means that we're not running on CI, so we | ||
|
@@ -389,13 +397,13 @@ deploy: namespace deploy-crds ## Deploy the operator from the manifests in the d | |
|
||
.PHONY: deploy-local | ||
deploy-local: namespace image-to-cluster deploy-crds ## Deploy the operator from the manifests in the deploy/ directory and the images from a local build | ||
$(SED) 's%$(IMAGE_REPO)/$(APP_NAME):latest%$(RELATED_IMAGE_OPERATOR_PATH)%' deploy/operator.yaml | ||
$(SED) 's%$(IMAGE_REPO)/$(RELATED_IMAGE_OPENSCAP_NAME):$(RELATED_IMAGE_OPENSCAP_TAG)%$(RELATED_IMAGE_OPENSCAP_PATH)%' deploy/operator.yaml | ||
@$(SED) 's%$(IMAGE_REPO)/$(APP_NAME):latest%$(RELATED_IMAGE_OPERATOR_PATH)%' deploy/operator.yaml | ||
@$(SED) 's%$(IMAGE_REPO)/$(RELATED_IMAGE_OPENSCAP_NAME):$(RELATED_IMAGE_OPENSCAP_TAG)%$(RELATED_IMAGE_OPENSCAP_PATH):$(RELATED_IMAGE_OPENSCAP_TAG)%' deploy/operator.yaml | ||
@oc apply -n $(NAMESPACE) -f deploy/ | ||
@oc apply -f deploy/olm-catalog/compliance-operator/manifests/monitoring_clusterrolebinding.yaml | ||
@oc apply -f deploy/olm-catalog/compliance-operator/manifests/monitoring_clusterrole.yaml | ||
@$(SED) 's%$(RELATED_IMAGE_OPERATOR_PATH)%$(IMAGE_REPO)/$(APP_NAME):latest%' deploy/operator.yaml | ||
@$(SED) 's%$(RELATED_IMAGE_OPENSCAP_PATH)%$(IMAGE_REPO)/$(RELATED_IMAGE_OPENSCAP_NAME):$(RELATED_IMAGE_OPENSCAP_TAG)%' deploy/operator.yaml | ||
@$(SED) 's%$(RELATED_IMAGE_OPENSCAP_PATH):$(RELATED_IMAGE_OPENSCAP_TAG)%$(IMAGE_REPO)/$(RELATED_IMAGE_OPENSCAP_NAME):$(RELATED_IMAGE_OPENSCAP_TAG)%' deploy/operator.yaml | ||
@oc set triggers -n $(NAMESPACE) deployment/compliance-operator --from-image openshift/compliance-operator:latest -c compliance-operator | ||
|
||
.PHONY: deploy-crds | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
FROM registry.access.redhat.com/ubi8/ubi-minimal | ||
|
||
COPY tests/data/ocp4-unexistent-resource.xml . | ||
ARG xml_path | ||
COPY $xml_path/* . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/usr/bin/env bash | ||
|
||
BUILD_PATH=images/testcontent | ||
DOCKERFILE=${BUILD_PATH}/broken-content.Dockerfile | ||
|
||
declare -a tags=( | ||
'unexistent_resource' | ||
'proff_diff_baseline' | ||
'proff_diff_mod' | ||
'rem_mod_base' | ||
'rem_mod_change' | ||
'broken_os_detection' | ||
'from' | ||
'to' | ||
'kubeletconfig' | ||
'variabletemplate' | ||
) | ||
|
||
CMD=$1 | ||
IMAGE_NAME=$2 | ||
|
||
if [[ "$CMD" != "build" ]] && [[ "$CMD" != "push" ]]; then | ||
echo "Invalid command '$CMD', it should be 'build' or 'push'" | ||
exit 1 | ||
fi | ||
|
||
for tag in "${tags[@]}" | ||
do | ||
if [[ "$CMD" == "build" ]]; then | ||
${RUNTIME} build -t ${IMAGE_NAME}:${tag} \ | ||
--build-arg xml_path=${BUILD_PATH}/${tag} \ | ||
-f ${DOCKERFILE} . | ||
else | ||
${RUNTIME} push ${IMAGE_NAME}:${tag} | ||
fi | ||
done |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do I see correctly that this variable definition is twice in the Makefile?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not the same variable: one for operator and one for openscap
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oups I see, DEFAULT_IMAGE_OPENSCAP_PATH declaration at line 2 was an extra paste. Need to be removed