Skip to content
This repository was archived by the owner on Jun 26, 2024. It is now read-only.

Commit 7943cea

Browse files
committed
Collect and archive kube resources even when tests failed
Signed-off-by: Pavel Macík <[email protected]>
1 parent c40394f commit 7943cea

File tree

3 files changed

+92
-12
lines changed

3 files changed

+92
-12
lines changed

.github/workflows/pr-checks.yaml

Lines changed: 90 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ jobs:
6767
runs-on: ubuntu-20.04
6868

6969
env:
70-
EXTRA_BEHAVE_ARGS: "--tags=~@knative --tags=~@openshift --tags=~@examples --tags=~@supported-operator --tags=~@optional-annotations --tags=~@disable-github-actions"
70+
EXTRA_BEHAVE_ARGS: "--tags=~@knative --tags=~@openshift --tags=~@examples --tags=~@supported-operator --tags=~@optional-annotations --tags=~@workload-resource-mapping --tags=~@disable-github-actions"
7171
TEST_RUN: Acceptance_tests_Kubernetes_with_OLM
7272

7373
steps:
@@ -116,7 +116,7 @@ jobs:
116116
make SKIP_REGISTRY_LOGIN=true -o registry-login test-acceptance-with-bundle
117117
118118
- name: Collect Kube resources
119-
if: ${{ steps.check-skip-acceptance.outputs.can_skip != 'true' }}
119+
if: ${{ steps.check-skip-acceptance.outputs.can_skip != 'true' && always() }}
120120
continue-on-error: true
121121
uses: ./.github/actions/collect-kube-resources
122122
with:
@@ -137,7 +137,7 @@ jobs:
137137
testspace [${{ env.TEST_RUN }}]${{ env.TEST_RESULTS }}/TEST*.xml
138138
139139
- uses: actions/upload-artifact@v2
140-
if: ${{ steps.check-skip-acceptance.outputs.can_skip != 'true' }}
140+
if: ${{ steps.check-skip-acceptance.outputs.can_skip != 'true' && always() }}
141141
with:
142142
name: kubernetes-with-olm-test-results
143143
path: ${{ env.TEST_RESULTS }}
@@ -196,7 +196,7 @@ jobs:
196196
make SKIP_REGISTRY_LOGIN=true -o registry-login test-acceptance-with-bundle
197197
198198
- name: Collect Kube resources
199-
if: ${{ steps.check-skip-acceptance.outputs.can_skip != 'true' }}
199+
if: ${{ steps.check-skip-acceptance.outputs.can_skip != 'true' && always() }}
200200
continue-on-error: true
201201
uses: ./.github/actions/collect-kube-resources
202202
with:
@@ -217,12 +217,11 @@ jobs:
217217
testspace [${{ env.TEST_RUN }}]${{ env.TEST_RESULTS }}/TEST*.xml
218218
219219
- uses: actions/upload-artifact@v2
220-
if: ${{ steps.check-skip-acceptance.outputs.can_skip != 'true' }}
220+
if: ${{ steps.check-skip-acceptance.outputs.can_skip != 'true' && always() }}
221221
with:
222-
name: supported-operators-kubernetes
222+
name: optional-annotations
223223
path: ${{ env.TEST_RESULTS }}
224224

225-
226225
acceptance-supported-operators:
227226
name: Supported Operators Acceptance Tests with Kubernetes and using OLM
228227
runs-on: ubuntu-20.04
@@ -277,7 +276,7 @@ jobs:
277276
make SKIP_REGISTRY_LOGIN=true -o registry-login test-acceptance-with-bundle
278277
279278
- name: Collect Kube resources
280-
if: ${{ steps.check-skip-acceptance.outputs.can_skip != 'true' }}
279+
if: ${{ steps.check-skip-acceptance.outputs.can_skip != 'true' && always() }}
281280
continue-on-error: true
282281
uses: ./.github/actions/collect-kube-resources
283282
with:
@@ -298,11 +297,91 @@ jobs:
298297
testspace [${{ env.TEST_RUN }}]${{ env.TEST_RESULTS }}/TEST*.xml
299298
300299
- uses: actions/upload-artifact@v2
301-
if: ${{ steps.check-skip-acceptance.outputs.can_skip != 'true' }}
300+
if: ${{ steps.check-skip-acceptance.outputs.can_skip != 'true' && always() }}
302301
with:
303302
name: supported-operators-kubernetes
304303
path: ${{ env.TEST_RESULTS }}
305304

305+
acceptance-workload-resource-mapping:
306+
name: Workload Resource Mapping Acceptance Tests with Kubernetes and using OLM
307+
runs-on: ubuntu-20.04
308+
309+
env:
310+
EXTRA_BEHAVE_ARGS: "--tags=@workload-resource-mapping --tags=~@disable-github-actions"
311+
TEST_RUN: Workload_Resource_Mapping_Acceptance_tests_Kubernetes_with_OLM
312+
313+
steps:
314+
- name: Checkout Git Repository
315+
uses: actions/checkout@v2
316+
317+
- name: Check if acceptance tests can be skipped
318+
id: check-skip-acceptance
319+
uses: ./.github/actions/check-skip-acceptance-tests
320+
321+
- name: Set up Python
322+
if: ${{ steps.check-skip-acceptance.outputs.can_skip != 'true' }}
323+
uses: actions/setup-python@v2
324+
with:
325+
python-version: "3.7"
326+
architecture: "x64"
327+
328+
- name: Setup-cli
329+
if: ${{ steps.check-skip-acceptance.outputs.can_skip != 'true' }}
330+
uses: ./.github/actions/setup-cli
331+
with:
332+
start-minikube: true
333+
334+
- name: Wait for push
335+
if: ${{ steps.check-skip-acceptance.outputs.can_skip != 'true' }}
336+
uses: lewagon/wait-on-check-action@1b1630e169116b58a4b933d5ad7effc46d3d312d
337+
with:
338+
ref: ${{ github.event.pull_request.head.sha }}
339+
check-name: "Push operator images (PR)"
340+
repo-token: ${{ secrets.GITHUB_TOKEN }}
341+
wait-interval: 60
342+
343+
- name: Extract image references
344+
if: ${{ steps.check-skip-acceptance.outputs.can_skip != 'true' }}
345+
uses: marcofaggian/[email protected]
346+
with:
347+
names: operator-refs-${{github.event.pull_request.number}}-${{github.event.pull_request.head.sha}}
348+
349+
- name: Acceptance tests
350+
if: ${{ steps.check-skip-acceptance.outputs.can_skip != 'true' }}
351+
timeout-minutes: 60
352+
run: |
353+
source ./operator.refs
354+
export CATSRC_NAME=sbo-pr-checks
355+
356+
make SKIP_REGISTRY_LOGIN=true -o registry-login test-acceptance-with-bundle
357+
358+
- name: Collect Kube resources
359+
if: ${{ steps.check-skip-acceptance.outputs.can_skip != 'true' && always() }}
360+
continue-on-error: true
361+
uses: ./.github/actions/collect-kube-resources
362+
with:
363+
operator-namespace: operators
364+
olm-namespace: olm
365+
test-namespace-file: out/test-namespace
366+
output-path: ${{env.TEST_RESULTS}}
367+
368+
- name: Setup Testspace
369+
if: ${{ steps.check-skip-acceptance.outputs.can_skip != 'true' }}
370+
uses: testspace-com/setup-testspace@v1
371+
with:
372+
domain: ${{ github.repository_owner }}
373+
374+
- name: Publish tests results to Testspace
375+
if: ${{ steps.check-skip-acceptance.outputs.can_skip != 'true' }}
376+
run: |
377+
testspace [${{ env.TEST_RUN }}]${{ env.TEST_RESULTS }}/TEST*.xml
378+
379+
- uses: actions/upload-artifact@v2
380+
if: ${{ steps.check-skip-acceptance.outputs.can_skip != 'true' && always() }}
381+
with:
382+
name: workload-resource-mapping
383+
path: ${{ env.TEST_RESULTS }}
384+
306385
acceptance_without_olm:
307386
name: Acceptance tests running on Kubernetes without using OLM
308387
runs-on: ubuntu-20.04
@@ -374,7 +453,7 @@ jobs:
374453
make TEST_ACCEPTANCE_START_SBO=remote test-acceptance
375454
376455
- name: Collect Kube resources
377-
if: ${{ steps.check-skip-acceptance.outputs.can_skip != 'true' }}
456+
if: ${{ steps.check-skip-acceptance.outputs.can_skip != 'true' && always() }}
378457
continue-on-error: true
379458
uses: ./.github/actions/collect-kube-resources
380459
with:
@@ -394,7 +473,7 @@ jobs:
394473
testspace [${{ env.TEST_RUN }}]${{ env.TEST_RESULTS }}/TEST*.xml
395474
396475
- uses: actions/upload-artifact@v2
397-
if: ${{ steps.check-skip-acceptance.outputs.can_skip != 'true' }}
476+
if: ${{ steps.check-skip-acceptance.outputs.can_skip != 'true' && always() }}
398477
with:
399478
name: kubernetes-without-olm-test-results
400479
path: ${{ env.TEST_RESULTS }}

hack/collect-kube-resources.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ OPNS="$(kubectl get namespaces -o name | grep -E '.*/(.+-)?operators$' || test $
55
OPERATOR_NAMESPACE=${OPERATOR_NAMESPACE:-${OPNS#"namespace/"}}
66
OLM_NAMESPACE="${OLM_NAMESPACE:-$(kubectl get catalogsources.operators.coreos.com --all-namespaces -o jsonpath='{.items[0].metadata.namespace}' --ignore-not-found=true)}"
77
OUTPUT_PATH=${OUTPUT_PATH:-out/acceptance-tests/resources}
8-
TEST_NAMESPACE_FILE=${TEST_NAMESPACE_FILE:-$OUTPUT_DIR/test-namespace}
8+
TEST_NAMESPACE_FILE=${TEST_NAMESPACE_FILE:-out/test-namespace}
99
set +x
1010

1111
echo "Collecting Kubernetes resources..."

test/acceptance/features/workloadResourceMapping.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@workload-resource-mapping
12
Feature: Bind services to workloads based on workload resource mapping
23

34
As a user, I would like to be able to use workload resource bindings as defined by the specification.

0 commit comments

Comments
 (0)