|
| 1 | +name: Workflow Test (Testing Farm) |
| 2 | + |
| 3 | +permissions: |
| 4 | + actions: read |
| 5 | + packages: write |
| 6 | + |
| 7 | +on: |
| 8 | + workflow_dispatch: |
| 9 | + inputs: |
| 10 | + bootc_repo: |
| 11 | + description: "bootc git repo URL" |
| 12 | + default: "https://github.com/bootc-dev/bootc" |
| 13 | + bootc_branch: |
| 14 | + description: "bootc git branch" |
| 15 | + default: "main" |
| 16 | + base_image: |
| 17 | + description: "Base bootc image" |
| 18 | + default: "quay.io/centos-bootc/centos-bootc:stream9" |
| 19 | + test_plan: |
| 20 | + description: "tmt test plan filter" |
| 21 | + default: "/baseline/" |
| 22 | + arch: |
| 23 | + description: "Architecture" |
| 24 | + default: "x86_64" |
| 25 | + compose: |
| 26 | + description: "Testing Farm compose" |
| 27 | + default: "CentOS-Stream-9" |
| 28 | + distro_context: |
| 29 | + description: "tmt distro context" |
| 30 | + default: "centos-9" |
| 31 | + |
| 32 | +env: |
| 33 | + REGISTRY_REPO: ghcr.io/${{ github.repository }} |
| 34 | + |
| 35 | +jobs: |
| 36 | + build-and-push: |
| 37 | + runs-on: ubuntu-24.04 |
| 38 | + outputs: |
| 39 | + image_tag: ${{ steps.tag.outputs.tag }} |
| 40 | + steps: |
| 41 | + - uses: actions/checkout@v6 |
| 42 | + |
| 43 | + - name: Compute image tag |
| 44 | + id: tag |
| 45 | + run: | |
| 46 | + BRANCH="${GITHUB_REF_NAME}" |
| 47 | + SHA="$(git rev-parse --short HEAD)" |
| 48 | + TAG="${BRANCH}-${SHA}" |
| 49 | + echo "tag=${TAG}" >> "$GITHUB_OUTPUT" |
| 50 | +
|
| 51 | + - name: Get a newer podman for heredoc support (from debian testing) |
| 52 | + run: | |
| 53 | + set -eux |
| 54 | + echo 'deb [trusted=yes] https://ftp.debian.org/debian/ testing main' | sudo tee /etc/apt/sources.list.d/testing.list |
| 55 | + sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 6ED0E7B82643E131 78DBA3BC47EF2265 |
| 56 | + sudo apt update |
| 57 | + DIVERSION_PATHS="lib32 libo32 lib64" |
| 58 | + for PATH_NAME in $DIVERSION_PATHS; do |
| 59 | + sudo dpkg-divert --remove --package base-files --divert /$PATH_NAME.usr-is-merged /$PATH_NAME || true |
| 60 | + sudo dpkg-divert --remove --package base-files --divert /.$PATH_NAME.usr-is-merged /$PATH_NAME || true |
| 61 | + done |
| 62 | + sudo dpkg --configure -a |
| 63 | + sudo apt --fix-broken install |
| 64 | + sudo apt install -y crun/testing podman/testing skopeo/testing |
| 65 | +
|
| 66 | + - name: Build image |
| 67 | + run: | |
| 68 | + sudo podman build \ |
| 69 | + --build-arg "base=${{ inputs.base_image }}" \ |
| 70 | + --build-arg "bootc_repo=${{ inputs.bootc_repo }}" \ |
| 71 | + --build-arg "bootc_branch=${{ inputs.bootc_branch }}" \ |
| 72 | + -t "${{ env.REGISTRY_REPO }}:${{ steps.tag.outputs.tag }}" \ |
| 73 | + -f Dockerfile . |
| 74 | +
|
| 75 | + - name: Push image |
| 76 | + run: | |
| 77 | + sudo podman login -u "${{ github.actor }}" -p "${{ secrets.GITHUB_TOKEN }}" ghcr.io |
| 78 | + sudo podman push "${{ env.REGISTRY_REPO }}:${{ steps.tag.outputs.tag }}" |
| 79 | +
|
| 80 | + test: |
| 81 | + needs: build-and-push |
| 82 | + runs-on: ubuntu-24.04 |
| 83 | + steps: |
| 84 | + - name: Install testing-farm CLI |
| 85 | + run: pip install testing-farm |
| 86 | + |
| 87 | + - name: Request Testing Farm run |
| 88 | + run: | |
| 89 | + testing-farm request \ |
| 90 | + --plan "${{ inputs.test_plan }}" \ |
| 91 | + --secret "TIER1_IMAGE_URL=${{ env.REGISTRY_REPO }}:${{ needs.build-and-push.outputs.image_tag }}" \ |
| 92 | + --git-url https://gitlab.com/fedora/bootc/tests/bootc-workflow-test \ |
| 93 | + --git-ref main \ |
| 94 | + --compose "${{ inputs.compose }}" \ |
| 95 | + --arch "${{ inputs.arch }}" \ |
| 96 | + --context "arch=${{ inputs.arch }}" \ |
| 97 | + --context "distro=${{ inputs.distro_context }}" |
| 98 | + env: |
| 99 | + TESTING_FARM_API_TOKEN: ${{ secrets.TESTING_FARM_API_TOKEN }} |
0 commit comments