Build #1021
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: Build | |
| permissions: | |
| issues: write | |
| pull-requests: read | |
| contents: read | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| keep_workdir: | |
| description: keeps the working dir on the runner after the job is finished | |
| required: false | |
| distro-variant: | |
| description: Build with CBS or COPR packages. Use "cbs-(testing|release)" or "copr". | |
| required: true | |
| default: "copr" | |
| push: | |
| branches: [master] | |
| tags: | |
| - 'ovirt-engine-appliance*' | |
| schedule: | |
| # Running every morning in EMEA timezone | |
| - cron: '0 6 * * *' | |
| jobs: | |
| distro-variant: | |
| name: Set environment variables | |
| runs-on: ubuntu-latest | |
| outputs: | |
| DISTRO_VARIANT: ${{ steps.set_distro_variant.outputs.DISTRO_VARIANT }} | |
| steps: | |
| - name: Set distro-variant | |
| id: set_distro_variant | |
| run: | | |
| echo "DISTRO_VARIANT=copr" >> "$GITHUB_OUTPUT" | |
| if [ "${{ github.event.inputs.distro-variant }}" != "" ]; then | |
| echo "DISTRO_VARIANT=${{ github.event.inputs.distro-variant }}" >> "$GITHUB_OUTPUT" | |
| fi | |
| if [ "${{ startsWith(github.ref, 'refs/tags/ovirt-engine-appliance') }}" == "true" ]; then | |
| echo "DISTRO_VARIANT=cbs-release" >> "$GITHUB_OUTPUT" | |
| fi | |
| build-matrix: | |
| timeout-minutes: 80 | |
| needs: distro-variant | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| build-os: ['el9', 'el10'] | |
| target-os: ['el9stream', 'el10stream', 'almalinux9', 'almalinux10'] | |
| include: | |
| - build-os: el9 | |
| container: el9stream | |
| - build-os: el10 | |
| container: el10stream | |
| - target-os: el9stream | |
| os: centos | |
| num: 9 | |
| - target-os: el10stream | |
| os: centos | |
| num: 10 | |
| - target-os: almalinux9 | |
| os: almalinux | |
| num: 9 | |
| - target-os: almalinux10 | |
| os: almalinux | |
| num: 10 | |
| name: build ${{ matrix.target-os }} on ${{ matrix.build-os }} - ${{ needs.distro-variant.outputs.DISTRO_VARIANT }} | |
| runs-on: [image-builders] | |
| container: | |
| image: quay.io/ovirt/buildcontainer:${{ matrix.container }} | |
| options: --privileged | |
| volumes: | |
| - /dev:/dev | |
| env: | |
| DISTRO_VARIANT: ${{ needs.distro-variant.outputs.DISTRO_VARIANT }} | |
| steps: | |
| - name: Install Kiwi | |
| run: | | |
| dnf install -y epel-release | |
| dnf install -y kiwi-cli | |
| - uses: ovirt/checkout-action@main | |
| with: | |
| fetch-depth: 0 | |
| - name: Build the qcow2 image | |
| run: | | |
| cd engine-appliance | |
| make DISTRO=${{ matrix.os }} DISTRO_VERSION=${{ matrix.num }} PROFILE=${{ env.DISTRO_VARIANT }} | |
| - name: Build RPM | |
| run: | | |
| cd engine-appliance | |
| make DISTRO=${{ matrix.os }} DISTRO_VERSION=${{ matrix.num }} PROFILE=${{ env.DISTRO_VARIANT }} rpm | |
| - name: Upload srpm to resources.ovirt.org | |
| uses: ovirt/ovirt-resources-upload-action@main | |
| with: | |
| username: ${{ secrets.SSH_USERNAME_FOR_RESOURCES_OVIRT_ORG }} | |
| key: ${{ secrets.SSH_KEY_FOR_RESOURCES_OVIRT_ORG }} | |
| known_hosts: ${{ secrets.KNOWN_HOSTS_FOR_RESOURCES_OVIRT_ORG }} | |
| source: engine-appliance/tmp.repos/SRPMS/*.rpm | |
| target: github-ci/ovirt-appliance-${{ env.DISTRO_VARIANT }}/${{ matrix.build-os }} | |
| - name: Upload rpm to resources.ovirt.org | |
| uses: ovirt/ovirt-resources-upload-action@main | |
| with: | |
| username: ${{ secrets.SSH_USERNAME_FOR_RESOURCES_OVIRT_ORG }} | |
| key: ${{ secrets.SSH_KEY_FOR_RESOURCES_OVIRT_ORG }} | |
| known_hosts: ${{ secrets.KNOWN_HOSTS_FOR_RESOURCES_OVIRT_ORG }} | |
| source: engine-appliance/tmp.repos/RPMS/x86_64/*.rpm | |
| target: github-ci/ovirt-appliance-${{ env.DISTRO_VARIANT }}/${{ matrix.build-os }} | |
| cleanup: yes | |
| # keep 4 last builds + repodata | |
| keep_files_count: 33 | |
| - name: Upload manifest to github | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: "manifest-${{ matrix.build-os }}-${{ matrix.target-os }}" | |
| path: engine-appliance/ovirt-engine-appliance-${{ matrix.os }}${{ matrix.num}}-manifest-rpm | |
| - name: Clean up entire workdir | |
| if: always() | |
| run: | | |
| [[ -z "${{ github.event.inputs.keep_workdir }}" ]] && rm -rf $PWD/* | |
| createrepo-matrix: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| build-os: ['el9', 'el10'] | |
| runs-on: ubuntu-latest | |
| needs: | |
| - distro-variant | |
| - build-matrix | |
| env: | |
| DISTRO_VARIANT: ${{ needs.distro-variant.outputs.DISTRO_VARIANT }} | |
| steps: | |
| - name: Create or update repository metadata | |
| uses: ovirt/ovirt-resources-upload-action@main | |
| with: | |
| username: ${{ secrets.SSH_USERNAME_FOR_RESOURCES_OVIRT_ORG }} | |
| key: ${{ secrets.SSH_KEY_FOR_RESOURCES_OVIRT_ORG }} | |
| known_hosts: ${{ secrets.KNOWN_HOSTS_FOR_RESOURCES_OVIRT_ORG }} | |
| target: github-ci/ovirt-appliance-${{ env.DISTRO_VARIANT }}/${{ matrix.build-os }} | |
| createrepo: yes | |
| close-build-issue-on-success: | |
| name: Report workflow success | |
| runs-on: ubuntu-latest | |
| needs: | |
| - build-matrix | |
| - createrepo-matrix | |
| steps: | |
| - name: Checkout | |
| uses: ovirt/checkout-action@main | |
| - name: Add a comment about successful job and close issue | |
| run: | | |
| set -e | |
| LABEL="build-failed" | |
| ISSUENO=$(gh issue list -l $LABEL | awk ' { print $1 } ' | head -n 1) | |
| if [ -n "$ISSUENO" ]; then | |
| MESSAGE="✅ The oVirt Appliance build CI job is now [successful](https://github.com/oVirt/ovirt-appliance/actions/runs/${{ github.run_id }}), closing issue." | |
| gh issue comment "${ISSUENO}" --body "${MESSAGE}" | |
| gh issue close "${ISSUENO}" | |
| fi | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| open-build-issue-on-failure: | |
| name: Report workflow failure | |
| runs-on: ubuntu-latest | |
| if: ${{ always() && ((needs.build-matrix.result=='failure') || (needs.createrepo-matrix.result=='failure')) }} | |
| needs: | |
| - build-matrix | |
| - createrepo-matrix | |
| steps: | |
| - name: Checkout | |
| uses: ovirt/checkout-action@main | |
| - name: Add a comment about failed job | |
| run: | | |
| set -e | |
| TITLE="Failed oVirt Appliance build job" | |
| LABEL="build-failed" | |
| ISSUENO=$(gh issue list -l $LABEL | awk ' { print $1 } ' | head -n 1) | |
| if [ -z "$ISSUENO" ]; then | |
| MESSAGE="❌ The oVirt Appliance build CI job failed. [Please investigate.](https://github.com/oVirt/ovirt-appliance/actions/runs/${{ github.run_id }})" | |
| gh issue create --title "${TITLE}" --body "${MESSAGE}" --label "${LABEL}" | |
| else | |
| MESSAGE="❌ oVirt Appliance build CI job is still failing. [Please investigate.](https://github.com/oVirt/ovirt-appliance/actions/runs/${{ github.run_id }})" | |
| gh issue comment "${ISSUENO}" --body "${MESSAGE}" | |
| fi | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |