mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-09 20:26:33 +00:00
123 lines
3.4 KiB
YAML
123 lines
3.4 KiB
YAML
name: Test DNS (CoreDNS + Docker-in-Docker)
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
distros:
|
|
description: "Space-separated distro list (e.g. 'arch debian ubuntu')"
|
|
required: false
|
|
default: "debian"
|
|
type: string
|
|
|
|
workflow_call:
|
|
inputs:
|
|
distros:
|
|
description: "Space-separated distro list"
|
|
required: true
|
|
type: string
|
|
|
|
permissions:
|
|
contents: read
|
|
packages: read
|
|
|
|
env:
|
|
INFINITO_IMAGE_TAG: ci-${{ github.sha }}
|
|
|
|
jobs:
|
|
prepare:
|
|
name: 🧮 Build matrix
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
matrix: ${{ steps.out.outputs.matrix }}
|
|
owner: ${{ steps.vars.outputs.owner }}
|
|
repo_name: ${{ steps.vars.outputs.repo_name }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Resolve image coordinates
|
|
id: vars
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
owner="$(scripts/meta/resolve/repository/owner.sh)"
|
|
repo_name="${{ github.repository }}"
|
|
repo_name="${repo_name#*/}"
|
|
repo_name="${repo_name,,}"
|
|
echo "owner=${owner}" >> "$GITHUB_OUTPUT"
|
|
echo "repo_name=${repo_name}" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Install jq
|
|
shell: bash
|
|
run: ./scripts/install/apt.sh jq
|
|
|
|
- name: Compute matrix JSON
|
|
id: out
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
distros="${{ inputs.distros }}"
|
|
distros="${distros:-debian}"
|
|
json="$(printf '%s' "${distros}" | jq -Rc 'split(" ") | map(select(length>0))')"
|
|
echo "matrix=${json}" >> "$GITHUB_OUTPUT"
|
|
echo "Using matrix: ${json}"
|
|
|
|
dns:
|
|
name: 🌐 Test DNS (${{ matrix.distro }})
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 20
|
|
needs: prepare
|
|
env:
|
|
NIX_CONFIG: |
|
|
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
|
|
INFINITO_IMAGE_TAG: ci-${{ github.sha }}
|
|
# Use the prebuilt CI image directly instead of the :latest fallback from env/all.sh.
|
|
INFINITO_IMAGE: ghcr.io/${{ needs.prepare.outputs.owner }}/${{ needs.prepare.outputs.repo_name }}/${{ matrix.distro }}:ci-${{ github.sha }}
|
|
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
distro: ${{ fromJson(needs.prepare.outputs.matrix) }}
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Install dnsutils (dig)
|
|
shell: bash
|
|
run: ./scripts/install/apt.sh dnsutils
|
|
|
|
- name: Start stack (coredns + infinito) for distro
|
|
shell: bash
|
|
env:
|
|
INFINITO_DISTRO: ${{ matrix.distro }}
|
|
INFINITO_CONTAINER: infinito_nexus_${{ matrix.distro }}
|
|
run: |
|
|
set -euo pipefail
|
|
make up
|
|
|
|
- name: DNS test suite
|
|
shell: bash
|
|
env:
|
|
ENV_FILE: env.ci
|
|
INFINITO_DISTRO: ${{ matrix.distro }}
|
|
INFINITO_CONTAINER: infinito_nexus_${{ matrix.distro }}
|
|
run: |
|
|
set -euo pipefail
|
|
scripts/tests/dns.sh
|
|
|
|
- name: Dump CoreDNS logs on failure
|
|
if: failure()
|
|
shell: bash
|
|
run: |
|
|
docker ps -a || true
|
|
docker logs infinito-coredns --tail=200 || true
|
|
|
|
- name: Dump infinito logs on failure
|
|
if: failure()
|
|
shell: bash
|
|
env:
|
|
INFINITO_CONTAINER: infinito_nexus_${{ matrix.distro }}
|
|
run: |
|
|
docker logs "${INFINITO_CONTAINER}" --tail=200 || true
|