This repository has been archived by the owner on Oct 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
run-tests.sh
executable file
·52 lines (43 loc) · 2.22 KB
/
run-tests.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env bash
# shellcheck disable=SC2039
set -euxo pipefail
readonly script_directory="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
readonly project_directory="$(realpath -L $script_directory)"
# shellcheck source=metadata.sh
source "${project_directory}/metadata.sh"
if [[ -n ${IMAGE_DISAMBIGUATION_SUFFIX:-} ]]; then
# Refresh templated files to pick up the suffix, if explicitly set.
"${project_directory}/tools/docker.sh" \
env "IMAGE_DISAMBIGUATION_SUFFIX=${IMAGE_DISAMBIGUATION_SUFFIX}" \
"${project_directory}/tools/compile_templates.sh"
fi
readonly kubeconfig="${KUBECONFIG:-${HOME}/.kube/config}"
readonly artifacts_directory="${DS_TEST_ARTIFACTS_DIRECTORY:-${project_directory}/artifacts}"
mkdir -p "${artifacts_directory}"
readonly container_kubeconfig="/root/.kube/config"
readonly container_project_directory="/${PROJECT_NAME}"
readonly container_operator_directory="${container_project_directory}/operator"
readonly container_vendor_directory="${container_project_directory}/shared/vendor"
readonly container_artifacts_directory="${container_project_directory}/artifacts"
# Note: DS_KUDO_VERSION is used by the shared data-services-kudo tooling.
docker run \
--rm \
-e "KUBECONFIG=${container_kubeconfig}" \
-e "KUBECTL_PATH=${container_vendor_directory}/kubectl.sh" \
-e "DS_KUDO_VERSION=${DS_KUDO_VERSION}" \
-e "OPERATOR_DIRECTORY=${container_operator_directory}" \
-e "VENDOR_DIRECTORY=${container_vendor_directory}" \
-e "IMAGE_DISAMBIGUATION_SUFFIX=${IMAGE_DISAMBIGUATION_SUFFIX:-}" \
-e "TEST_ARTIFACTS_DIRECTORY=${container_artifacts_directory}" \
-e "AWS_ACCESS_KEY_ID" \
-e "AWS_SECRET_ACCESS_KEY" \
-e "BUILD_NUMBER" \
-e "TEAMCITY_PROJECT_NAME" \
-v "${kubeconfig}:${container_kubeconfig}:ro" \
-v "${OPERATOR_DIRECTORY}:${container_operator_directory}" \
-v "${project_directory}:${container_project_directory}" \
-v "${VENDOR_DIRECTORY}:${container_vendor_directory}" \
-v "${artifacts_directory}:${container_artifacts_directory}" \
-w "${container_project_directory}" \
"${INTEGRATION_TESTS_DOCKER_IMAGE}" \
bash -c "${container_project_directory}/tests/run.sh"