Skip to content

Commit 6db39ad

Browse files
committed
test actions/download-artifact@v4
Signed-off-by: Adrian Riobo Lorenzo <[email protected]>
1 parent 3956e85 commit 6db39ad

File tree

2 files changed

+15
-175
lines changed

2 files changed

+15
-175
lines changed

.github/workflows/windows-e2e.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88

99
jobs:
1010
windows-e2e-ocp:
11-
uses: crc-org/crc/.github/workflows/windows-qe-tpl.yml@main
11+
uses: adrianriobo/crc/.github/workflows/windows-qe-tpl.yml@main
1212
strategy:
1313
fail-fast: false
1414
matrix:
@@ -22,7 +22,7 @@ jobs:
2222
- qe-type: 'integration'
2323
preset: 'microshift'
2424
with:
25-
trigger-workflow-id: ${{ github.event.workflow_run.workflow_id }}
25+
trigger-workflow-run-id: ${{ github.event.workflow_run.id }}
2626
qe-type: ${{matrix.qe-type}}
2727
preset: ${{matrix.preset}}
2828
secrets: inherit

.github/workflows/windows-qe-tpl.yml

+13-173
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ name: windows-qe-tpl
55
on:
66
workflow_call:
77
inputs:
8-
trigger-workflow-id:
8+
trigger-workflow-run-id:
9+
description: run-id of the workflow which originate the execution and where the artifacts have been built
910
required: true
1011
type: string
1112
qe-type:
@@ -31,187 +32,26 @@ jobs:
3132
steps:
3233
- name: Download gh context
3334
id: download-gh-context-artifact
34-
uses: dawidd6/action-download-artifact@v3
35+
uses: actions/download-artifact@v4
3536
with:
36-
workflow: ${{inputs.trigger-workflow-id}}
3737
name: gh-context
38+
run-id: ${{inputs.trigger-workflow-run-id}}
39+
github-token: ${{ github.token }}
3840

3941
- name: Download windows installer
4042
id: download-windows-installer-artifact
41-
uses: dawidd6/action-download-artifact@v3
43+
uses: actions/download-artifact@v4
4244
with:
43-
workflow: ${{inputs.trigger-workflow-id}}
4445
name: windows-installer
45-
46+
run-id: ${{inputs.trigger-workflow-run-id}}
47+
github-token: ${{ github.token }}
48+
4649
- name: Download qe oci image
4750
id: download-qe-oci-image-artifact
48-
uses: dawidd6/action-download-artifact@v3
51+
uses: actions/download-artifact@v4
4952
with:
50-
workflow: ${{inputs.trigger-workflow-id}}
5153
name: crc-${{inputs.qe-type}}-windows-amd64
54+
run-id: ${{inputs.trigger-workflow-run-id}}
55+
github-token: ${{ github.token }}
5256

53-
- name: Correlate
54-
env:
55-
PULL_SECRET: ${{ secrets.PULL_SECRET }}
56-
run: |
57-
# Get origin commit sha for testing
58-
commit_sha=$(cat gh_context.json | jq -r '.event.after')
59-
if [[ -z "${commit_sha}" ]]; then
60-
# on first PR creation .event.after is empty, then .sha is used as commit instead
61-
commit_sha=$(cat gh_context.json | jq -r '.sha')
62-
fi
63-
echo "commit_sha=${commit_sha}" >> "$GITHUB_ENV"
64-
65-
# Set status_context
66-
status_context="ci/gh/${{inputs.qe-type}}"
67-
if [[ "${{inputs.qe-type}}" == "e2e" ]]; then
68-
status_context="${status_context}-${{inputs.preset}}"
69-
fi
70-
status_context="${status_context}/windows-${{matrix.windows-version}}-${{matrix.windows-featurepack}}"
71-
echo "status_context=${status_context}" >> "$GITHUB_ENV"
72-
73-
# Save pull-secret as file
74-
echo "${PULL_SECRET}" > pull-secret
75-
76-
- name: Add status to the PR check
77-
run: |
78-
set -xuo
79-
# Status msg
80-
data="{\"state\":\"pending\""
81-
data="${data},\"description\":\"Running ${{inputs.qe-type}}-${{inputs.preset}} on Windows\""
82-
data="${data},\"context\":\"${{ env.status_context }}\""
83-
data="${data},\"target_url\":\"https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\"}"
84-
# Create status by API call
85-
curl -L -v -X POST \
86-
-H "Accept: application/vnd.github+json" \
87-
-H "Authorization: Bearer ${{ github.token }}" \
88-
https://api.github.com/repos/${{ github.repository }}/statuses/${{ env.commit_sha }} \
89-
-d "${data}"
90-
91-
- name: Create Windows instance
92-
run: |
93-
# Create instance
94-
podman run -d --name windows-create --rm \
95-
-v ${PWD}:/workspace:z \
96-
-e ARM_TENANT_ID=${{secrets.ARM_TENANT_ID}} \
97-
-e ARM_SUBSCRIPTION_ID=${{secrets.ARM_SUBSCRIPTION_ID}} \
98-
-e ARM_CLIENT_ID=${{secrets.ARM_CLIENT_ID}} \
99-
-e ARM_CLIENT_SECRET='${{secrets.ARM_CLIENT_SECRET}}' \
100-
-e AZURE_STORAGE_ACCOUNT='${{ secrets.AZURE_STORAGE_ACCOUNT }}' \
101-
-e AZURE_STORAGE_KEY='${{ secrets.AZURE_STORAGE_KEY }}' \
102-
quay.io/rhqp/qenvs:v0.6.3 azure \
103-
windows create \
104-
--project-name 'windows-desktop-${{ matrix.windows-version }}-${{ matrix.windows-featurepack }}-${{inputs.qe-type}}-${{inputs.preset}}' \
105-
--backed-url azblob://crc-qenvs-state/${{ env.commit_sha }} \
106-
--conn-details-output '/workspace' \
107-
--windows-version '${{matrix.windows-version}}' \
108-
--windows-featurepack '${{matrix.windows-featurepack}}' \
109-
--tags project=openshift-local,source=github,org=${{github.repository_owner}} \
110-
--spot
111-
podman logs -f windows-create
112-
113-
- name: Install CRC on host
114-
run: |
115-
podman run --rm -d --name crc-win-support \
116-
-e TARGET_HOST=$(cat host) \
117-
-e TARGET_HOST_USERNAME=$(cat username) \
118-
-e TARGET_HOST_KEY_PATH=/data/id_rsa \
119-
-e TARGET_FOLDER=crc-support \
120-
-e TARGET_CLEANUP='false' \
121-
-e OUTPUT_FOLDER=/data \
122-
-e DEBUG='true' \
123-
-v ${PWD}:/data:z \
124-
-v ${PWD}/crc-windows-installer.zip:/opt/crc-support/crc-windows-installer.zip:z \
125-
quay.io/rhqp/crc-support:v0.5-windows crc-support/run.ps1 \
126-
-targetPath "/Users/$(cat username)/crc-support" \
127-
-download 'false' \
128-
-install 'true' \
129-
-forceFresh 'false'
130-
podman logs -f crc-win-support
131-
132-
- name: Run CRC ${{inputs.qe-type}}
133-
run: |
134-
# load image
135-
podman load -i crc-${{inputs.qe-type}}-windows-amd64.tar
136-
# run
137-
cmd="crc-qe/run.ps1 -junitFilename crc-${{inputs.qe-type}}-junit.xml -targetFolder crc-qe"
138-
if [[ "${{inputs.qe-type}}" == "e2e" ]]; then
139-
if [[ "${{inputs.preset}}" == "microshift" ]]; then
140-
cmd="${cmd} -e2eTagExpression '@story_microshift'"
141-
else
142-
cmd="${cmd} -e2eTagExpression '~@minimal && ~@story_microshift'"
143-
fi
144-
fi
145-
podman run --rm -d --name crc-${{inputs.qe-type}} \
146-
-e TARGET_HOST=$(cat host) \
147-
-e TARGET_HOST_USERNAME=$(cat username) \
148-
-e TARGET_HOST_KEY_PATH=/data/id_rsa \
149-
-e TARGET_FOLDER=crc-qe \
150-
-e TARGET_RESULTS=results \
151-
-e OUTPUT_FOLDER=/data \
152-
-e DEBUG=true \
153-
-v $PWD/pull-secret:/opt/crc/pull-secret:z \
154-
-v $PWD:/data:z \
155-
quay.io/crcont/crc-${{inputs.qe-type}}:gh-windows-amd64 \
156-
${cmd}
157-
podman logs -f crc-${{inputs.qe-type}}
158-
159-
- name: Test Report
160-
id: test-report
161-
uses: mikepenz/action-junit-report@v4
162-
if: always()
163-
with:
164-
fail_on_failure: true
165-
include_passed: true
166-
detailed_summary: true
167-
require_tests: true
168-
report_paths: '**/*.xml'
169-
170-
- name: Upload ${{inputs.qe-type}} results
171-
uses: actions/upload-artifact@v4
172-
if: always()
173-
with:
174-
name: windows-${{inputs.qe-type}}-${{inputs.preset}}-${{matrix.windows-version}}${{matrix.windows-featurepack}}
175-
path: |
176-
**/*.xml
177-
**/*.results
178-
**/*.log
179-
180-
- name: Update status of the PR check
181-
if: always()
182-
run: |
183-
set -xuo
184-
# Status msg
185-
data="{\"state\":\"success\""
186-
if [[ ${{steps.test-report.outcome}} != "success" ]]; then
187-
data="{\"state\":\"failure\""
188-
fi
189-
data="${data},\"description\":\"Finished ${{inputs.qe-type}}-${{inputs.preset}} on Windows\""
190-
data="${data},\"context\":\"${{ env.status_context }}\""
191-
data="${data},\"target_url\":\"https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\"}"
192-
# Create status by API call
193-
curl -L -v -X POST \
194-
-H "Accept: application/vnd.github+json" \
195-
-H "Authorization: Bearer ${{ github.token }}" \
196-
https://api.github.com/repos/${{ github.repository }}/statuses/${{ env.commit_sha }} \
197-
-d "${data}"
198-
199-
- name: Destroy instance
200-
if: always()
201-
run: |
202-
# Make sure lock is removed
203-
rm -rf .pulumi/locks/*
204-
# Destroy
205-
podman run -d --name windows-destroy --rm \
206-
-v ${PWD}:/workspace:z \
207-
-e ARM_TENANT_ID=${{secrets.ARM_TENANT_ID}} \
208-
-e ARM_SUBSCRIPTION_ID=${{secrets.ARM_SUBSCRIPTION_ID}} \
209-
-e ARM_CLIENT_ID=${{secrets.ARM_CLIENT_ID}} \
210-
-e ARM_CLIENT_SECRET='${{secrets.ARM_CLIENT_SECRET}}' \
211-
-e AZURE_STORAGE_ACCOUNT='${{ secrets.AZURE_STORAGE_ACCOUNT }}' \
212-
-e AZURE_STORAGE_KEY='${{ secrets.AZURE_STORAGE_KEY }}' \
213-
quay.io/rhqp/qenvs:v0.6.3 azure \
214-
windows destroy \
215-
--project-name 'windows-desktop-${{ matrix.windows-version }}-${{ matrix.windows-featurepack }}-${{inputs.qe-type}}-${{inputs.preset}}' \
216-
--backed-url azblob://crc-qenvs-state/${{ env.commit_sha }}
217-
podman logs -f windows-destroy
57+

0 commit comments

Comments
 (0)