-
Notifications
You must be signed in to change notification settings - Fork 22
/
trigger-openqa_in_openqa
executable file
·73 lines (62 loc) · 2.47 KB
/
trigger-openqa_in_openqa
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/bash -ex
# Trigger tests on an openQA instance testing openQA itself.
#
# Can be configured by variables.
set -euo pipefail
# shellcheck source=/dev/null
. "$(dirname "$0")"/_common
# configuration variables with defaults.
target_host="${target_host:-"openqa.opensuse.org"}"
target_host_proto="${target_host_proto:-"https"}"
dry_run="${dry_run:-"0"}"
tw_openqa_host="${tw_openqa_host:-"https://openqa.opensuse.org"}"
tw_group_id="${tw_group_id:-"1"}"
openqa_cli="${openqa_cli:-"openqa-cli"}"
arch="${arch:-"x86_64"}"
machine="${machine:-"64bit"}"
build_tag=${BUILD_TAG:-}
client_prefix=${client_prefix:-}
full_run=${FULL:-}
group_id="${group_id:-"openQA"}"
main() {
[ "$dry_run" = "1" ] && client_prefix="echo"
local qcow build
download_scenario
download_latest_published_tumbleweed_image
trigger
}
download_latest_published_tumbleweed_image() {
qcow=$(find_latest_published_tumbleweed_image "$tw_group_id" "$arch" "$machine" qcow)
if [ "$target_host_proto://$target_host" != "$tw_openqa_host" ]; then
url="${tw_openqa_host}/assets/hdd/${qcow}"
# instead of manual wget it should also work to provide a whitelisted url to openqa as HDD_1_URL which should then download it itself but a first experiment didn't work
${client_prefix} wget -c "$url" -O /var/lib/openqa/factory/hdd/"$qcow"
fi
# ensure the build tag conforms to coolo's unwritten rules for the openQA dashboard
build=$(echo "$build_tag" | sed -e "s/jenkins-trigger-openQA_in_openQA-/:/" -e "s/-/./g")
}
download_scenario() {
rm -f /var/tmp/sd.yaml
curl https://raw.githubusercontent.com/os-autoinst/os-autoinst-distri-openQA/master/scenario-definitions.yaml -o /var/tmp/sd.yaml
}
trigger() {
# prevent host access problem when running within o3 infrastructure
# where o3 is not reachable over https
declare -a ARGS
if [ "$target_host" = "openqa.opensuse.org" ]; then
ARGS=("OPENQA_HOST=http://openqa.opensuse.org")
fi
# in full run use only openqa_install+publish test
if [ "$full_run" ]; then
ARGS+=('TEST=openqa_install+publish' "FULL_OPENSUSE_TEST=1")
fi
${client_prefix} "${openqa_cli}" \
schedule --host "${target_host_proto}://${target_host}" \
--param-file SCENARIO_DEFINITIONS_YAML=/var/tmp/sd.yaml \
VERSION=Tumbleweed \
DISTRI=openqa FLAVOR=dev ARCH="${arch}" \
HDD_1="$qcow" BUILD="${build}" _GROUP="${group_id}" \
"${ARGS[@]}" \
| tee job_post_response
}
main