Skip to content
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

[8.12](backport #3243) [Buildkite] Ignore non successful exit code in cloud-deploy target (test-cloude2e) #3309

Merged
merged 1 commit into from
Feb 23, 2024
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
11 changes: 5 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -386,13 +386,12 @@ test-e2e-set: ## - Run the blackbox end to end tests without setup.
##################################################
.PHONY: test-cloude2e
test-cloude2e: prepare-test-context ## - Run cloude2e tests with full setup (slow!)
@make -C ${CLOUD_TESTING_BASE} cloud-deploy
$(eval FLEET_SERVER_URL := $(shell make -C ${CLOUD_TESTING_BASE} cloud-get-fleet-url))
-@set -o pipefail; $(MAKE) test-cloude2e-set | tee build/test-cloude2e.out
@make -C ${CLOUD_TESTING_BASE} cloud-clean
@# Triggered using a shell script to ensure deployment is cleaned up even if errors (using trap).
@# it would also ensure to exit with failure if any error happens
@$(CLOUD_TESTING_BASE)/launch_cloud_e2e_tests.sh

.PHONY: test-cloude2e-set
test-cloude2e-set: ## Run cloude2e test
$(eval FLEET_SERVER_URL := $(shell make -C ${CLOUD_TESTING_BASE} cloud-get-fleet-url))
$(eval FLEET_SERVER_URL := $(shell make --no-print-directory -C ${CLOUD_TESTING_BASE} cloud-get-fleet-url))
make -C ${CLOUD_TESTING_BASE} cloud-get-fleet-url
FLEET_SERVER_URL=${FLEET_SERVER_URL} go test -v -tags=cloude2e -count=1 -race -p 1 ./testing/cloude2e
FLEET_SERVER_URL="${FLEET_SERVER_URL}" go test -v -tags=cloude2e -count=1 -race -p 1 ./testing/cloude2e
6 changes: 2 additions & 4 deletions dev-tools/cloud/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,5 @@ cloud-clean: ## Clean cloud deployment
@cd ${TERRAFORM_PATH}; terraform destroy -auto-approve

.PHONY: cloud-get-fleet-url
cloud-get-fleet-url: ## Clean cloud deployment
$(eval FLEET_SERVER_URL := $(shell terraform output --state=${TERRAFORM_PATH}/terraform.tfstate fleet_url))
@echo '${FLEET_SERVER_URL}'

cloud-get-fleet-url: ## Get Fleet URL from this deployment
@terraform output --raw --state=${TERRAFORM_PATH}/terraform.tfstate fleet_url
37 changes: 37 additions & 0 deletions dev-tools/cloud/launch_cloud_e2e_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env bash

set -euo pipefail

CLOUD_TESTING_BASE="$(dirname $0)"

cleanup() {
r=$?

echo "--- Cleaning deployment"
make -C "${CLOUD_TESTING_BASE}" cloud-clean

exit $r
}
trap cleanup EXIT INT TERM

echo "--- Creating deployment"
make -C "${CLOUD_TESTING_BASE}" cloud-deploy

# Ensure Fleet server URL is defined to run the tests
FLEET_SERVER_URL=$(make --no-print-directory -C "${CLOUD_TESTING_BASE}" cloud-get-fleet-url)
echo "Fleet server: \"${FLEET_SERVER_URL}\""
if [[ "${FLEET_SERVER_URL}" == "" ]]; then
message="FLEET_SERVER_URL is empty, cloud e2e tests cannot be executed"
if [[ "${CI}" == "true" ]]; then
buildkite-agent annotate \
"${message}" \
--context "ctx-cloude2e-test" \
--style "error"
fi
echo "${message}"
exit 0
fi

echo "--- Trigger cloud E2E test"
make test-cloude2e-set | tee build/test-cloude2e-set

Loading