Skip to content

Add a dry-run switch for workflow dispatch #210

Add a dry-run switch for workflow dispatch

Add a dry-run switch for workflow dispatch #210

Workflow file for this run

name: Container Images
on:
pull_request:
branches:
- main
push:
branches:
- main
schedule:
- cron: '30 3 * * 0'
workflow_dispatch:
inputs:
wanted:
description: >
Build selected suites. Use "all" for all buildable suites, "active"
for all non-EOL suites, "eol" for all EOL-ed suites, or
comma-separated codenames. Default is "active".
type: string
default: 'active'
dry_run:
description: 'Do not push to registry'
type: boolean
default: true
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
matrix:
name: Build Matrix
runs-on: ubuntu-latest
outputs:
full_json: ${{ steps.releases.outputs.json }}
codenames: ${{ steps.pp.outputs.codenames }}
codename_arch: ${{ steps.pp.outputs.codename_arch }}
steps:
- name: Releases Info
id: releases
uses: vicamo/actions-library/debian-releases@v1
- name: Post Processing
id: pp
env:
FULL_JSON: ${{ steps.releases.outputs.json }}
run: |
platforms='[
["amd64", "linux/amd64"],
["arm", "linux/arm"],
["arm64", "linux/arm64/v8"],
["armel", "linux/arm/v5"],
["armhf", "linux/arm/v7"],
["i386", "linux/386"],
["loong64", "linux/loong64"],
["mips64el", "linux/mips64le"],
["ppc64el", "linux/ppc64le"],
["riscv64", "linux/riscv64"],
["s390x", "linux/s390x"],
["mips", "linux/mips"],
["mipsel", "linux/mipsle"],
["powerpc", "linux/ppc"],
["ppc64", "linux/ppc64"],
["s390", "linux/s390"],
["sparc", "linux/sparc"],
["sparc64", "linux/sparc64"],
["x32", "linux/amd64p32"],
["alpha", "linux/alpha"],
["hppa", "linux/hppa"],
["m68k", "linux/m68k"],
["sh4", "linux/sh4"]
]'
disabled_codename='["experimental"]'
disabled_arches='[
"hurd-amd64",
"hurd-i386",
"ia64",
"kfreebsd-amd64",
"kfreebsd-i386",
"s390",
"x32"
]'
known_failures='[]'
pin_timestamp='[
["buster", "armel", "2024/04/13 14:49:39"],
["buster", "mips", "2024/04/13 14:49:39"],
["buster", "mips64el", "2024/04/13 14:49:39"],
["buster", "mipsel", "2024/04/13 14:49:39"],
["buster", "ppc64el", "2024/04/13 14:49:39"],
["buster", "s390x", "2024/04/13 14:49:39"]
]'
pin_qemu='[
["any", "alpha", "deb"],
["any", "hppa", "deb"],
["any", "loong64", "deb"],
["any", "m68k", "deb"],
["any", "mips", "deb"],
["any", "mips64el", "deb"],
["any", "mipsel", "deb"],
["any", "powerpc", "deb"],
["any", "ppc64", "deb"],
["any", "sh4", "deb"],
["any", "sparc", "deb"],
["any", "sparc64", "deb"]
]'
include_pkgs='[
["sid", "loong64", "gpgv"],
["sid", "powerpc", "gpgv"],
["sid", "ppc64", "gpgv"],
["sid", "sparc64", "gpgv"]
]'
codenames="$(echo "${FULL_JSON}" |
jq -c -M 'map(select(.codename as $c |
'"${disabled_codename}"' |
index($c) == null)) |
map(. as $s |
$s.mirrors[0].pockets[$s.codename].architectures as $da |
$s |
{
"distribution":.distribution,
"codename":.codename,
"suite":.suite,
"active":.active,
"architectures":(.architectures - '"${disabled_arches}"' |
map({
"arch":.,
"platform":(. as $arch |
'"${platforms}"' |
map(select(.[0] == $arch))[0][1]),
"use_ports":(. as $arch |
$da |
index($arch) == null),
"known_failure":(. as $arch |
'"${known_failures}"' |
map(select((.[0] == $s.codename) and (.[1] == $arch)) | .[2]) |
first),
"timestamp":(. as $arch |
'"${pin_timestamp}"' |
map(select((.[0] == $s.codename) and (.[1] == $arch)) | .[2]) |
first),
"qemu":(. as $arch |
'"${pin_qemu}"' |
map(select(((.[0] == $s.codename) and (.[1] == $arch))
or ((.[0] == "any") and (.[1] == $arch))
or ((.[0] == $s.codename) and (.[1] == "any"))) | .[2]) |
first),
"pkgs":(. as $arch |
'"${include_pkgs}"' |
map(select(((.[0] == $s.codename) and (.[1] == $arch))) | .[2]) |
first),
}) |
tostring)
})')"
case "${{ inputs.wanted || 'active' }}" in
all) ;;
active)
codenames="$(echo "${codenames}" | jq -c -M 'map(select(.active))')"
;;
eol)
codenames="$(echo "${codenames}" | jq -c -M 'map(select(.active | not))')"
;;
*)
wanted="$(echo "${{ inputs.wanted }}" | sed 's/ //g; s/\([^,]\+\)/"\1"/g')"
codenames="$(echo "${codenames}" |
jq -c -M 'map(. as $row |
['"${wanted}"'] | .[] | select($row.codename == .) |
$row)')"
;;
esac
echo "::group::Built JSON(codenames)"
echo "${codenames}" | jq
echo "::endgroup::"
echo "codenames=${codenames}" | tee -a "${GITHUB_OUTPUT}"
debuerreotype:
runs-on: ubuntu-latest
steps:
- name: Checkout Debuerreotype
uses: actions/checkout@v4
with:
fetch-depth: 1
repository: ${{ github.repository }}
ref: helper/20240509
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
version: v0.12.0
- name: Build and push
uses: docker/build-push-action@v6
with:
context: '.'
outputs: type=docker,dest=/tmp/debuerreotype.tar
tags: local/debuerreotype:latest
- name: Upload debuerreotype image tarball
uses: actions/upload-artifact@v4
with:
name: debuerreotype
path: /tmp/debuerreotype.tar
per-suite:
name: Per Suite
needs:
- debuerreotype
- matrix
strategy:
fail-fast: false
max-parallel: 1
matrix:
include: ${{ fromJSON(needs.matrix.outputs.codenames) }}
uses: ./.github/workflows/per-suite.yml
secrets:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
with:
distribution: ${{ matrix.distribution }}
codename: ${{ matrix.codename }}
suite: ${{ matrix.suite }}
active: ${{ matrix.active }}
architectures: ${{ matrix.architectures }}
repository: 'vicamo/debian'
dry_run:
${{ github.ref_name != 'main' || (github.event_name ==
'workflow_dispatch' && inputs.dry_run) }}