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-pre-checks.sh
executable file
·53 lines (42 loc) · 1.9 KB
/
run-pre-checks.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
53
#!/usr/bin/env bash
set -euxo pipefail
readonly script_directory="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
readonly project_directory="$(realpath -L "${script_directory}")"
readonly artifacts_directory="${DS_TEST_ARTIFACTS_DIRECTORY:-${project_directory}/kuttl-tests}"
mkdir -p "${artifacts_directory}"
# We need to ignore the suffix for the purpose of checking templates.
IMAGE_DISAMBIGUATION_SUFFIX="" "${project_directory}/tools/compile_templates.sh" --check-only
"${project_directory}/tools/docker.sh" "${project_directory}/tools/generate_parameters_markdown.py"
"${project_directory}/tools/docker.sh" "${project_directory}/tools/format_files.sh"
source "${project_directory}/metadata.sh"
cd "${project_directory}"
set +x
if [ -n "$(git status --porcelain)" ]; then
echo "Changes found after running one of the previous steps." >&2
echo "Please make sure you follow the instructions in .github/pull_request_template.md" >&2
echo "before sending a pull request." >&2
git status --porcelain
git diff
exit 1
fi
# run unit tests for bootstrap binary
docker run \
--rm \
-v "${project_directory}:${project_directory}" \
-w "${project_directory}"/images/bootstrap \
"${INTEGRATION_TESTS_DOCKER_IMAGE}" \
bash -c "make test"
mkdir -p "${artifacts_directory}"/kuttl-dist
echo "Saving KUTTL artifacts to ${artifacts_directory}/kuttl-dist"
# Note: DS_KUDO_VERSION is used by the shared data-services-kudo tooling.
# run KUTTL tests in ./kuttl-tests directory
docker run \
--rm \
-v "${project_directory}:${project_directory}" \
-v "${artifacts_directory}/kuttl-dist:${project_directory}/kuttl-tests/kuttl-dist" \
-w "${project_directory}"/kuttl-tests \
--env-file <(env | grep BUILD_VCS_NUMBER_) \
-e "DS_KUDO_VERSION=${DS_KUDO_VERSION}" \
--privileged --network host -v /var/run/docker.sock:/var/run/docker.sock \
"${INTEGRATION_TESTS_DOCKER_IMAGE}" \
bash -c "make kind-test"