|
1 | 1 | chain: |
2 | 2 | as: hypershift-conformance |
3 | 3 | steps: |
4 | | - - as: conformance-tests |
5 | | - from: tests |
6 | | - commands: |- |
7 | | - set -x |
8 | | -
|
9 | | - function cleanup() { |
10 | | - for child in $( jobs -p ); do |
11 | | - kill "${child}" |
12 | | - done |
13 | | - wait |
14 | | - } |
15 | | - trap cleanup EXIT |
16 | | -
|
17 | | - function patch_image_streams() { |
18 | | - # with OCP <= 4.17, |
19 | | - # imagestreams on the hosted cluster are ignoring |
20 | | - # the CA injected at creation/(installation) time. |
21 | | - # see: https://issues.redhat.com/browse/RFE-3093 |
22 | | - # and: https://github.com/openshift/enhancements/pull/416/commits/e46072ecf77b58c79b4bece5e0c6a5a5546a1b8a |
23 | | -
|
24 | | - OCP_MINOR_VERSION=$(oc version | grep "Server Version" | cut -d '.' -f2) |
25 | | - if [ "$OCP_MINOR_VERSION" -le "17" ]; then |
26 | | - echo "#### Add trust for the mirroring registry" |
27 | | - oc get cm -n openshift-config user-ca-bundle -o json | jq -r '.data["ca-bundle.crt"]' > /tmp/ca-bundle.crt |
28 | | - oc create configmap registry-config --from-file=${DS_REGISTRY//:/..}=/tmp/ca-bundle.crt -n openshift-config |
29 | | - oc patch image.config.openshift.io/cluster --patch '{"spec":{"additionalTrustedCA":{"name":"registry-config"}}}' --type=merge |
30 | | - else |
31 | | - oc --kubeconfig="${HYPERSHIFT_MANAGEMENT_CLUSTER_KUBECONFIG}" patch hostedclusters -n "${HYPERSHIFT_NAMESPACE}" "${CLUSTER_NAME}" --type='merge' -p '{"spec":{"configuration":{"image":{"additionalTrustedCA":{"name": "user-ca-bundle"}}}}}' |
32 | | - fi |
33 | | - sleep 60 |
34 | | - } |
35 | | -
|
36 | | - function mirror_test_images() { |
37 | | - echo "### Mirroring test images" |
38 | | - |
39 | | - DEVSCRIPTS_TEST_IMAGE_REPO=${DS_REGISTRY}/localimages/local-test-image |
40 | | -
|
41 | | - openshift-tests images --to-repository ${DEVSCRIPTS_TEST_IMAGE_REPO} > /tmp/mirror |
42 | | - scp "${SSHOPTS[@]}" /tmp/mirror "root@${IP}:/tmp/mirror" |
43 | | - |
44 | | - # shellcheck disable=SC2087 |
45 | | - ssh "${SSHOPTS[@]}" "root@${IP}" bash - << EOF |
46 | | - oc image mirror -f /tmp/mirror --registry-config ${DS_WORKING_DIR}/pull_secret.json |
47 | | - oc image mirror --registry-config ${DS_WORKING_DIR}/pull_secret.json --filter-by-os="linux/${ARCHITECTURE}.*" registry.k8s.io/pause:3.8 $DEVSCRIPTS_TEST_IMAGE_REPO:e2e-28-registry-k8s-io-pause-3-8-aP7uYsw5XCmoDy5W |
48 | | - oc image mirror --registry-config ${DS_WORKING_DIR}/pull_secret.json --filter-by-os="linux/${ARCHITECTURE}.*" registry.k8s.io/pause:3.9 $DEVSCRIPTS_TEST_IMAGE_REPO:e2e-27-registry-k8s-io-pause-3-9-p9APyPDU5GsW02Rk |
49 | | - oc image mirror --registry-config ${DS_WORKING_DIR}/pull_secret.json --filter-by-os="linux/${ARCHITECTURE}.*" registry.k8s.io/pause:3.9 $DEVSCRIPTS_TEST_IMAGE_REPO:e2e-28-registry-k8s-io-pause-3-9-p9APyPDU5GsW02Rk |
50 | | - oc image mirror --registry-config ${DS_WORKING_DIR}/pull_secret.json --filter-by-os="linux/${ARCHITECTURE}.*" registry.k8s.io/pause:3.10 $DEVSCRIPTS_TEST_IMAGE_REPO:e2e-27-registry-k8s-io-pause-3-10-b3MYAwZ_MelO9baY |
51 | | - oc image mirror --registry-config ${DS_WORKING_DIR}/pull_secret.json --filter-by-os="linux/${ARCHITECTURE}.*" registry.k8s.io/etcd:3.5.15-0 $DEVSCRIPTS_TEST_IMAGE_REPO:e2e-11-registry-k8s-io-etcd-3-5-15-0-W7c5qq4cz4EE20EQ |
52 | | - EOF |
53 | | -
|
54 | | - TEST_ARGS+=$(echo " --from-repository ${DEVSCRIPTS_TEST_IMAGE_REPO} ") |
55 | | -
|
56 | | - } |
57 | | -
|
58 | | - if [[ -z "${HOSTED_CP:-}" ]]; then |
59 | | - export CLUSTER_NAME="$(echo -n $PROW_JOB_ID|sha256sum|cut -c-20)" |
60 | | - export HYPERSHIFT_MANAGEMENT_CLUSTER_KUBECONFIG="${KUBECONFIG}" |
61 | | - export HYPERSHIFT_MANAGEMENT_CLUSTER_NAMESPACE="$(oc get hcp -A -o=jsonpath="{.items[?(@.metadata.name==\"$CLUSTER_NAME\")].metadata.namespace}")" |
62 | | - export HYPERSHIFT_NAMESPACE="$(oc get hostedclusters -A -o=jsonpath="{.items[?(@.metadata.name==\"$CLUSTER_NAME\")].metadata.namespace}")" |
63 | | - export AWS_SHARED_CREDENTIALS_FILE=/etc/hypershift-pool-aws-credentials/credentials |
64 | | - export KUBECONFIG=${SHARED_DIR}/nested_kubeconfig |
65 | | - [[ -n ${CLUSTER_PROFILE_DIR:-} ]] && export AZURE_AUTH_LOCATION=${CLUSTER_PROFILE_DIR}/osServicePrincipal.json |
66 | | - else |
67 | | - export KUBECONFIG=${SHARED_DIR}/kubeconfig |
68 | | - fi |
69 | | -
|
70 | | - # In order for openshift-tests to pull external binary images from the |
71 | | - # payload, we need access enabled to the images on the build farm. In |
72 | | - # order to do that, we need to unset the KUBECONFIG so we talk to the |
73 | | - # build farm, not the cluster under test. |
74 | | - echo "Granting access for image pulling from the build farm..." |
75 | | - KUBECONFIG_BAK=$KUBECONFIG |
76 | | - unset KUBECONFIG |
77 | | - oc adm policy add-role-to-group system:image-puller system:unauthenticated --namespace "${NAMESPACE}" |
78 | | - export KUBECONFIG=$KUBECONFIG_BAK |
79 | | -
|
80 | | - if [[ -n "${USE_HYPERSHIFT_AZURE_CREDS:-}" ]]; then |
81 | | - export AZURE_AUTH_LOCATION=/etc/hypershift-ci-jobs-azurecreds/credentials.json |
82 | | - fi |
83 | | -
|
84 | | - if [ -f "${SHARED_DIR}/proxy-conf.sh" ] ; then |
85 | | - source "${SHARED_DIR}/proxy-conf.sh" |
86 | | - fi |
87 | | - if [ -f "${SHARED_DIR}/ds-vars.conf" ] ; then |
88 | | - source "${SHARED_DIR}/ds-vars.conf" |
89 | | - fi |
90 | | - if [ -f "${SHARED_DIR}/packet-conf.sh" ] ; then |
91 | | - source "${SHARED_DIR}/packet-conf.sh" |
92 | | - fi |
93 | | -
|
94 | | - CLUSTER_TYPE="$(oc get infrastructure cluster -ojsonpath='{.status.platform}'|tr '[:upper:]' '[:lower:]')" |
95 | | - case "${CLUSTER_TYPE}" in |
96 | | - gcp) |
97 | | - PROJECT="$(oc get -o jsonpath='{.status.platformStatus.gcp.projectID}' infrastructure cluster)" |
98 | | - REGION="$(oc get -o jsonpath='{.status.platformStatus.gcp.region}' infrastructure cluster)" |
99 | | - export TEST_PROVIDER="{\"type\":\"gce\",\"region\":\"${REGION}\",\"multizone\": true,\"multimaster\":true,\"projectid\":\"${PROJECT}\"}" |
100 | | - ;; |
101 | | - aws|aws-arm64) |
102 | | - REGION="$(oc get -o jsonpath='{.status.platformStatus.aws.region}' infrastructure cluster)" |
103 | | - ZONE="$(oc get -o jsonpath='{.items[0].metadata.labels.failure-domain\.beta\.kubernetes\.io/zone}' nodes)" |
104 | | - export TEST_PROVIDER="{\"type\":\"aws\",\"region\":\"${REGION}\",\"zone\":\"${ZONE}\",\"multizone\":true,\"multimaster\":true}" |
105 | | - ;; |
106 | | - azure4|azure) |
107 | | - REGION="$(oc get -o jsonpath='{.items[0].metadata.labels.failure-domain\.beta\.kubernetes\.io/region}' nodes)" |
108 | | - ZONE="$(oc get -o jsonpath='{.items[0].metadata.labels.failure-domain\.beta\.kubernetes\.io/zone}' nodes)" |
109 | | - export TEST_PROVIDER="{\"type\":\"azure\",\"region\":\"${REGION}\",\"zone\":\"${ZONE}\"}" |
110 | | - ;; |
111 | | - azurestack) |
112 | | - export TEST_PROVIDER="none" |
113 | | - ;; |
114 | | - vsphere) |
115 | | - export TEST_PROVIDER=vsphere;; |
116 | | - alibabacloud) |
117 | | - REGION="$(oc get -o jsonpath='{.status.platformStatus.alibabacloud.region}' infrastructure cluster)" |
118 | | - export TEST_PROVIDER="{\"type\":\"alibabacloud\",\"region\":\"${REGION}\",\"multizone\":true,\"multimaster\":true}" |
119 | | - export KUBE_SSH_USER=core |
120 | | - ;; |
121 | | - openstack*) |
122 | | - # shellcheck disable=SC1090 |
123 | | - source "${SHARED_DIR}/cinder_credentials.sh" |
124 | | - if test -n "${HTTP_PROXY:-}" -o -n "${HTTPS_PROXY:-}"; then |
125 | | - export TEST_PROVIDER='{"type":"openstack","disconnected":true}' |
126 | | - else |
127 | | - export TEST_PROVIDER='{"type":"openstack"}' |
128 | | - fi |
129 | | - ;; |
130 | | - ovirt) export TEST_PROVIDER='{"type":"ovirt"}';; |
131 | | - none) |
132 | | - if [[ "${DISCONNECTED}" == "true" ]]; then |
133 | | - mirror_test_images |
134 | | - patch_image_streams |
135 | | - export TEST_PROVIDER='{"type":"baremetal","disconnected":true}' |
136 | | - else |
137 | | - export TEST_PROVIDER='{"type":"baremetal"}' |
138 | | - fi |
139 | | - ;; |
140 | | - ibmcloud) |
141 | | - export TEST_PROVIDER='{"type":"ibmcloud"}' |
142 | | - IC_API_KEY="$(< "${CLUSTER_PROFILE_DIR}/ibmcloud-api-key")" |
143 | | - export IC_API_KEY |
144 | | - ;; |
145 | | - kubevirt) |
146 | | - if [[ "${DISCONNECTED}" == "true" ]]; |
147 | | - then |
148 | | - mirror_test_images |
149 | | - patch_image_streams |
150 | | - export TEST_PROVIDER='{"type":"kubevirt","disconnected":true}' |
151 | | - else |
152 | | - export TEST_PROVIDER='{"type":"kubevirt"}' |
153 | | - fi |
154 | | - ;; |
155 | | - *) echo >&2 "Unsupported cluster type '${CLUSTER_TYPE}'"; exit 1;; |
156 | | - esac |
157 | | -
|
158 | | - if [[ "${TEST_SUITE}" == "openshift/conformance/parallel/minimal" ]]; then |
159 | | - TEST_SKIPS="${TEST_SKIPS:+${TEST_SKIPS}\|}\[Suite:openshift/conformance/parallel\]" |
160 | | - TEST_SUITE="openshift/conformance/parallel" |
161 | | - fi |
162 | | -
|
163 | | - if [[ -n "${TEST_CSI_DRIVER_MANIFEST}" ]]; then |
164 | | - export TEST_CSI_DRIVER_FILES=${SHARED_DIR}/${TEST_CSI_DRIVER_MANIFEST} |
165 | | - fi |
166 | | -
|
167 | | - if [[ -n "${TEST_INCLUDES}" ]]; then |
168 | | - TESTS="$(openshift-tests run --dry-run --provider "${TEST_PROVIDER}" "${TEST_SUITE}")" |
169 | | - echo "${TESTS}" | grep "${TEST_INCLUDES}" >/tmp/test_includes |
170 | | - fi |
171 | | -
|
172 | | - if [[ -n "${TEST_SKIPS}" ]]; then |
173 | | - TESTS="$(openshift-tests run --dry-run --provider "${TEST_PROVIDER}" "${TEST_SUITE}")" |
174 | | - echo "${TESTS}" | grep -v "${TEST_SKIPS}" >/tmp/tests |
175 | | - if [[ -n "${TEST_INCLUDES}" ]]; then |
176 | | - TEST_SKIPS_SPECIFIC=$(echo "$TEST_SKIPS" | sed 's/\\\[Suite:openshift\/conformance\/parallel\\\]$//') |
177 | | - TEST_SKIPS_SPECIFIC="${TEST_SKIPS_SPECIFIC%\\|}" |
178 | | - cat /tmp/test_includes | grep -v "${TEST_SKIPS_SPECIFIC:-placeholder_no_match}" >>/tmp/tests |
179 | | - fi |
180 | | -
|
181 | | - echo "Skipping tests:" |
182 | | - echo "${TESTS}" | grep -vxFf /tmp/tests || { exit_code=$?; echo 'Error: no tests were found matching the TEST_SKIPS regex:'; echo "$TEST_SKIPS"; return $exit_code; } |
183 | | - TEST_ARGS="${TEST_ARGS:-} --file /tmp/tests" |
184 | | - fi |
185 | | -
|
186 | | - sleep 6h |
187 | | - openshift-tests run ${TEST_SUITE} ${TEST_ARGS:-} \ |
188 | | - --provider "${TEST_PROVIDER}" \ |
189 | | - -o "${ARTIFACT_DIR}/e2e.log" \ |
190 | | - --junit-dir "${ARTIFACT_DIR}/junit" 2>&1 | tee /tmp/openshift-tests.log |
191 | | - |
192 | | - exit_code=${PIPESTATUS[0]} |
193 | | - |
194 | | - # If this line is shown in the openshift-tests output, all of the conformance test cases passed, |
195 | | - # but the monitor test has failed. Currently we're ignoring MonitorTest failures until we resolve: |
196 | | - # https://issues.redhat.com/browse/CNV-33717 |
197 | | - if [[ -n "${SKIP_MONITOR_TEST}" ]] && [[ $(grep "failed due to a MonitorTest failure" /tmp/openshift-tests.log) ]]; |
198 | | - then |
199 | | - echo "overriding Monitor Test Failure" |
200 | | - exit_code=0 |
201 | | - fi |
202 | | - |
203 | | - exit ${exit_code} |
204 | | -
|
205 | | - credentials: |
206 | | - - mount_path: /etc/hypershift-pool-aws-credentials |
207 | | - name: hypershift-pool-aws-credentials |
208 | | - namespace: test-credentials |
209 | | - - mount_path: /etc/hypershift-ci-jobs-azurecreds |
210 | | - name: hypershift-ci-jobs-azurecreds |
211 | | - namespace: test-credentials |
212 | | - timeout: 14400s |
213 | | - grace_period: 30m0s |
214 | | - env: |
215 | | - - name: TEST_ARGS |
216 | | - default: "" |
217 | | - documentation: |- |
218 | | - Additional arguments to be passed to 'openshift-test' |
219 | | - - name: TEST_SUITE |
220 | | - default: openshift/conformance/parallel |
221 | | - documentation: |- |
222 | | - The test suite to run. Defaults to openshift/conformance/parallel |
223 | | - - name: TEST_SKIPS |
224 | | - default: "" |
225 | | - documentation: | |
226 | | - Regular expression (POSIX basic regular expression) of tests to skip. |
227 | | - It is suggested to test the regex to make sure that it matches with the available tests. |
228 | | - Tests can be listed by using 'openshift-tests run --dry-run (...)'. Sometimes, the tests |
229 | | - that are printed in Prow won't exactly match the list returned by openshift-tests. |
230 | | - - name: TEST_INCLUDES |
231 | | - default: "" |
232 | | - documentation: | |
233 | | - Regular expression (POSIX basic regular expression) of tests to include, |
234 | | - even if these tests were matched in the TEST_SKIPS expression. |
235 | | - - name: SKIP_MONITOR_TEST |
236 | | - default: "" |
237 | | - documentation: |- |
238 | | - if non-empty, ignores job failure which is as a result of a failure of the MonitorTest suite. |
239 | | - All conformance test cases need to pass for the job to pass, though. |
240 | | - - name: DISCONNECTED |
241 | | - default: "false" |
242 | | - documentation: Should we work on top of a disconnected environment |
243 | | - - name: ARCHITECTURE |
244 | | - default: "amd64" |
245 | | - documentation: Set the architecture for disconnected conformance (amd64, arm64, ppc64le, s390x) |
246 | | - - name: USE_HYPERSHIFT_AZURE_CREDS |
247 | | - default: "false" |
248 | | - documentation: "Whether to use hypershift-ci-jobs-azurecreds secret for Azure credentials. Set to 'true' to use the secret. Set to 'false' to use the default credentials." |
249 | | - - name: TEST_CSI_DRIVER_MANIFEST |
250 | | - default: "" |
251 | | - documentation: |- |
252 | | - Name of the CSI driver manifest file to use. Used by the `openshift-tests` |
253 | | - program as TEST_CSI_DRIVER_FILES env. var., see its documentation for |
254 | | - details. The file must be present in ${SHARED_DIR}. |
255 | | - - name: HOSTED_CP |
256 | | - default: "" |
257 | | - documentation: Execute against a ROSA hosted control plane |
258 | | - resources: |
259 | | - requests: |
260 | | - cpu: "3" |
261 | | - memory: 600Mi |
| 4 | + - ref: hypershift-conformance |
| 5 | + documentation: |- |
| 6 | + Execute openshift conformance tests for hypershift. |
0 commit comments