build: build nvmetcli containerdisks on the runner #59
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
| --- | |
| # SPDX-License-Identifier: GPL-2.0-only | |
| # | |
| # Copyright (C) 2026 SUSE LLC | |
| # | |
| # Author: Daniel Wagner <dwagner@suse.de> | |
| name: "Build" | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - '*.*' | |
| permissions: | |
| packages: write | |
| contents: write | |
| jobs: | |
| # ------------------------ | |
| # Step 1: define the matrix | |
| # ------------------------ | |
| distro_matrix: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| distros: ${{ steps.set_matrix.outputs.distros }} | |
| steps: | |
| - name: Set matrix of distros | |
| id: set_matrix | |
| run: | | |
| echo 'distros=["debian","fedora","tumbleweed","alpine"]' >> $GITHUB_OUTPUT | |
| # ------------------------ | |
| # Step 2: Build staging images | |
| # ------------------------ | |
| build_staging: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - distro_matrix | |
| strategy: | |
| matrix: | |
| distro: ${{ fromJSON(needs.distro_matrix.outputs.distros) }} | |
| name: Build staging container | |
| steps: | |
| - name: Check out repo | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v6 | |
| - name: Get release version | |
| run: | | |
| if [[ "$GITHUB_REF" == refs/tags/* ]]; then | |
| echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
| else | |
| echo "RELEASE_VERSION=" >> $GITHUB_ENV | |
| fi | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@06116385d9baf250c9f4dcb4858b16962ea869c3 # v4.1.0 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0 | |
| - name: Login to ghcr.io | |
| uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build staging image | |
| uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0 | |
| with: | |
| file: staging/Dockerfile.${{ matrix.distro }} | |
| platforms: linux/amd64 | |
| push: true | |
| provenance: false | |
| tags: | | |
| ghcr.io/linux-nvme/${{ matrix.distro }}.staging:next | |
| ${{ env.RELEASE_VERSION && format('ghcr.io/linux-nvme/{0}.staging:main', matrix.distro) || '' }} | |
| # ------------------------ | |
| # Step 3: Build tools using staging containers | |
| # ------------------------ | |
| build_tools: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - distro_matrix | |
| - build_staging | |
| strategy: | |
| matrix: | |
| distro: ${{ fromJSON(needs.distro_matrix.outputs.distros) }} | |
| name: Build samurai and muon | |
| container: | |
| image: ghcr.io/linux-nvme/${{ matrix.distro }}.staging:next | |
| steps: | |
| - name: Check out repo | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v6 | |
| - name: Build tools | |
| run: scripts/build-muon.sh | |
| - uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7 | |
| with: | |
| name: samu-muon-${{ matrix.distro }} | |
| path: bin | |
| # ------------------------ | |
| # Step 4: Deploy final containers | |
| # ------------------------ | |
| deploy_containers: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - distro_matrix | |
| - build_tools | |
| strategy: | |
| matrix: | |
| distro: ${{ fromJSON(needs.distro_matrix.outputs.distros) }} | |
| name: Deploy final containers | |
| steps: | |
| - name: Check out repo | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v6 | |
| - name: Get release version | |
| run: | | |
| if [[ "$GITHUB_REF" == refs/tags/* ]]; then | |
| echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
| else | |
| echo "RELEASE_VERSION=" >> $GITHUB_ENV | |
| fi | |
| - name: Download artifacts | |
| uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8 | |
| with: | |
| name: samu-muon-${{ matrix.distro }} | |
| path: bin | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@06116385d9baf250c9f4dcb4858b16962ea869c3 # v4.1.0 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0 | |
| - name: Login to ghcr.io | |
| uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build final image | |
| uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0 | |
| with: | |
| context: . | |
| file: main/Dockerfile.${{ matrix.distro }} | |
| platforms: linux/amd64 | |
| push: true | |
| provenance: false | |
| tags: | | |
| ghcr.io/linux-nvme/${{ matrix.distro }}:next | |
| ${{ env.RELEASE_VERSION && format('ghcr.io/linux-nvme/{0}:{1}', matrix.distro, env.RELEASE_VERSION) || '' }} | |
| ${{ env.RELEASE_VERSION && format('ghcr.io/linux-nvme/{0}:latest', matrix.distro) || '' }} | |
| deploy_cross_containers: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| arch: | |
| - armhf | |
| - ppc64le | |
| - s390x | |
| name: ubuntu cross container | |
| steps: | |
| - name: Check out repo | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v6 | |
| - name: Get release version | |
| run: | | |
| if [[ "$GITHUB_REF" == refs/tags/* ]]; then | |
| echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
| else | |
| echo "RELEASE_VERSION=" >> $GITHUB_ENV | |
| fi | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@06116385d9baf250c9f4dcb4858b16962ea869c3 # v4.1.0 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0 | |
| - name: Login to ghcr.io | |
| uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build image | |
| uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0 | |
| with: | |
| file: main/Dockerfile.ubuntu.${{ matrix.arch }} | |
| platforms: linux/amd64 | |
| push: true | |
| provenance: false | |
| tags: | | |
| ghcr.io/linux-nvme/ubuntu-cross-${{ matrix.arch }}:next | |
| ${{ env.RELEASE_VERSION && format('ghcr.io/linux-nvme/ubuntu-cross-{0}:{1}', matrix.arch, env.RELEASE_VERSION) || '' }} | |
| ${{ env.RELEASE_VERSION && format('ghcr.io/linux-nvme/ubuntu-cross-{0}:latest', matrix.arch) || '' }} | |
| deploy_nvmetcli_containers: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - distro_matrix | |
| strategy: | |
| matrix: | |
| distro: ${{ fromJSON(needs.distro_matrix.outputs.distros) }} | |
| exclude: | |
| - distro: alpine | |
| name: Deploy nvmetcli containers | |
| steps: | |
| - name: Check out repo | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v6 | |
| - name: Get release version | |
| run: | | |
| if [[ "$GITHUB_REF" == refs/tags/* ]]; then | |
| echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
| else | |
| echo "RELEASE_VERSION=" >> $GITHUB_ENV | |
| fi | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@06116385d9baf250c9f4dcb4858b16962ea869c3 # v4.1.0 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0 | |
| - name: Login to ghcr.io | |
| uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push nvmetcli image | |
| uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0 | |
| with: | |
| context: . | |
| file: nvmetcli/Dockerfile.${{ matrix.distro }} | |
| platforms: linux/amd64 | |
| push: true | |
| provenance: false | |
| tags: | | |
| ghcr.io/linux-nvme/nvmetcli-${{ matrix.distro }}:next | |
| ${{ env.RELEASE_VERSION && format('ghcr.io/linux-nvme/nvmetcli-{0}:{1}', matrix.distro, env.RELEASE_VERSION) || '' }} | |
| ${{ env.RELEASE_VERSION && format('ghcr.io/linux-nvme/nvmetcli-{0}:latest', matrix.distro) || '' }} | |
| deploy_nvmetcli_containerdisks: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - distro_matrix | |
| strategy: | |
| matrix: | |
| distro: ${{ fromJSON(needs.distro_matrix.outputs.distros) }} | |
| exclude: | |
| - distro: alpine | |
| name: Deploy nvmetcli containerDisks | |
| steps: | |
| - name: Check out repo | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v6 | |
| - name: Get release version | |
| run: | | |
| if [[ "$GITHUB_REF" == refs/tags/* ]]; then | |
| echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
| else | |
| echo "RELEASE_VERSION=" >> $GITHUB_ENV | |
| fi | |
| - name: Install libguestfs tools | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y --no-install-recommends \ | |
| guestfs-tools guestmount python3-yaml | |
| - name: Inject nvmetcli tools into the base cloud image | |
| run: scripts/build-containerdisk.sh ${{ matrix.distro }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0 | |
| - name: Login to ghcr.io | |
| uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push nvmetcli containerDisk | |
| uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0 | |
| with: | |
| context: nvmetcli/build | |
| file: nvmetcli/Dockerfile.${{ matrix.distro }}.containerdisk | |
| platforms: linux/amd64 | |
| push: true | |
| provenance: false | |
| tags: | | |
| ghcr.io/linux-nvme/nvmetcli-${{ matrix.distro }}-containerdisk:next | |
| ${{ env.RELEASE_VERSION && format('ghcr.io/linux-nvme/nvmetcli-{0}-containerdisk:{1}', matrix.distro, env.RELEASE_VERSION) || '' }} | |
| ${{ env.RELEASE_VERSION && format('ghcr.io/linux-nvme/nvmetcli-{0}-containerdisk:latest', matrix.distro) || '' }} |