Add action to test image changes against foremanctl #1
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| name: Integration test (foremanctl) | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| foremanctl_ref: | |
| description: 'foremanctl branch or tag to test against' | |
| required: false | |
| default: 'master' | |
| pull_request: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: integration-${{ github.ref_name }} | |
| cancel-in-progress: true | |
| env: | |
| IMAGE_TAG: nightly | |
| jobs: | |
| integration: | |
| runs-on: ubuntu-24.04 | |
| name: foremanctl integration | |
| steps: | |
| - name: Checkout foreman-oci-images | |
| uses: actions/checkout@v6 | |
| - name: Build foreman image | |
| run: make build PROJECT=foreman FOREMAN_XY_TAG=${{ env.IMAGE_TAG }} | |
| - name: Build foreman-proxy image | |
| run: make build PROJECT=foreman-proxy FOREMAN_XY_TAG=${{ env.IMAGE_TAG }} | |
| - name: Export images as tarballs | |
| run: | | |
| podman save -o foreman-image.tar quay.io/foreman/foreman:${{ env.IMAGE_TAG }} | |
| podman save -o foreman-proxy-image.tar quay.io/foreman/foreman-proxy:${{ env.IMAGE_TAG }} | |
| - name: Checkout foremanctl | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: theforeman/foremanctl | |
| ref: ${{ github.event.inputs.foremanctl_ref || 'master' }} | |
| path: foremanctl | |
| - name: Prepare images for VM transfer | |
| run: | | |
| mv foreman-image.tar foremanctl/ | |
| mv foreman-proxy-image.tar foremanctl/ | |
| - name: Set container_tag_stream to ${{ env.IMAGE_TAG }} | |
| run: | | |
| sed -i '/container_tag_stream:/ s/:.*/: "${{ env.IMAGE_TAG }}"/' foremanctl/src/vars/images.yml | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.12' | |
| - name: Setup libvirt for Vagrant | |
| uses: voxpupuli/setup-vagrant@v0 | |
| - name: Install Ansible | |
| run: pip install --upgrade ansible-core | |
| - name: Setup environment | |
| working-directory: foremanctl | |
| run: ./setup-environment | |
| - name: Start VM | |
| working-directory: foremanctl | |
| run: ./forge vms start --vms "quadlet" | |
| - name: Load images into VM | |
| working-directory: foremanctl | |
| run: | | |
| vagrant ssh quadlet -- sudo podman load -i /vagrant/foreman-image.tar | |
| vagrant ssh quadlet -- sudo podman load -i /vagrant/foreman-proxy-image.tar | |
| - name: Free disk space | |
| run: | | |
| rm -f foremanctl/foreman-image.tar foremanctl/foreman-proxy-image.tar | |
| podman system prune --all --force | |
| - name: Configure repositories | |
| working-directory: foremanctl | |
| run: ./forge setup-repositories | |
| - name: Run deployment | |
| working-directory: foremanctl | |
| run: | | |
| ./foremanctl deploy --foreman-initial-admin-password=changeme --tuning development | |
| - name: Add optional feature - hammer | |
| working-directory: foremanctl | |
| run: ./foremanctl deploy --add-feature hammer | |
| - name: Add optional feature - foreman-proxy | |
| working-directory: foremanctl | |
| run: ./foremanctl deploy --add-feature foreman-proxy | |
| - name: Run tests | |
| working-directory: foremanctl | |
| run: | | |
| ./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" | |
| - name: Generate sos reports | |
| if: ${{ always() }} | |
| working-directory: foremanctl | |
| run: ./forge sos | |
| - name: Archive sos reports | |
| if: ${{ always() }} | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: sosreport-integration | |
| path: foremanctl/sos/ | |
| - name: Setup upterm session | |
| if: ${{ failure() }} | |
| uses: owenthereal/action-upterm@v1 | |
| with: | |
| limit-access-to-actor: true | |
| wait-timeout-minutes: 5 |