cleanup_lane_state() { local lane="$1" local coordination="$2" local target="$4" local status=0 if fixture_has_family durable; then cleanup_lane_durable_store "$lane" || status=1 fi if fixture_has_family coordination; then cleanup_lane_coordination_store "$coordination" "$lane" || status=1 fi if fixture_has_family target; then cleanup_lane_target_store "$target" "nuthatch-lane-$lane" || status=1 fi return "$status" } cleanup_lane_resources() { local job="$1" local profile="$2" kube --namespace "$FIXTURE_NAMESPACE" delete \ "job/$job" \ "configmap/$profile" \ "configmap/$profile-file" \ "secret/nuthatch-oidc-automation-${profile##*-}" \ --ignore-not-found >/dev/null || return rm -f \ "$RUNTIME/$profile.env" \ "$RUNTIME/$profile.env.oidc-secret" \ "$RUNTIME/$job.yaml" } run_job_matrix() { local base_job="$1" local manifest="$2" local image="$3" shift 3 local lane local coordination local oidc local target local profile local job select_fixture_families "$@" || return while IFS=$'\t' read -r lane coordination oidc target; do profile="$(write_lane_profile "$lane" "$coordination" "$oidc" "$target")" || return job="$base_job-$lane" render_lane_job "$job" "$manifest" "$image" "$profile" || return printf 'Running lane %s: coordination=%s oidc=%s target=%s\n' \ "$lane" "$coordination" "$oidc" "$target" run_job_manifest "$job" "$RUNTIME/$job.yaml" || return cleanup_lane_state "$lane" "$coordination" "$oidc" "$target" || return cleanup_lane_resources "$job" "$profile" || return done < <(expand_fixture_matrix "$@") }