Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 1 addition & 27 deletions .github/workflows/patch-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ name: Patch Release
description: "Version to release (for example, v0.5.1)"
required: true
type: string
release_as_latest:
description: "Publish as latest release"
required: false
type: boolean
default: true
schedule:
- cron: "0 10 * * 4"

Expand Down Expand Up @@ -47,23 +42,6 @@ jobs:
id: scan
shell: bash
run: |
latest_branch=""
latest_major=0
latest_minor=0
for ref in $(git branch -r --list 'origin/release-v*'); do
branch="${ref#origin/}"
if [[ "$branch" =~ ^release-v([0-9]+)\.([0-9]+)\.x$ ]]; then
major="${BASH_REMATCH[1]}"
minor="${BASH_REMATCH[2]}"
if [ "$major" -gt "$latest_major" ] || { [ "$major" -eq "$latest_major" ] && [ "$minor" -gt "$latest_minor" ]; }; then
latest_major=$major
latest_minor=$minor
latest_branch=$branch
fi
fi
done
echo "::notice::Latest release branch: ${latest_branch}"

min_major="${MIN_RELEASE_VERSION%%.*}"
min_minor="${MIN_RELEASE_VERSION##*.}"
releases=()
Expand Down Expand Up @@ -93,9 +71,7 @@ jobs:
fi

next_version=$(echo "$last_tag" | awk -F. '{printf "%s.%s.%d", $1, $2, $3+1}')
is_latest=false
[ "$branch" = "$latest_branch" ] && is_latest=true
releases+=("{\"branch\":\"${branch}\",\"version\":\"${next_version}\",\"release_as_latest\":\"${is_latest}\"}")
releases+=("{\"branch\":\"${branch}\",\"version\":\"${next_version}\"}")
done

if [ ${#releases[@]} -eq 0 ]; then
Expand Down Expand Up @@ -133,7 +109,6 @@ jobs:
PAC_INCOMING_SECRET: ${{ secrets.PAC_INCOMING_SECRET }}
RELEASE_BRANCH: ${{ matrix.release.branch }}
RELEASE_VERSION: ${{ matrix.release.version }}
RELEASE_AS_LATEST: ${{ matrix.release.release_as_latest }}
run: bash ./hack/trigger-patch-release.sh

trigger-manual-release:
Expand Down Expand Up @@ -184,5 +159,4 @@ jobs:
PAC_INCOMING_SECRET: ${{ secrets.PAC_INCOMING_SECRET }}
RELEASE_BRANCH: ${{ inputs.branch }}
RELEASE_VERSION: ${{ inputs.version }}
RELEASE_AS_LATEST: ${{ inputs.release_as_latest }}
run: bash ./hack/trigger-patch-release.sh
56 changes: 56 additions & 0 deletions .github/workflows/release-smoke.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Released Artifact Smoke

"on":
pull_request:
paths:
- ".github/workflows/release-smoke.yaml"
- ".github/workflows/finalize-release.yaml"
- "hack/*release*.sh"
- "tekton/publish.yaml"
- "tekton/release-pipeline.yaml"
- "test/release-smoke/**"

permissions:
contents: read

concurrency:
group: release-smoke-${{ github.event.pull_request.number }}
cancel-in-progress: true

jobs:
smoke:
runs-on: ubuntu-latest
timeout-minutes: 40
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
- name: Install pinned Kind
run: |
GOTOOLCHAIN=local go install sigs.k8s.io/kind@v0.32.0
- name: Check smoke script behavior
run: |
bash -n hack/smoke-release.sh hack/smoke-release_test.sh
bash hack/smoke-release_test.sh
- name: Install and exercise the immutable release fixture
shell: bash
run: |
# A pinned public fixture tests installation, not the production trust bootstrap.
curl -fsSL https://infra.tekton.dev/tekton-releases/tekton-kueue/previous/v0.4.3/release.yaml \
-o "$RUNNER_TEMP/release.yaml"
printf '%s %s\n' \
340e21dbed798284de3e665e816e02f29f024af0cd32efa3cc98bbb7f9830270 \
"$RUNNER_TEMP/release.yaml" | sha256sum -c -
bash hack/smoke-release.sh "$RUNNER_TEMP/release.yaml" \
ghcr.io/tektoncd/tekton-kueue@sha256:6d89cbd8b47cebebc1c05c9e45292433e755372db68e0b66d5dd68d6ede9cb17 \
"$RUNNER_TEMP/release-smoke"
- name: Save smoke diagnostics
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: release-smoke-${{ github.run_id }}
path: ${{ runner.temp }}/release-smoke
if-no-files-found: ignore
23 changes: 23 additions & 0 deletions .github/workflows/release-verification.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Release artifact verification

on:
pull_request:
paths:
- hack/verify-release-artifacts.sh
- hack/verify-release-artifacts_test.sh
- .github/workflows/release-verification.yaml

permissions:
contents: read

jobs:
verify:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Check verifier syntax and behavior
run: |
bash -n hack/verify-release-artifacts.sh hack/verify-release-artifacts_test.sh
bash hack/verify-release-artifacts_test.sh
2 changes: 0 additions & 2 deletions .tekton/release-patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ spec:
value: tekton-robot
- name: releaseBucket
value: tekton-releases
- name: releaseAsLatest
value: "{{ release_as_latest }}"
- name: platforms
value: linux/amd64,linux/arm64,linux/s390x,linux/ppc64le
- name: serviceAccountImagesPath
Expand Down
2 changes: 0 additions & 2 deletions .tekton/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ spec:
value: tekton-robot
- name: releaseBucket
value: tekton-releases
- name: releaseAsLatest
value: "true"
- name: platforms
value: linux/amd64,linux/arm64,linux/s390x,linux/ppc64le
- name: serviceAccountImagesPath
Expand Down
214 changes: 214 additions & 0 deletions hack/smoke-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,214 @@
#!/usr/bin/env bash
set -euo pipefail

fail() { echo "release smoke failed: $*" >&2; exit 1; }
[[ $# == 3 ]] || fail "usage: $0 VERIFIED_MANIFEST EXPECTED_IMAGE ARTIFACT_DIR"
manifest=$1
image=$2
artifacts=$3
repository=ghcr.io/tektoncd/tekton-kueue
[[ $image =~ ^ghcr\.io/tektoncd/tekton-kueue@sha256:[0-9a-f]{64}$ ]] ||
fail "EXPECTED_IMAGE must be the canonical digest reference"
[[ -f $manifest && -r $manifest && -s $manifest ]] || fail "manifest must be a nonempty readable file"
[[ -n $artifacts && ! -L $artifacts ]] || fail "invalid artifact directory"
if [[ -e $artifacts ]]; then
[[ -d $artifacts && -z $(find "$artifacts" -mindepth 1 -print -quit) ]] ||
fail "artifact directory must be empty"
fi
for command in kind kubectl jq openssl; do
command -v "$command" >/dev/null || fail "missing command: $command"
done
root=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
work=$(mktemp -d)
cluster="release-smoke-$(basename "$work" | tr '[:upper:]._' '[:lower:]--')"
context="kind-$cluster"
export KUBECONFIG="$work/kubeconfig"
owned=false

k() { kubectl --context="$context" --request-timeout=30s "$@"; }
cleanup() {
status=$?
trap - EXIT
set +e
if [[ $owned == true ]]; then
for resource in pods deployments services endpoints events certificates \
pipelineruns.tekton.dev taskruns.tekton.dev workloads.kueue.x-k8s.io; do
k get "$resource" -A -o yaml > "$artifacts/$resource.yaml" 2>&1
done
k describe pods -A > "$artifacts/pod-descriptions.txt" 2>&1
for namespace in cert-manager kueue-system tekton-pipelines tekton-kueue release-smoke; do
pods=$(k get pods -n "$namespace" -o name)
for pod in $pods; do
k logs -n "$namespace" "$pod" --all-containers=true --prefix=true \
--tail=200 > "$artifacts/$namespace-${pod#*/}.log" 2>&1
done
done
kind export logs --name "$cluster" "$artifacts/kind" > "$artifacts/kind-export.log" 2>&1
kind delete cluster --name "$cluster" > "$artifacts/cleanup.log" 2>&1
if [[ $? != 0 ]]; then
echo "failed to delete owned cluster: $cluster" >&2
status=1
fi
fi
rm -rf "$work"
exit "$status"
}
trap cleanup EXIT
trap 'exit 130' INT
trap 'exit 143' TERM

# Parse the finished YAML locally, without discovery or the user's kubeconfig.
# This labels only the in-memory objects, never the installed release.
cp "$manifest" "$work/release.yaml"
kubectl label --local --overwrite -f "$work/release.yaml" -o json release-smoke-validation=true > "$work/manifest.json"
jq -e -s --arg repo "$repository" --arg digest "${image##*@}" '
[ .[] | if .kind == "List" then .items[] else . end ] as $objects
| [$objects[] | select(.kind == "Deployment")] as $deployments
| ($deployments | length == 2)
and ($deployments | map(.metadata.name) | sort ==
["tekton-kueue-controller-manager", "tekton-kueue-webhook"])
and all($deployments[];
.apiVersion == "apps/v1" and .metadata.namespace == "tekton-kueue"
and (.spec.template.spec.containers | length == 1)
and ((.spec.template.spec.initContainers // []) | length == 0))
and ([$objects[] | .. | objects | select(has("image")) | .image] |
length == 2 and all(.[];
type == "string" and
(split("@") | length == 2 and .[1] == $digest
and (.[0] == $repo or
(.[0] | startswith($repo + ":") and
(ltrimstr($repo + ":") | test("^[A-Za-z0-9_][A-Za-z0-9_.-]{0,127}$")))))))
' "$work/manifest.json" >/dev/null || fail "manifest controller/webhook images do not match EXPECTED_IMAGE"

mkdir -p "$artifacts"
artifacts=$(cd "$artifacts" && pwd)
cp "$work/release.yaml" "$artifacts/release.yaml"
printf '%s\n' "$image" > "$artifacts/expected-image.txt"
printf '%s\n' "$cluster" > "$artifacts/cluster-name.txt"
# Install only the snapshot checked above, even if the caller changes its file.
exec > >(tee "$artifacts/smoke.log") 2>&1
owned=true # Creation can fail after provisioning nodes; still clean up our name.
kind create cluster --name "$cluster" --kubeconfig "$KUBECONFIG" --wait 180s --retain \
--image kindest/node:v1.35.5@sha256:ce977ae6d65918d0b58a5f8b5e940429c2ce42fa3a5619ec2bbc60b949c0ac95

k apply --server-side -f https://github.com/cert-manager/cert-manager/releases/download/v1.19.2/cert-manager.yaml
k wait --for=condition=Available deployment --all -n cert-manager --timeout=300s
k apply --server-side -f https://github.com/kubernetes-sigs/kueue/releases/download/v0.16.6/manifests.yaml \
-f "$root/hack/kueue-config.yaml"
k rollout restart deployment/kueue-controller-manager -n kueue-system
k rollout status deployment/kueue-controller-manager -n kueue-system --timeout=300s
k apply --server-side -f https://github.com/tektoncd/pipeline/releases/download/v1.15.0/release.yaml
k wait --for=condition=Available deployment --all -n tekton-pipelines --timeout=300s
k apply --server-side -f "$work/release.yaml"
k wait --for=condition=Ready certificate --all -n tekton-kueue --timeout=300s
k rollout status deployment/tekton-kueue-controller-manager -n tekton-kueue --timeout=300s
k rollout status deployment/tekton-kueue-webhook -n tekton-kueue --timeout=300s
k wait --for=jsonpath='{.webhooks[0].clientConfig.caBundle}' \
mutatingwebhookconfiguration/tekton-kueue-mutating-webhook-configuration --timeout=300s

# Configure one CPU resource mutation. Restart after configuration so the new
# webhook starts with the ConfigMap already present, rather than racing reload.
k apply -f - <<'YAML'
apiVersion: v1
kind: ConfigMap
metadata:
name: tekton-kueue-config
namespace: tekton-kueue
data:
config.yaml: |
queueName: pipelines-queue
cel:
expressions:
- resource("cpu", 1)
---
apiVersion: v1
kind: Namespace
metadata:
name: release-smoke
---
apiVersion: kueue.x-k8s.io/v1beta2
kind: ResourceFlavor
metadata:
name: release-smoke
spec: {}
---
apiVersion: kueue.x-k8s.io/v1beta2
kind: ClusterQueue
metadata:
name: release-smoke
spec:
namespaceSelector: {}
resourceGroups:
- coveredResources: ["cpu", "tekton.dev/pipelineruns"]
flavors:
- name: release-smoke
resources:
- name: cpu
nominalQuota: 1
- name: tekton.dev/pipelineruns
nominalQuota: 1
---
apiVersion: kueue.x-k8s.io/v1beta2
kind: LocalQueue
metadata:
name: pipelines-queue
namespace: release-smoke
spec:
clusterQueue: release-smoke
YAML
k get pods -n tekton-kueue -l app.kubernetes.io/name=tekton-kueue-webhook -o json \
> "$work/old-webhook-pods.json"
k rollout restart deployment/tekton-kueue-webhook -n tekton-kueue
k rollout status deployment/tekton-kueue-webhook -n tekton-kueue --timeout=300s
# Deployment availability alone can precede removal of the old Service endpoint.
# Watch the old Pods disappear and the endpoint switch before admission.
while IFS= read -r pod; do
k wait --for=delete "pod/$pod" -n tekton-kueue --timeout=300s
done < <(jq -r '.items[].metadata.name' "$work/old-webhook-pods.json")
k get pods -n tekton-kueue -l app.kubernetes.io/name=tekton-kueue-webhook -o json \
> "$work/webhook-pods.json"
pod=$(jq -er '[.items[] | select(.metadata.deletionTimestamp == null)] |
if length == 1 then .[0].metadata.name else error("expected one webhook Pod") end' "$work/webhook-pods.json")
k wait --for=jsonpath='{.subsets[0].addresses[0].targetRef.name}'="$pod" \
endpoints/tekton-kueue-webhook-service -n tekton-kueue --timeout=120s
k wait --for=condition=Active clusterqueue/release-smoke --timeout=120s
k wait --for=condition=Active localqueue/pipelines-queue -n release-smoke --timeout=120s
k create -f - -o json > "$artifacts/created-pipelinerun.json" <<'YAML'
apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
name: release-smoke
namespace: release-smoke
spec:
timeouts:
pipeline: 5m0s
pipelineSpec:
tasks:
- name: hello
taskSpec:
steps:
- name: hello
image: registry.access.redhat.com/ubi9/ubi@sha256:66233eebd72bb5baa25190d4f55e1dc3fff3a9b77186c1f91a0abdb274452072
command: ["/bin/echo", "release smoke"]
YAML
# The create response is the admission result, before controller updates.
jq -e '.spec.status == "PipelineRunPending"
and .metadata.labels["kueue.x-k8s.io/queue-name"] == "pipelines-queue"
and .metadata.annotations["kueue.konflux-ci.dev/requests-cpu"] == "1"
and (.metadata.uid | type == "string" and length > 0)
' "$artifacts/created-pipelinerun.json" >/dev/null || fail "webhook mutation missing"
uid=$(jq -r .metadata.uid "$artifacts/created-pipelinerun.json")
# Kueue v0.16.6 GetWorkloadNameForOwnerWithGVK hashes kind, group, name, UID.
hash=$(printf 'PipelineRun\ntekton.dev\nrelease-smoke\n%s' "$uid" | openssl dgst -sha1 -r)
workload="workload/pipelinerun-release-smoke-${hash:0:5}"
k wait --for=create "$workload" -n release-smoke --timeout=120s
k get "$workload" -n release-smoke -o json > "$artifacts/created-workload.json"
jq -e --arg uid "$uid" '
any(.metadata.ownerReferences[]; .uid == $uid and .kind == "PipelineRun" and .controller == true)
and .spec.queueName == "pipelines-queue"
and .spec.podSets[0].template.spec.containers[0].resources.requests.cpu == "1"
and .spec.podSets[0].template.spec.containers[0].resources.requests["tekton.dev/pipelineruns"] == "1"
' "$artifacts/created-workload.json" >/dev/null || fail "Workload does not represent the mutated PipelineRun"
k wait --for=condition=Admitted "$workload" -n release-smoke --timeout=300s
k wait --for=condition=Succeeded pipelinerun/release-smoke -n release-smoke --timeout=360s
echo "PASS published release $image"
Loading
Loading