Skip to content

Commit 1af1620

Browse files
committed
[QE] update github action for linux arm64 tests
1 parent c86d75d commit 1af1620

File tree

2 files changed

+86
-41
lines changed

2 files changed

+86
-41
lines changed

.github/workflows/linux-qe-template.yml

Lines changed: 85 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,14 @@ on:
1616

1717
jobs:
1818
linux-qe:
19-
runs-on: [self-hosted, linux, testing-farm]
19+
runs-on: ubuntu-24.04
2020
permissions:
2121
statuses: write # needed to update commit status (pending/failure/sucess)
2222
checks: write # as documented in https://github.com/mikepenz/action-junit-report?tab=readme-ov-file#pr-run-permissions
2323
steps:
24+
- name: Check out repository code
25+
uses: actions/checkout@v4
26+
2427
- name: Download gh context
2528
id: download-gh-context-artifact
2629
uses: actions/download-artifact@v4
@@ -31,7 +34,10 @@ jobs:
3134

3235
- name: prepare
3336
run: |
34-
sudo yum install podman openssh-server -y
37+
# Install Testing farm CLI
38+
pip3 install --user tft-cli
39+
sudo apt install podman openssh-server -y
40+
testing-farm --help
3541
3642
# Get origin commit sha for testing
3743
commit_sha=$(cat gh_context.json | jq -r '.event.after')
@@ -46,10 +52,17 @@ jobs:
4652
if [[ "${{inputs.qe-type}}" == "e2e" ]]; then
4753
status_context="${status_context}-${{inputs.preset}}"
4854
fi
49-
status_context="${status_context}/windows-${{matrix.windows-version}}-${{matrix.windows-featurepack}}"
55+
status_context="${status_context}/Linux-ARM64"
5056
echo "status_context=${status_context}" >> "$GITHUB_ENV"
5157
52-
echo "${PULL_SECRET}" > pull-secret
58+
ocp_version_line=$(cat Makefile | grep "OPENSHIFT_VERSION ?=")
59+
ocp_bundle_v=${ocp_version_line##*= }
60+
echo "ocp_bundle_v=${ocp_bundle_v}" >> "$GITHUB_ENV"
61+
echo "ocp_bundle_v=${ocp_bundle_v}"
62+
microshift_version_line=$(cat Makefile | grep "MICROSHIFT_VERSION ?=")
63+
microshift_bundle_v=${microshift_version_line##*= }
64+
echo "microshift_bundle_v=${microshift_bundle_v}" >> "$GITHUB_ENV"
65+
echo "microshift_bundle_v=${microshift_bundle_v}"
5366
5467
- name: Download linux binary
5568
uses: actions/download-artifact@v4
@@ -86,82 +99,115 @@ jobs:
8699
TESTING_FARM_API_TOKEN: ${{ secrets.TESTING_FARM_API_TOKEN }}
87100
PULL_SECRET: ${{ secrets.PULL_SECRET }}
88101
run: |
102+
echo "${PULL_SECRET}" > pull-secret
103+
89104
# the target can only be accessed through a bastion (which can only be accessed from self-hosted runner)
90105
# as so we need to map the ssh-agent from the host to the containers used to access the target host
91-
rm -f id_rsa id_rsa.pub
92-
ssh-keygen -t rsa -N '' -f id_rsa -q
106+
107+
#rm -f id_rsa id_rsa.pub
108+
ssh-keygen -t rsa -N '' -f ~/.ssh/id_rsa -q
109+
cp ~/.ssh/id_rsa .
93110
eval $(ssh-agent -s)
94111
echo $SSH_AUTH_SOCK > ssh_auth_sock
95112
echo $SSH_AGENT_PID > ssh_agent_pid
96113
ssh-add id_rsa
97114
98115
# reserve machine from testing farm
99116
export TESTING_FARM_API_TOKEN=${TESTING_FARM_API_TOKEN}
100-
testing-farm reserve --compose Fedora-40 --duration 240 --arch aarch64 --hardware memory='>= 12 GB' --hardware virtualization.is-supported='true' --ssh-public-key id_rsa.pub --no-autoconnect | tee info
117+
testing-farm reserve --compose Fedora-40 --duration 480 --arch aarch64 --hardware memory='>= 16 GB' --hardware virtualization.is-supported='true' --no-autoconnect | tee info
101118
machine=`tail -n 1 info`
102119
echo ${machine##*@} > host
103120
echo crctest > username
104-
echo proxy > bastion_username
105-
echo testing-farm.io > bastion_host
106121
request=`sed -n '4p' info`
107122
echo ${request:1} > requestid
108123
109124
# Create a non-root user for testing on the reserved machine
110-
${machine:1} 'useradd crctest' < /dev/null
111-
${machine:1} 'echo "crctest:redhat" | chpasswd' < /dev/null
112-
${machine:1} 'usermod -aG wheel crctest' < /dev/null
113-
${machine:1} 'echo "crctest ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/crctest-users' < /dev/null
114-
${machine:1} 'mkdir -p /home/crctest/.ssh' < /dev/null
115-
${machine:1} 'cp /root/.ssh/authorized_keys /home/crctest/.ssh/' < /dev/null
116-
${machine:1} 'chown crctest /home/crctest/.ssh/authorized_keys' < /dev/null
125+
ssh_cmd="ssh -o StrictHostKeyChecking=no ${machine##*ssh}"
126+
echo $ssh_cmd
127+
$ssh_cmd 'useradd crctest' < /dev/null
128+
$ssh_cmd 'echo "crctest:redhat" | chpasswd' < /dev/null
129+
$ssh_cmd 'usermod -aG wheel crctest' < /dev/null
130+
$ssh_cmd 'echo "crctest ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/crctest-users' < /dev/null
131+
$ssh_cmd 'mkdir -p /home/crctest/.ssh' < /dev/null
132+
$ssh_cmd 'cp /root/.ssh/authorized_keys /home/crctest/.ssh/' < /dev/null
133+
$ssh_cmd 'chown -R crctest:crctest /home/crctest/.ssh/' < /dev/null
117134
118135
# Install CRC on the reserved machine
136+
echo "Start installing crc on reserved machine"
119137
podman run --rm -d --privileged --name crc-linux-install-${{inputs.qe-type}}-${{inputs.preset}} \
120138
-e TARGET_HOST=$(cat host) \
121139
-e TARGET_HOST_USERNAME=$(cat username) \
122140
-e TARGET_HOST_KEY_PATH=/data/id_rsa \
123-
-e BASTION_HOST_USERNAME=$(cat bastion_username) \
124-
-e BASTION_HOST=$(cat bastion_host) \
125141
-e TARGET_FOLDER=crc-support \
126142
-e TARGET_CLEANUP='false' \
127143
-e OUTPUT_FOLDER=/data \
128144
-e DEBUG='true' \
129-
-e SSH_AUTH_SOCK=$(cat ssh_auth_sock) \
130-
-v "$(cat ssh_auth_sock):$(cat ssh_auth_sock)" \
131145
-v ${PWD}:/data:z \
132146
-v ${PWD}/crc:/opt/crc-support/crc:z \
133147
quay.io/crc-org/ci-crc-support:v2.0.0-dev-linux crc-support/run.sh \
134-
-targetPath "/root/crc-support" \
148+
-targetPath "/home/crctest/crc-support" \
135149
-install 'true' \
136150
-aName 'crc' \
137151
-freshEnv 'false' \
138152
-download 'false'
139153
podman logs -f crc-linux-install-${{inputs.qe-type}}-${{inputs.preset}}
140154
155+
# Download arm64 bundle in the reserved machine
156+
echo "Start download bundle on reserved machine"
157+
158+
if [[ "${{inputs.preset}}" == "microshift" ]]; then
159+
bundle_url="https://crcqe-asia.s3.ap-south-1.amazonaws.com/bundles/microshift/${{ env.microshift_bundle_v }}-arm64"
160+
bundle_name="crc_microshift_libvirt_${{ env.microshift_bundle_v }}_arm64.crcbundle"
161+
else
162+
bundle_url="https://crcqe-asia.s3.ap-south-1.amazonaws.com/bundles/openshift/${{ env.ocp_bundle_v }}-arm64"
163+
bundle_name="crc_libvirt_${{ env.ocp_bundle_v }}_arm64.crcbundle"
164+
fi
165+
podman run --rm -d --privileged --name download_bundle \
166+
-e TARGET_HOST=$(cat host) \
167+
-e TARGET_HOST_USERNAME=$(cat username) \
168+
-e TARGET_HOST_KEY_PATH=/data/id_rsa \
169+
-e TARGET_FOLDER=crc-support \
170+
-e TARGET_CLEANUP='false' \
171+
-e OUTPUT_FOLDER=/data \
172+
-e DEBUG='true' \
173+
-v ${PWD}:/data:z \
174+
quay.io/crc-org/ci-crc-support:v2.0.0-dev-linux crc-support/run.sh \
175+
-targetPath "/home/crctest" \
176+
-install 'false' \
177+
-aBaseURL $bundle_url \
178+
-aName $bundle_name \
179+
-freshEnv 'false' \
180+
-download 'true'
181+
podman logs -f download_bundle
182+
141183
# load image
142184
podman load -i crc-${{inputs.qe-type}}-linux-arm64.tar
185+
$ssh_cmd 'chmod +x /usr/local/bin/crc' < /dev/null
143186
144187
# run CRC test
145-
cmd="crc-qe/run.sh -junitFilename crc-${{inputs.qe-type}}-junit.xml -targetFolder crc-qe"
188+
cmd="crc-qe/run.sh -bundleLocation /home/crctest/$bundle_name -junitFilename crc-${{inputs.qe-type}}-junit.xml -targetFolder crc-qe"
146189
if [[ "${{inputs.qe-type}}" == "e2e" ]]; then
147190
if [[ "${{inputs.preset}}" == "microshift" ]]; then
148191
cmd="${cmd} -e2eTagExpression '@story_microshift'"
149192
else
150-
cmd="${cmd} -e2eTagExpression '~@minimal && ~@story_microshift'"
193+
cmd="${cmd} -e2eTagExpression '~@minimal && ~@story_microshift && ~@cert_rotation'"
194+
fi
195+
else
196+
if [[ "${{inputs.preset}}" == "microshift" ]]; then
197+
cmd="${cmd} -labelFilter 'microshift-preset'"
198+
else
199+
cmd="${cmd} -labelFilter 'openshift-preset'"
151200
fi
152201
fi
202+
echo "Start running test on reserved machine"
153203
podman run --rm -d --privileged --name crc-${{inputs.qe-type}}-${{inputs.preset}} \
154204
-e TARGET_HOST=$(cat host) \
155205
-e TARGET_HOST_USERNAME=$(cat username) \
156206
-e TARGET_HOST_KEY_PATH=/data/id_rsa \
157-
-e BASTION_HOST_USERNAME=$(cat bastion_username) \
158-
-e BASTION_HOST=$(cat bastion_host) \
159207
-e TARGET_FOLDER=crc-qe \
160208
-e TARGET_RESULTS=results \
161209
-e OUTPUT_FOLDER=/data \
162210
-e DEBUG=true \
163-
-e SSH_AUTH_SOCK=$(cat ssh_auth_sock) \
164-
-v "$(cat ssh_auth_sock):$(cat ssh_auth_sock)" \
165211
-v $PWD/pull-secret:/opt/crc/pull-secret:z \
166212
-v $PWD:/data:z \
167213
quay.io/crcont/crc-${{inputs.qe-type}}:gh-linux-arm64 \
@@ -189,6 +235,17 @@ jobs:
189235
**/*.results
190236
**/*.log
191237
238+
- name: Return machine and clear env
239+
env:
240+
TESTING_FARM_API_TOKEN: ${{ secrets.TESTING_FARM_API_TOKEN }}
241+
if: always()
242+
run: |
243+
export TESTING_FARM_API_TOKEN=${TESTING_FARM_API_TOKEN}
244+
testing-farm cancel $(cat requestid)
245+
podman rmi quay.io/crcont/crc-${{inputs.qe-type}}:gh-linux-arm64
246+
rm -r results
247+
kill $(cat ssh_agent_pid)
248+
192249
- name: Update status of the PR check
193250
if: always()
194251
run: |
@@ -208,12 +265,7 @@ jobs:
208265
https://api.github.com/repos/${{ github.repository }}/statuses/${{ env.commit_sha }} \
209266
-d "${data}"
210267
211-
- name: Return machine and clear env
212-
env:
213-
TESTING_FARM_API_TOKEN: ${{ secrets.TESTING_FARM_API_TOKEN }}
214-
run: |
215-
export TESTING_FARM_API_TOKEN=${TESTING_FARM_API_TOKEN}
216-
testing-farm cancel $(cat requestid)
268+
217269

218270

219271

.github/workflows/linux-qe-test.yml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,7 @@ jobs:
1717
fail-fast: false
1818
matrix:
1919
qe-type: ['e2e','integration']
20-
preset: ['openshift', 'microshift', 'all']
21-
exclude:
22-
- qe-type: 'e2e'
23-
preset: 'all'
24-
- qe-type: 'integration'
25-
preset: 'openshift'
26-
- qe-type: 'integration'
27-
preset: 'microshift'
20+
preset: ['openshift', 'microshift']
2821
with:
2922
trigger-workflow-run-id: ${{ github.event.workflow_run.id }}
3023
qe-type: ${{matrix.qe-type}}

0 commit comments

Comments
 (0)