-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
180 lines (175 loc) · 6.03 KB
/
.gitlab-ci.yml
File metadata and controls
180 lines (175 loc) · 6.03 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
---
# https://docs.gitlab.com/ci/yaml/workflow/
workflow:
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
- if: $CI_PIPELINE_SOURCE == "web"
variables:
# override these by CI variables if needed
ENABLE_FIPS:
description: Enable FIPS mode in testing farm. Set to empty to disable FIPS
value: --insert --order 0 --how feature --fips enabled
options:
- --insert --order 0 --how feature --fips enabled
- ""
PLAN_FILTER:
description: Predefined plan filters for testing farm. Default is empty
which means run all plans.
value: ""
options:
- ""
- "name:.*ci-tests"
TEST_FILTER:
description: Predefined test filters for testing farm. Default is empty
which means run all test.
value: ""
options:
- ""
- "tag:prevent_dev_mistakes"
- "tag:distcheck"
- "tag:rpm_build"
- "tag:pcsd_integration_test_standalone"
- "tag:pcsd_integration_test_cockpit"
TFCLI_PLAN_FILTER:
description: Set to $PLAN_FILTER to use a predefined plan filter or specify
a custom one.
value: $PLAN_FILTER
TFCLI_TEST_FILTER:
description: Set to $TEST_FILTER to use a predefined test filter or specify
a custom one.
value: $TEST_FILTER
TFCLI_TMT_PREPARE: $ENABLE_FIPS
TF_REQUEST_ID_FILE: /tmp/tf_request_id-$CI_JOB_ID
TF_EXIT_CODE_FILE: /tmp/tf_exit_code-$CI_JOB_ID
ARTIFACTS_DIRS: rpms dist test-records pcsd_logs
# https://docs.gitlab.com/ci/yaml/#parallelmatrix
# COPMOSE_NAME
# * values must use only letters and numbers because they are used as part
# of rpm name
# * must be kept short because they are used in job names
# * other pipelines use a job name to download the job's artifacts
# TF_COMPOSE
# * name of a testing farm compose
# * list of composes:
# https://api.testing-farm.io/v0.1/composes/public
# https://api.testing-farm.io/v0.1/composes/redhat
# TMT_DISTRO
# * value for the tmt context variable distro:
# https://tmt.readthedocs.io/en/stable/spec/context.html
# https://fmf.readthedocs.io/en/latest/context.html
#
.parallel:
parallel:
matrix:
- COMPOSE_NAME:
- Rhel10Next
- Rhel10CurrentRelease
- FedoraCurrentRelease
- Rhel9Next
- Rhel9CurrentRelease
rules:
- if: $COMPOSE_NAME == "Rhel10Next"
variables:
TF_COMPOSE: RHEL-10.2-Nightly
TMT_DISTRO: rhel-10.2
PCS_BRANCH: "main"
PCS_ARTIFACTS_URL: "${CI_API_V4_URL}/projects/pcs%2Fpcs/jobs/\
artifacts/${PCS_BRANCH}/download?\
job=tf_tests%3A%20%5B${COMPOSE_NAME}%5D"
- if: $COMPOSE_NAME == "Rhel10CurrentRelease"
variables:
TF_COMPOSE: RHEL-10.1-Nightly
TMT_DISTRO: rhel-10.1
PCS_BRANCH: main
PCS_ARTIFACTS_URL: "${CI_API_V4_URL}/projects/pcs%2Fpcs/jobs/\
artifacts/${PCS_BRANCH}/download?\
job=tf_tests%3A%20%5B${COMPOSE_NAME}%5D"
- if: $COMPOSE_NAME == "FedoraCurrentRelease"
variables:
TF_COMPOSE: Fedora-43
TMT_DISTRO: fedora-43
PCS_BRANCH: main
PCS_ARTIFACTS_URL: "${CI_API_V4_URL}/projects/pcs%2Fpcs/jobs/\
artifacts/${PCS_BRANCH}/download?\
job=tf_tests%3A%20%5B${COMPOSE_NAME}%5D"
# FIPS is not supported on Fedora
TFCLI_TMT_PREPARE: ""
- if: $COMPOSE_NAME == "Rhel9Next"
variables:
TF_COMPOSE: RHEL-9.8.0-Nightly
TMT_DISTRO: rhel-9.8
PCS_BRANCH: pcs-0.11
PCS_ARTIFACTS_URL: "${CI_API_V4_URL}/projects/pcs%2Fpcs/jobs/\
artifacts/${PCS_BRANCH}/download?\
job=tf_tests%3A%20%5B${COMPOSE_NAME}%5D"
- if: $COMPOSE_NAME == "Rhel9CurrentRelease"
variables:
TF_COMPOSE: RHEL-9.7.0-Nightly
TMT_DISTRO: rhel-9.7
PCS_BRANCH: pcs-0.11
PCS_ARTIFACTS_URL: "${CI_API_V4_URL}/projects/pcs%2Fpcs/jobs/\
artifacts/${PCS_BRANCH}/download?\
job=tf_tests%3A%20%5B${COMPOSE_NAME}%5D"
.download_artifacts_from_tf: &download_artifacts_from_tf
- UUID_REGEX="[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}"
- REQUEST_ID=$(sed -n -E "s/.*($UUID_REGEX).*/\1/p" output.txt | head -n 1)
- echo "$REQUEST_ID" > "$TF_REQUEST_ID_FILE"
- echo "Testing Farm request id is $REQUEST_ID"
- EXIT_CODE=0
- testing-farm watch --id "$REQUEST_ID" || EXIT_CODE=$?
- echo $EXIT_CODE > "$TF_EXIT_CODE_FILE"
- >
curl --insecure --location --remote-name \
"https://artifacts.osci.redhat.com/testing-farm/$REQUEST_ID/results.xml"
- >
for ARTIFACT_DIR in $ARTIFACTS_DIRS; do
for ARTIFACT_URL in $(
xmllint \
--xpath "//log[starts-with(@name, 'data/$ARTIFACT_DIR')]/@href" \
results.xml \
| sed "s/.*=\"\(.*\)\"/\1/"
); do
echo $ARTIFACT_URL >&2;
curl --insecure --remote-name --create-dirs --no-clobber \
--output-dir "$ARTIFACT_DIR" "$ARTIFACT_URL";
done
done
- exit $EXIT_CODE
tf_tests:
extends: .parallel
image: $SHARED_RUNNER_CONTAINER_IMAGE
script:
- testing-farm request
--git-url
https://gitlab-ci-token:$CI_JOB_TOKEN@$CI_SERVER_HOST/$CI_PROJECT_PATH
--git-ref $CI_COMMIT_REF_NAME
--compose $TF_COMPOSE
--context distro=$TMT_DISTRO
--context initiator=gitlab-ci
--secret CI_JOB_TOKEN="$CI_JOB_TOKEN"
--environment PCS_ARTIFACTS_URL="$PCS_ARTIFACTS_URL"
--plan-filter "$TFCLI_PLAN_FILTER"
--test-filter "$TFCLI_TEST_FILTER"
--tmt-prepare "$TFCLI_TMT_PREPARE"
--no-wait
| tee output.txt
- *download_artifacts_from_tf
after_script:
- REQUEST_ID=$(<"$TF_REQUEST_ID_FILE")
- EXIT_CODE=$(<"$TF_EXIT_CODE_FILE")
- echo "CI_JOB_STATUS=$CI_JOB_STATUS EXIT_CODE=$EXIT_CODE"
- >
if [[ "$CI_JOB_STATUS" != "success" && "$EXIT_CODE" != "1" ]]; then \
echo "Canceling testing farm request $REQUEST_ID"; \
testing-farm cancel "$REQUEST_ID"; \
fi
tags:
- $SHARED_RUNNER_TAG
artifacts:
expire_in: 1 week
when: always
paths:
- rpms
- dist
- test-records
- pcsd_logs