Skip to content

Commit e8d9364

Browse files
committed
[testing] Migrate some of the CI to GH Workflow
Related: #4288 Signed-off-by: Arif Ali <arif-ali@ubuntu.com>
1 parent fcc6a5f commit e8d9364

7 files changed

Lines changed: 399 additions & 160 deletions

File tree

.cirrus.yml

Lines changed: 5 additions & 160 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,13 @@ env:
1010
DEBIAN_12_NAME: "debian-12"
1111
DEBIAN_11_NAME: "debian-11"
1212

13-
UBUNTU_DEVEL_NAME: "ubuntu-26.04"
14-
UBUNTU_LATEST_NAME: "ubuntu-25.10"
15-
UBUNTU_2404_NAME: "ubuntu-24.04"
16-
UBUNTU_2204_NAME: "ubuntu-22.04"
17-
1813
CENTOS_9_NAME: "centos-stream-9"
1914
CENTOS_10_NAME: "centos-stream-10"
2015

2116
CENTOS_PROJECT: "centos-cloud"
2217
DEBIAN_PROJECT: "debian-cloud"
2318
FEDORA_PROJECT: "fedora-cloud"
2419
SOS_PROJECT: "sos-devel-jobs"
25-
UBUNTU_PROJECT: "ubuntu-os-cloud"
26-
UBUNTU_DEVEL_PROJECT: "ubuntu-os-cloud-devel"
2720

2821
# Images exist on GCP already
2922
CENTOS_9_FAMILY_NAME: "centos-stream-9"
@@ -34,13 +27,6 @@ env:
3427
FEDORA_FAMILY_NAME: "fedora-cloud-42-x86-64"
3528
FEDORA_PRIOR_FAMILY_NAME: "fedora-cloud-41-x86-64"
3629

37-
UBUNTU_DEVEL_FAMILY_NAME: "ubuntu-2604-lts-amd64"
38-
UBUNTU_DEB_FAMILY_NAME: "ubuntu-minimal-2510-amd64"
39-
UBUNTU_LATEST_FAMILY_NAME: "ubuntu-2510-amd64"
40-
UBUNTU_SNAP_FAMILY_NAME: "ubuntu-2404-lts-amd64"
41-
UBUNTU_2404_FAMILY_NAME: "ubuntu-2404-lts-amd64"
42-
UBUNTU_2204_FAMILY_NAME: "ubuntu-2204-lts"
43-
4430
# Curl-command prefix for downloading task artifacts, simply add the
4531
# the url-encoded task name, artifact name, and path as a suffix.
4632
# This approach originally seen in the podman project.
@@ -57,48 +43,9 @@ auto_cancellation: true
5743

5844
gcp_credentials: ENCRYPTED[!77d4c8251094346c41db63cb05eba2ff98eaff04e58c5d0e2a8e2c6f159f7d601b3fe9a2a4fce1666297e371f2fc8752!]
5945

60-
# Run a simple lint on the community cluster
61-
flake8_task:
62-
skip: &man-changes-include "changesIncludeOnly('man/**', 'docs/**', 'po/**')"
63-
alias: "flake8_test"
64-
name: "Flake8 linting test"
65-
container:
66-
image: "python:latest"
67-
setup_script: &tox-lint-setup |
68-
apt update
69-
apt -y install tox
70-
flake_script: tox -e flake8
71-
72-
pylint_task:
73-
skip: *man-changes-include
74-
alias: "pylint_test"
75-
name: "pylint linting test"
76-
container:
77-
image: "python:latest"
78-
setup_script: *tox-lint-setup
79-
pylint_script: tox -e pylint
80-
81-
# Run a check on newer upstream python versions to check for possible
82-
# breaks/changes in common modules. This is not meant to check any of the actual
83-
# collections or archive integrity.
84-
py_break_task:
85-
skip: *man-changes-include
86-
alias: "py_break"
87-
name: "Breakage test python-$PY_VERSION"
88-
container:
89-
image: "python:${PY_VERSION}"
90-
matrix:
91-
- env:
92-
PY_VERSION: "latest"
93-
- env:
94-
PY_VERSION: "3.9"
95-
# This image has 2 py environments. Install to the one sos uses.
96-
setup_script: pip3 install -t /usr/lib/python3/dist-packages -r requirements.txt
97-
main_script: ./bin/sos report --batch
98-
9946
# Make sure a user can manually build an rpm from the checkout
10047
rpm_build_task:
101-
skip: *man-changes-include
48+
skip: &man-changes-include "changesIncludeOnly('man/**', 'docs/**', 'po/**')"
10249
alias: "rpm_build"
10350
name: "rpm Build From Checkout - ${BUILD_NAME}"
10451
gce_instance: &standardvm
@@ -163,10 +110,6 @@ deb_build_task:
163110
PROJECT: ${DEBIAN_PROJECT}
164111
BUILD_NAME: ${DEBIAN_13_NAME}
165112
VM_FAMILY_NAME: ${DEBIAN_13_FAMILY_NAME}
166-
- env: &ubuntu-latest-deb-pkg
167-
PROJECT: ${UBUNTU_PROJECT}
168-
BUILD_NAME: ${UBUNTU_LATEST_NAME}
169-
VM_FAMILY_NAME: ${UBUNTU_DEB_FAMILY_NAME}
170113
setup_script: |
171114
[[ ${BUILD_NAME} == "${DEBIAN_11_NAME}" ]] && sudo sed -i '/-backports/ s/^/#/' /etc/apt/sources.list
172115
apt update --allow-releaseinfo-change
@@ -182,77 +125,27 @@ deb_build_task:
182125
path: ./sos_${BUILD_NAME}.deb
183126
type: application/octet-stream
184127

185-
# Make sure a user can manually build a snap from the checkout
186-
snap_build_task:
187-
skip: *man-changes-include
188-
alias: "snap_build"
189-
name: "snap Build From Checkout"
190-
gce_instance:
191-
image_project: "${UBUNTU_PROJECT}"
192-
image_family: "${UBUNTU_SNAP_FAMILY_NAME}"
193-
type: e2-medium
194-
setup_script: |
195-
apt update
196-
apt -y install snapd
197-
systemctl start snapd
198-
sed -i -e 's/adopt-info.*/version: test/g' -e '/set version/d' snap/snapcraft.yaml
199-
snap install snapcraft --classic
200-
main_script: |
201-
snapcraft --destructive-mode
202-
packages_artifacts:
203-
path: "*.snap"
204-
on_failure:
205-
fail_script: |
206-
ls -d /root/.cache/snapcraft/log 2> /dev/null | xargs tar cf snap-build-fail-logs.tar
207-
log_artifacts:
208-
path: "snap-build-fail-logs.tar"
209-
210128
# Run the stage one (no mocking) tests across all distros on GCP
211129
report_stageone_task:
212130
skip: *man-changes-include
213131
alias: "stageone_report"
214132
name: "Report Stage One - $BUILD_NAME"
215133
depends_on:
216134
- rpm_build
217-
- snap_build
218135
- deb_build
219136
gce_instance: *standardvm
220137
matrix:
221138
- env: *centos9
222139
# - env: *fedora
223140
# - env: *fedoraprior
224-
- env: &ubuntu-2404
225-
PKG: "snap"
226-
PROJECT: ${UBUNTU_PROJECT}
227-
BUILD_NAME: "${UBUNTU_2404_NAME} - ${PKG}"
228-
VM_FAMILY_NAME: ${UBUNTU_2404_FAMILY_NAME}
229-
- env: &ubuntu-2204
230-
PKG: "snap"
231-
PROJECT: ${UBUNTU_PROJECT}
232-
BUILD_NAME: "${UBUNTU_2204_NAME} - ${PKG}"
233-
VM_FAMILY_NAME: ${UBUNTU_2204_FAMILY_NAME}
234-
- env: &ubuntu-latest-snap
235-
PKG: "snap"
236-
PROJECT: ${UBUNTU_PROJECT}
237-
BUILD_NAME: "${UBUNTU_LATEST_NAME} - ${PKG}"
238-
VM_FAMILY_NAME: ${UBUNTU_LATEST_FAMILY_NAME}
239-
- env: &ubuntu-latest-deb
240-
<<: *ubuntu-latest-deb-pkg
241-
PKG: "deb"
242-
BUILD_NAME: "${UBUNTU_LATEST_NAME} - ${PKG}"
243-
DEB_BUILD_NAME: ${UBUNTU_LATEST_NAME}
244-
VM_FAMILY_NAME: ${UBUNTU_LATEST_FAMILY_NAME}
245141
- env: &debian-13
246142
<<: *debian-13-deb-pkg
247-
PKG: "deb"
248143
DEB_BUILD_NAME: ${BUILD_NAME}
249144
- env: &debian-12
250145
<<: *debian-12-deb-pkg
251-
PKG: "deb"
252146
DEB_BUILD_NAME: ${BUILD_NAME}
253147
- env: &debian-11
254148
<<: *debian-11-deb-pkg
255-
PKG: "deb"
256149
DEB_BUILD_NAME: ${BUILD_NAME}
257150
setup_script: &setup |
258151
if [ $(command -v apt) ]; then
@@ -261,19 +154,10 @@ report_stageone_task:
261154
[[ "$(dpkg -l sosreport)" ]] && apt -y purge sosreport ubuntu-server
262155
apt update --allow-releaseinfo-change
263156
apt -y install python3-pip ethtool python3-systemd
264-
if [ ${PKG} == "snap" ] ; then
265-
apt -y install snapd
266-
echo "$ARTCURL/snap%20Build%20From%20Checkout/packages/sosreport_test_amd64.snap"
267-
$ARTCURL/snap%20Build%20From%20Checkout/packages/sosreport_test_amd64.snap
268-
systemctl start snapd
269-
snap install ./sosreport_test_amd64.snap --classic --dangerous
270-
snap alias sosreport.sos sos
271-
elif [ ${PKG} == "deb" ]; then
272-
echo "$ARTCURL/deb%20Build%20From%20Checkout%20-%20${DEB_BUILD_NAME}/packages/sos_${DEB_BUILD_NAME}.deb"
273-
$ARTCURL/deb%20Build%20From%20Checkout%20-%20${DEB_BUILD_NAME}/packages/sos_${DEB_BUILD_NAME}.deb
274-
apt -y install ./sos_${DEB_BUILD_NAME}.deb
275-
sed -i 's/\(127.0.1.1\)/#\1/g' /etc/hosts
276-
fi
157+
echo "$ARTCURL/deb%20Build%20From%20Checkout%20-%20${DEB_BUILD_NAME}/packages/sos_${DEB_BUILD_NAME}.deb"
158+
$ARTCURL/deb%20Build%20From%20Checkout%20-%20${DEB_BUILD_NAME}/packages/sos_${DEB_BUILD_NAME}.deb
159+
apt -y install ./sos_${DEB_BUILD_NAME}.deb
160+
sed -i 's/\(127.0.1.1\)/#\1/g' /etc/hosts
277161
fi
278162
if [ $(command -v dnf) ]; then
279163
echo "$ARTCURL/rpm%20Build%20From%20Checkout%20-%20${BUILD_NAME}/packages/sos_${BUILD_NAME}.rpm"
@@ -297,26 +181,6 @@ report_stageone_task:
297181
log_artifacts: &logs
298182
path: "sos-fail-logs.tar"
299183

300-
report_stageone_daily_task:
301-
skip: *man-changes-include
302-
alias: "stageone_daily_report"
303-
name: "Report Stage One - $BUILD_NAME"
304-
allow_failures: true
305-
depends_on:
306-
- snap_build
307-
gce_instance: *standardvm
308-
environment: &ubuntudevel
309-
PKG: "snap"
310-
PROJECT: ${UBUNTU_DEVEL_PROJECT}
311-
VM_FAMILY_NAME: ${UBUNTU_DEVEL_FAMILY_NAME}
312-
BUILD_NAME: "${UBUNTU_DEVEL_NAME} - ${PKG}"
313-
setup_script: *setup
314-
unittest_script: *unit_test
315-
main_script: *stageone_test
316-
on_failure:
317-
fail_script: *faillogs
318-
log_artifacts: *logs
319-
320184
# IFF the stage one tests all pass, then run stage two for latest distros
321185
report_stagetwo_task:
322186
skip: *man-changes-include
@@ -329,9 +193,6 @@ report_stagetwo_task:
329193
- env: *centos9
330194
- env: *centos10
331195
# - env: *fedora
332-
- env: *ubuntu-2404
333-
- env: *ubuntu-latest-snap
334-
- env: *ubuntu-latest-deb
335196
- env: *debian-13
336197
setup_script: *setup
337198
install_pexpect_script: |
@@ -347,21 +208,6 @@ report_stagetwo_task:
347208
fail_script: *faillogs
348209
log_artifacts: *logs
349210

350-
report_stagetwo_daily_task:
351-
skip: *man-changes-include
352-
alias: "stagetwo_daily_report"
353-
name: "Report Stage Two - $BUILD_NAME"
354-
allow_failures: true
355-
depends_on: stageone_daily_report
356-
timeout_in: 45m
357-
gce_instance: *standardvm
358-
environment: *ubuntudevel
359-
setup_script: *setup
360-
main_script: *stagetwo_test
361-
on_failure:
362-
fail_script: *faillogs
363-
log_artifacts: *logs
364-
365211
report_foreman_task:
366212
skip: "!changesInclude('.cirrus.yml', '**/{__init__,apache,foreman,foreman_tests,candlepin,pulp,pulpcore}.py', '**/foreman_setup.sh')"
367213
timeout_in: 45m
@@ -377,7 +223,6 @@ report_foreman_task:
377223
matrix:
378224
- env: *centos9
379225
- env: *debian-12
380-
- env: *ubuntu-2204
381226
setup_script: *setup
382227
foreman_setup_script: ./tests/test_data/foreman_setup.sh
383228
main_script: PYTHONPATH=tests/ avocado run -p TESTLOCAL=true --max-parallel-tasks=1 -t foreman tests/product_tests/foreman/

.github/workflows/avocado.yaml

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
name: Avocado Tests
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
distro:
7+
required: true
8+
type: string
9+
build:
10+
required: true
11+
type: string
12+
test_name:
13+
required: true
14+
type: string
15+
stage_name:
16+
required: true
17+
type: string
18+
extra_script:
19+
required: false
20+
type: string
21+
foreman_ver:
22+
required: false
23+
type: string
24+
katello_ver:
25+
required: false
26+
type: string
27+
28+
jobs:
29+
test:
30+
name: ${{ inputs.stage_name }} Tests (${{ inputs.distro }})
31+
runs-on: "ubuntu-${{ inputs.distro }}"
32+
33+
env:
34+
FOREMAN_VER: ${{ inputs.foreman_ver }}
35+
KATELLO_VER: ${{ inputs.katello_ver }}
36+
37+
steps:
38+
- name: Checkout code
39+
uses: actions/checkout@v6
40+
with:
41+
path: sos
42+
43+
- name: Install functional test dependancies
44+
run: |
45+
sudo apt update
46+
sudo apt -y install tox
47+
48+
- name: Download Distro-Specific DEB
49+
if: ${{ inputs.build == 'deb' }}
50+
uses: actions/download-artifact@v8
51+
with:
52+
name: sos-${{ inputs.distro }}.deb
53+
54+
- name: Download snap
55+
if: ${{ inputs.build == 'snap' }}
56+
uses: actions/download-artifact@v8
57+
with:
58+
name: sos-build.snap
59+
60+
- name: Install the package
61+
run: |
62+
# Install the local deb or snap file
63+
[[ "$(dpkg -l sos)" ]] && sudo apt -y purge sos ubuntu-server
64+
[[ "$(dpkg -l sosreport)" ]] && sudo apt -y purge sosreport ubuntu-server
65+
if [[ "${{ inputs.build }}" == "deb" ]] ; then
66+
sudo apt -y install ./"sos-${{ inputs.distro }}.deb"
67+
elif [[ "${{ inputs.build }}" == "snap" ]] ; then
68+
sudo snap install "sos-build.snap" --classic --dangerous
69+
fi
70+
71+
- name: Run Extra script
72+
if: ${{ inputs.extra_script != '' }}
73+
working-directory: ./sos
74+
run: |
75+
sudo -E ${{ inputs.extra_script}}
76+
77+
- name: Run Test Command
78+
working-directory: ./sos
79+
run: |
80+
sudo tox -e ${{ inputs.test_name }}
81+
82+
- name: Prepare Root Logs for Upload
83+
if: failure()
84+
run: |
85+
# 1. Check what's in the current directory
86+
ls -lh
87+
88+
# 2. Create a temporary directory in the workspace
89+
mkdir -p ./debug-logs/{var-tmp,root-home}
90+
91+
# 3. Use sudo to copy the protected directories
92+
sudo cp -ra /var/tmp/avocado* ./debug-logs/var-tmp || true
93+
sudo cp -ra /root/avocado ./debug-logs/root-home || true
94+
95+
# 4. Change ownership so the 'ubuntu' user can read them
96+
sudo chown -R $USER:$USER ./debug-logs
97+
98+
- name: Upload Distro Artifact
99+
if: failure()
100+
uses: actions/upload-artifact@v7
101+
with:
102+
name: failure-logs-${{ inputs.distro }}-${{ inputs.stage_name }}
103+
path: ./debug-logs/
104+
retention-days: 7
105+
106+
- name: Post-Test Cleanup
107+
if: always()
108+
run: |
109+
# Clean up the downloaded deb and the synced tests repo
110+
rm -f *.deb *.snap
111+
# Optional: Uninstall the package to leave the runner clean
112+
sudo apt-get purge -y sos
113+
sudo snap remove sosreport

0 commit comments

Comments
 (0)