Skip to content

Commit a37fb55

Browse files
committed
Add action to test image changes against foremanctl
1 parent c0c9ef6 commit a37fb55

1 file changed

Lines changed: 116 additions & 0 deletions

File tree

.github/workflows/integration.yml

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
---
2+
name: Integration test (foremanctl)
3+
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
foremanctl_ref:
8+
description: 'foremanctl branch or tag to test against'
9+
required: false
10+
default: 'master'
11+
pull_request:
12+
13+
permissions:
14+
contents: read
15+
16+
concurrency:
17+
group: integration-${{ github.ref_name }}
18+
cancel-in-progress: true
19+
20+
env:
21+
IMAGE_TAG: nightly
22+
23+
jobs:
24+
integration:
25+
runs-on: ubuntu-24.04
26+
name: foremanctl integration
27+
steps:
28+
- name: Checkout foreman-oci-images
29+
uses: actions/checkout@v6
30+
31+
- name: Build foreman image
32+
run: make build PROJECT=foreman FOREMAN_XY_TAG=${{ env.IMAGE_TAG }}
33+
34+
- name: Build foreman-proxy image
35+
run: make build PROJECT=foreman-proxy FOREMAN_XY_TAG=${{ env.IMAGE_TAG }}
36+
37+
- name: Export images as tarballs
38+
run: |
39+
podman save -o foreman-image.tar quay.io/foreman/foreman:${{ env.IMAGE_TAG }}
40+
podman save -o foreman-proxy-image.tar quay.io/foreman/foreman-proxy:${{ env.IMAGE_TAG }}
41+
42+
- name: Checkout foremanctl
43+
uses: actions/checkout@v6
44+
with:
45+
repository: theforeman/foremanctl
46+
ref: ${{ github.event.inputs.foremanctl_ref || 'master' }}
47+
path: foremanctl
48+
49+
- name: Prepare images for VM transfer
50+
run: |
51+
mv foreman-image.tar foremanctl/
52+
mv foreman-proxy-image.tar foremanctl/
53+
54+
- name: Set container_tag_stream to ${{ env.IMAGE_TAG }}
55+
run: |
56+
sed -i '/container_tag_stream:/ s/:.*/: "${{ env.IMAGE_TAG }}"/' foremanctl/src/vars/images.yml
57+
58+
- name: Set up Python
59+
uses: actions/setup-python@v6
60+
with:
61+
python-version: '3.12'
62+
63+
- name: Setup libvirt for Vagrant
64+
uses: voxpupuli/setup-vagrant@v0
65+
66+
- name: Install Ansible
67+
run: pip install --upgrade ansible-core
68+
69+
- name: Setup environment
70+
working-directory: foremanctl
71+
run: ./setup-environment
72+
73+
- name: Start VM
74+
working-directory: foremanctl
75+
run: ./forge vms start --vms "quadlet"
76+
77+
- name: Install podman in VM
78+
working-directory: foremanctl
79+
run: vagrant ssh quadlet -- sudo dnf install -y podman
80+
81+
- name: Load images into VM
82+
working-directory: foremanctl
83+
run: |
84+
vagrant ssh quadlet -- sudo podman load -i /vagrant/foreman-image.tar
85+
vagrant ssh quadlet -- sudo podman load -i /vagrant/foreman-proxy-image.tar
86+
87+
- name: Free disk space
88+
run: |
89+
rm -f foremanctl/foreman-image.tar foremanctl/foreman-proxy-image.tar
90+
podman system prune --all --force
91+
92+
- name: Configure repositories
93+
working-directory: foremanctl
94+
run: ./forge setup-repositories
95+
96+
- name: Run deployment
97+
working-directory: foremanctl
98+
run: |
99+
./foremanctl deploy --foreman-initial-admin-password=changeme --tuning development --add-feature hammer --add-feature foreman-proxy --add-feature remote-execution
100+
101+
- name: Run tests
102+
working-directory: foremanctl
103+
run: |
104+
./forge test --pytest-args="tests/foreman_target_test.py tests/foreman_test.py tests/foreman_proxy_test.py tests/redis_test.py tests/postgresql_test.py tests/httpd_test.py tests/hammer_test.py"
105+
106+
- name: Generate sos reports
107+
if: ${{ always() }}
108+
working-directory: foremanctl
109+
run: ./forge sos
110+
111+
- name: Archive sos reports
112+
if: ${{ always() }}
113+
uses: actions/upload-artifact@v7
114+
with:
115+
name: sosreport-integration
116+
path: foremanctl/sos/

0 commit comments

Comments
 (0)