-
Notifications
You must be signed in to change notification settings - Fork 119
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
165 lines (160 loc) · 5.25 KB
/
.gitlab-ci.yml
File metadata and controls
165 lines (160 loc) · 5.25 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
---
# Keep the previos behavior when jobs are not run in merge request pipelines.
# https://docs.gitlab.com/ci/jobs/job_rules/#avoid-duplicate-pipelines
# https://docs.gitlab.com/ci/yaml/workflow/
# https://docs.gitlab.com/ci/pipelines/merge_request_pipelines/
workflow:
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
when: never
- when: always
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:.*linters"
- "name:.*tier0"
- "name:.*tier1"
- 'name:.*linters\|.*tier0'
TEST_FILTER:
description: Predefined test filters for testing farm. Default is empty
which means run all test.
value: ""
options:
- ""
- 'name:(?!.*python_tier1_tests).*' # skip python_tier1_tests
- "tag:distcheck"
- "tag:lint"
- "tag:python"
- "tag:rpm_build"
- "tag:ruby"
- "tag:smoke"
- "tag:tier0"
- "tag:tier1"
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
# 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
- FedoraNext
rules:
- if: $COMPOSE_NAME == "Rhel10Next"
variables:
TF_COMPOSE: RHEL-10.3-Nightly
TMT_DISTRO: rhel-10.3
- if: $COMPOSE_NAME == "Rhel10CurrentRelease"
variables:
TF_COMPOSE: RHEL-10.2-Nightly
TMT_DISTRO: rhel-10.2
- if: $COMPOSE_NAME == "FedoraCurrentRelease"
variables:
TF_COMPOSE: Fedora-44
TMT_DISTRO: fedora-44
# FIPS is not supported on Fedora
TFCLI_TMT_PREPARE: ""
- if: $COMPOSE_NAME == "FedoraNext"
allow_failure: true
variables:
TF_COMPOSE: Fedora-Rawhide
# set fedora-9999 to avoid bumping every release
TMT_DISTRO: fedora-9999
# FIPS is not supported on Fedora
TFCLI_TMT_PREPARE: ""
.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 rpms dist var/log/pcsd; 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 \
--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
--environment COMPOSE_NAME=$COMPOSE_NAME
--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
paths:
- rpms
- dist
- var/log/pcsd