diff --git a/hack/verify-starlark.sh b/hack/verify-starlark.sh index e2233306b99..c3511cef849 100755 --- a/hack/verify-starlark.sh +++ b/hack/verify-starlark.sh @@ -39,7 +39,7 @@ TMP_DIR=$(mktemp -d) OUT="${TMP_DIR}/out.log" # cleanup on exit -cleanup() { +capz::verify-starlark::cleanup() { ret=0 if [[ -s "${OUT}" ]]; then echo "Found errors:" @@ -52,7 +52,7 @@ cleanup() { rm -rf "${TMP_DIR}" exit ${ret} } -trap cleanup EXIT +trap capz::verify-starlark::cleanup EXIT BUILDIFIER="${SCRIPT_DIR}/tools/bin/buildifier/${VERSION}/buildifier" diff --git a/scripts/ci-build-azure-ccm.sh b/scripts/ci-build-azure-ccm.sh index e820ae216eb..049774e6d8a 100755 --- a/scripts/ci-build-azure-ccm.sh +++ b/scripts/ci-build-azure-ccm.sh @@ -90,13 +90,14 @@ can_reuse_artifacts() { echo "true" } -cleanup() { +capz::ci-build-azure-ccm::cleanup() { + echo "cloud-provider-azure cleanup" if [[ -d "${AZURE_CLOUD_PROVIDER_ROOT:-}" ]]; then make -C "${AZURE_CLOUD_PROVIDER_ROOT}" clean || true fi } -trap cleanup EXIT +trap capz::ci-build-azure-ccm::cleanup EXIT setup main diff --git a/scripts/ci-build-kubernetes.sh b/scripts/ci-build-kubernetes.sh index 20f2b5d86da..2100fc06391 100755 --- a/scripts/ci-build-kubernetes.sh +++ b/scripts/ci-build-kubernetes.sh @@ -155,13 +155,13 @@ can_reuse_artifacts() { echo "true" } -cleanup() { +capz::ci-build-kubernetes::cleanup() { if [[ -d "${KUBE_ROOT:-}" ]]; then make -C "${KUBE_ROOT}" clean || true fi } -trap cleanup EXIT +trap capz::ci-build-kubernetes::cleanup EXIT setup main diff --git a/scripts/ci-conformance.sh b/scripts/ci-conformance.sh index d60db06512e..476dbad5eb8 100755 --- a/scripts/ci-conformance.sh +++ b/scripts/ci-conformance.sh @@ -78,11 +78,11 @@ export WINDOWS="${WINDOWS:-false}" # Generate SSH key. capz::util::generate_ssh_key -cleanup() { +capz::ci-conformance::cleanup() { "${REPO_ROOT}/hack/log/redact.sh" || true } -trap cleanup EXIT +trap capz::ci-conformance::cleanup EXIT if [[ "${WINDOWS}" == "true" ]]; then make test-windows-upstream diff --git a/scripts/ci-e2e.sh b/scripts/ci-e2e.sh index fc04dc8ecd0..27fe519df40 100755 --- a/scripts/ci-e2e.sh +++ b/scripts/ci-e2e.sh @@ -77,11 +77,11 @@ export CALICO_VERSION capz::util::generate_ssh_key -cleanup() { +capz::ci-e2e::cleanup() { "${REPO_ROOT}/hack/log/redact.sh" || true } -trap cleanup EXIT +trap capz::ci-e2e::cleanup EXIT # Image is configured as `${CONTROLLER_IMG}-${ARCH}:${TAG}` where `CONTROLLER_IMG` is defaulted to `${REGISTRY}/${IMAGE_NAME}`. if [[ "${BUILD_MANAGER_IMAGE}" == "false" ]]; then # Load an existing image, skip docker-build and docker-push. diff --git a/scripts/ci-entrypoint.sh b/scripts/ci-entrypoint.sh index e9a0314e81b..e706ddb5a96 100755 --- a/scripts/ci-entrypoint.sh +++ b/scripts/ci-entrypoint.sh @@ -302,7 +302,7 @@ copy_secret() { rm azure_json } -on_exit() { +capz::ci-entrypoint::on_exit() { if [[ -n ${KUBECONFIG:-} ]]; then "${KUBECTL}" get nodes -o wide || echo "Unable to get nodes" "${KUBECTL}" get pods -A -o wide || echo "Unable to get pods" @@ -322,7 +322,7 @@ on_exit() { # setup all required variables and images setup -trap on_exit EXIT +trap capz::ci-entrypoint::on_exit EXIT export ARTIFACTS="${ARTIFACTS:-${PWD}/_artifacts}" # create cluster