feat: introduce flavors and variants #104
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: release | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - "variants/**" | |
| - "zarf-config/**" | |
| - ".github/workflows/publish.yaml" | |
| pull_request: | |
| paths: | |
| - "variants/**" | |
| - "zarf-config/**" | |
| - ".github/workflows/publish.yaml" | |
| workflow_dispatch: | |
| env: | |
| # renovate: datasource=docker depName=registry1.dso.mil/ironbank/opensource/zarf-dev/zarf/zarf-agent | |
| ZARF_VERSION: v0.80.0 | |
| # renovate: datasource=github-tags depName=k3d-io/k3d versioning=semver-coerced | |
| K3D_VERSION: v5.8.3 | |
| jobs: | |
| test: | |
| runs-on: ${{ matrix.platform.runner }} | |
| permissions: | |
| contents: read | |
| packages: read | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| flavor: | |
| - upstream | |
| - registry1 | |
| - unicorn | |
| platform: | |
| - arch: amd64 | |
| runner: ubuntu-24.04 | |
| - arch: arm64 | |
| runner: ubuntu-24.04-arm | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7 | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Login to registry1 | |
| uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4 | |
| with: | |
| registry: registry1.dso.mil | |
| username: ${{ secrets.IRON_BANK_ROBOT_USERNAME }} | |
| password: ${{ secrets.IRON_BANK_ROBOT_PASSWORD }} | |
| - name: Chainguard Login | |
| uses: chainguard-dev/setup-chainctl@2cddd35a2f120d9973e58094dc6878c93cf58c28 # v0.5.1 | |
| with: | |
| identity: ${{ secrets.CHAINGUARD_IDENTITY }} | |
| - name: Install Zarf | |
| uses: defenseunicorns/setup-zarf@745f0990f3d0611774b552930ea053ac61ebf0a6 # main | |
| with: | |
| version: ${{ env.ZARF_VERSION }} | |
| download-init-package: false | |
| - name: Vendor Zarf packages | |
| run: | | |
| git clone --depth 1 --branch "${ZARF_VERSION}" --filter=blob:none --sparse \ | |
| https://github.com/zarf-dev/zarf.git .zarf-src | |
| git -C .zarf-src sparse-checkout set packages | |
| - name: Build default package (${{ matrix.flavor }} / ${{ matrix.platform.arch }}) | |
| env: | |
| FLAVOR: ${{ matrix.flavor }} | |
| ARCH: ${{ matrix.platform.arch }} | |
| run: | | |
| config="zarf-config/${FLAVOR}-${ARCH}.yaml" | |
| [ -f "${config}" ] || config="zarf-config/${FLAVOR}.yaml" | |
| ZARF_CONFIG="${config}" zarf package create variants/default \ | |
| --flavor "${FLAVOR}" --set PKG_VERSION="${ZARF_VERSION}-${FLAVOR}" -a "${ARCH}" --confirm | |
| - name: install k3d | |
| run: | | |
| echo "Installing k3d version $K3D_VERSION" | |
| curl -s https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | TAG="${K3D_VERSION}" bash | |
| - name: Create k3d cluster | |
| run: k3d cluster create zarf | |
| - name: Deploy zarf init package | |
| run: | | |
| zarf package deploy zarf-init-${{ matrix.platform.arch }}-*.tar.zst --confirm | |
| zarf tools kubectl wait --for=condition=ready pods --all -n zarf --timeout=180s | |
| - name: Deploy DOS games package | |
| run: | | |
| zarf package deploy oci://ghcr.io/zarf-dev/packages/dos-games:1.2.0 --confirm -a ${{ matrix.platform.arch }} --skip-signature-validation | |
| zarf tools kubectl wait --for=condition=ready pods --all -n dos-games --timeout=180s | |
| publish: | |
| needs: test | |
| if: github.event_name != 'pull_request' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| flavor: | |
| - upstream | |
| - registry1 | |
| - unicorn | |
| variant: | |
| - name: default | |
| dir: "variants/default" | |
| suffix: "" | |
| - name: agent-only | |
| dir: "variants/agent-only" | |
| suffix: "-agent-only" | |
| - name: gitea | |
| dir: "variants/gitea" | |
| suffix: "-gitea" | |
| env: | |
| REPO: ghcr.io/defenseunicorns/delivery-zarf-init | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7 | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Login to registry1 | |
| uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4 | |
| with: | |
| registry: registry1.dso.mil | |
| username: ${{ secrets.IRON_BANK_ROBOT_USERNAME }} | |
| password: ${{ secrets.IRON_BANK_ROBOT_PASSWORD }} | |
| - name: Chainguard Login | |
| uses: chainguard-dev/setup-chainctl@2cddd35a2f120d9973e58094dc6878c93cf58c28 # v0.5.1 | |
| with: | |
| identity: ${{ secrets.CHAINGUARD_IDENTITY }} | |
| - name: Install Zarf | |
| uses: defenseunicorns/setup-zarf@745f0990f3d0611774b552930ea053ac61ebf0a6 # main | |
| with: | |
| version: ${{ env.ZARF_VERSION }} | |
| download-init-package: false | |
| - name: Vendor Zarf packages | |
| run: | | |
| git clone --depth 1 --branch "${ZARF_VERSION}" --filter=blob:none --sparse \ | |
| https://github.com/zarf-dev/zarf.git .zarf-src | |
| git -C .zarf-src sparse-checkout set packages | |
| - name: Build and publish (${{ matrix.flavor }} / ${{ matrix.variant.name }}) | |
| env: | |
| FLAVOR: ${{ matrix.flavor }} | |
| SUFFIX: ${{ matrix.variant.suffix }} | |
| DIR: ${{ matrix.variant.dir }} | |
| run: | | |
| version="${ZARF_VERSION}-${FLAVOR}${SUFFIX}" | |
| for arch in amd64 arm64; do | |
| config="zarf-config/${FLAVOR}-${arch}.yaml" | |
| [ -f "${config}" ] || config="zarf-config/${FLAVOR}.yaml" | |
| ZARF_CONFIG="${config}" zarf package create "${DIR}" \ | |
| --flavor "${FLAVOR}" --set PKG_VERSION="${version}" -a "${arch}" --confirm | |
| zarf package publish zarf-init-"${arch}"-*.tar.zst "oci://${REPO}" --tag "${version}" | |
| done |