-
Notifications
You must be signed in to change notification settings - Fork 3
/
ci_test.sh
executable file
·54 lines (47 loc) · 1.51 KB
/
ci_test.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
54
#!/bin/sh
set -eu
echo Environment:
echo JP_VALIDATOR_IMAGE=${JP_VALIDATOR_IMAGE:=javapackages-validator:2}
echo JP_VALIDATOR_OUTPUT_DIR=${JP_VALIDATOR_OUTPUT_DIR:=}
echo TEST_ARTIFACTS=${TEST_ARTIFACTS:=/tmp/test-artifacts}
echo JPV_CI_IMAGE=${JPV_CI_IMAGE:=quay.io/fedora-java/javapackages-validator-ci:2}
echo JPV_CI_TESTS_URL=${JPV_CI_TESTS_URL:=https://src.fedoraproject.org/tests/javapackages.git}
echo JPV_CI_TESTS_REF=${JPV_CI_TESTS_REF:=main}
set -x
build_local_image() {
podman build -f Dockerfile.main -t "${JP_VALIDATOR_IMAGE}"
}
download_ci_env() {
mkdir -p "${TEST_ARTIFACTS}"
podman run --privileged --mount type=bind,source="${TEST_ARTIFACTS}",target='/mnt/rpms' --rm -it "${JPV_CI_IMAGE}" '/mnt/rpms'
}
prepare_test_env() {
download_ci_env
}
execute() {
tmt --version
tmt -vvv \
--feeling-safe \
run --scratch \
--id "jpv-ci" \
-e TEST_ARTIFACTS="${TEST_ARTIFACTS}" \
-e JP_VALIDATOR_IMAGE="${JP_VALIDATOR_IMAGE}" \
-e JP_VALIDATOR_OUTPUT_DIR="${JP_VALIDATOR_OUTPUT_DIR}" \
discover --how fmf \
--url "${JPV_CI_TESTS_URL}" \
--ref "${JPV_CI_TESTS_REF}" \
provision --how local \
execute --how tmt \
--no-progress-bar \
report
}
if [ "${1}" = 'build-local-image' ]; then
build_local_image
elif [ "${1}" = 'prepare' ]; then
prepare_test_env
elif [ "${1}" = 'execute' ]; then
execute
else
echo "Unrecognized option: ${1}"
exit 1
fi