Files
shadowdaoandClaude Sonnet 5.5 854042b1c3 feat: PHP 8.6 for cac and cac-fpm (Remi php:remi-8.6), per-family version lists in plan-legs
install-php86.sh = install-php85.sh minus php-pecl-geoip (no 8.6 build), fail-loud with
extension assertion. plan-legs.sh: per-family lists so cac/cac-fpm get 82-86 while
cac-litespeed/cac-lsphp stay 82-85 (no lsphp86). :latest stays on php85. ini files are
shared (single prod-php.ini), so 8.5 hardening incl. session.use_strict_mode=0 applies unchanged.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0185ukXi4YX5FxJGqhi6qab6
2026-11-19 11:32:25 -08:00

94 lines
3.2 KiB
Bash
Executable File

#!/usr/bin/env bash
## plan-legs.sh - decide which image legs of build-push.yaml run.
##
## Env:
## ONLY workflow_dispatch input "only". Empty/blank (and every push
## event) = build everything, exactly as before.
## GITHUB_OUTPUT file the outputs are appended to (set by the runner).
##
## ONLY is a comma list of tokens (spaces ignored):
## cac:php86 cac-fpm:php84 cac-litespeed:php83 cac-lsphp:php82 one leg
## cac | cac-fpm | cac-litespeed | cac-lsphp every PHP version of that image
## (php86 exists for cac and cac-fpm only; lsphp86 does not exist yet)
## shared-httpd | shared-ols that image
## Any other token is an error (exit 2, nothing is written): a typo must fail
## the plan job loudly, never silently build nothing.
##
## Outputs (matrix families = JSON array of phpver, [] = skip the job;
## single-leg images = true|false):
## cac cac_fpm cac_litespeed cac_lsphp shared_httpd shared_ols
set -euo pipefail
MATRIX_FAMILIES=(cac cac-fpm cac-litespeed cac-lsphp)
SINGLE_FAMILIES=(shared-httpd shared-ols)
# PHP versions per family. cac/cac-fpm (AlmaLinux + Remi) also ship 8.6; the
# LiteSpeed families have no lsphp86 package yet, so they stay on 82..85 (a
# shared list would make every trunk push build, and fail, litespeed/lsphp php86).
declare -A FAM_PHPVER=(
[cac]="82 83 84 85 86"
[cac-fpm]="82 83 84 85 86"
[cac-litespeed]="82 83 84 85"
[cac-lsphp]="82 83 84 85"
)
die() { echo "plan-legs: $*" >&2; exit 2; }
only=${ONLY-}
only=${only//[[:space:]]/}
declare -A want_ver want_single
want_all=false
if [ -z "$only" ]; then
want_all=true
else
n=0
IFS=',' read -r -a toks <<< "$only"
for t in "${toks[@]}"; do
[ -n "$t" ] || continue
n=$((n + 1))
fam=${t%%:*}
ver=""
if [ "$fam" != "$t" ]; then
ver=${t#*:}
[ -n "$ver" ] || die "empty PHP version in '$t'"
fi
if [[ " ${MATRIX_FAMILIES[*]} " == *" $fam "* ]]; then
if [ -z "$ver" ]; then
for v in ${FAM_PHPVER[$fam]}; do want_ver["$fam:$v"]=1; done
elif [[ "$ver" =~ ^php(8[2-6])$ ]] && [[ " ${FAM_PHPVER[$fam]} " == *" ${BASH_REMATCH[1]} "* ]]; then
want_ver["$fam:${BASH_REMATCH[1]}"]=1
else
die "unknown PHP version in '$t' (${fam} has: ${FAM_PHPVER[$fam]// /, })"
fi
elif [[ " ${SINGLE_FAMILIES[*]} " == *" $fam "* ]]; then
[ "$fam" = "$t" ] || die "'$t': $fam has a single leg, use plain '$fam'"
want_single["$fam"]=1
else
die "unknown image '$t' (known: ${MATRIX_FAMILIES[*]} ${SINGLE_FAMILIES[*]})"
fi
done
[ "$n" -gt 0 ] || die "'only' has no usable entries: '$only'"
fi
matrix_json() { # family
local fam=$1 v out=""
for v in ${FAM_PHPVER[$fam]}; do
if $want_all || [ -n "${want_ver["$fam:$v"]-}" ]; then out+="${out:+,}$v"; fi
done
printf '[%s]' "$out"
}
single_json() { # family
if $want_all || [ -n "${want_single["$1"]-}" ]; then echo true; else echo false; fi
}
out=${GITHUB_OUTPUT:-/dev/stdout}
{
echo "cac=$(matrix_json cac)"
echo "cac_fpm=$(matrix_json cac-fpm)"
echo "cac_litespeed=$(matrix_json cac-litespeed)"
echo "cac_lsphp=$(matrix_json cac-lsphp)"
echo "shared_httpd=$(single_json shared-httpd)"
echo "shared_ols=$(single_json shared-ols)"
} >> "$out"