Skip to content

Commit b5d2636

Browse files
authored
v0.9.73: mcp oauth client metadata, kubernetes sandbox provider, list_my_activity ga
2 parents 716d49c + f0df3cc commit b5d2636

345 files changed

Lines changed: 97502 additions & 3751 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/actionlint.yaml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Runner labels actionlint cannot know: GitHub larger runners defined for this
2+
# organization. Workflows that pick one through a CI_PROVIDER expression were never
3+
# checked; a workflow that names one directly is.
4+
self-hosted-runner:
5+
labels:
6+
- linux-x64-8-core
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: attest-image
2+
description: >-
3+
Attest and sign one pushed image by digest: an SPDX SBOM attestation when
4+
sbom-image is set, build provenance, and a keyless Cosign signature, all pushed to
5+
the registry beside the image. Needs a registry login and the job permissions
6+
id-token, attestations, artifact-metadata, and packages write.
7+
8+
inputs:
9+
image:
10+
description: Image repository, without tag or digest.
11+
required: true
12+
digest:
13+
description: Digest of the pushed image or index (sha256:...).
14+
required: true
15+
sbom-image:
16+
description: Reference to generate the SBOM from. Empty attests provenance only.
17+
required: false
18+
default: ''
19+
20+
runs:
21+
using: composite
22+
steps:
23+
- name: Generate SBOM
24+
if: inputs.sbom-image != ''
25+
uses: anchore/sbom-action@dfcb83b97731532d72be422cbc51ee64adb6fd56 # v0.24.4
26+
with:
27+
image: ${{ inputs.sbom-image }}
28+
format: spdx-json
29+
output-file: sbom.spdx.json
30+
upload-artifact: false
31+
upload-release-assets: false
32+
33+
- name: Attest SBOM
34+
if: inputs.sbom-image != ''
35+
uses: actions/attest@1e69f48acb82d1966a394da916b4c1698aa569d6 # v4.2.2
36+
with:
37+
subject-name: ${{ inputs.image }}
38+
subject-digest: ${{ inputs.digest }}
39+
sbom-path: sbom.spdx.json
40+
push-to-registry: true
41+
42+
- name: Attest build provenance
43+
uses: actions/attest@1e69f48acb82d1966a394da916b4c1698aa569d6 # v4.2.2
44+
with:
45+
subject-name: ${{ inputs.image }}
46+
subject-digest: ${{ inputs.digest }}
47+
push-to-registry: true
48+
49+
- name: Install Cosign
50+
uses: sigstore/cosign-installer@881c63bd87e38389154debd8331404ce7ca8a3ab # v4.1.4
51+
52+
- name: Sign image
53+
shell: bash
54+
env:
55+
IMAGE: ${{ inputs.image }}
56+
DIGEST: ${{ inputs.digest }}
57+
run: cosign sign --yes "${IMAGE}@${DIGEST}"

‎.github/actions/image/action.yml‎

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,16 @@ inputs:
1717
description: Target platforms, e.g. linux/amd64.
1818
required: true
1919
tags:
20-
description: Comma-separated list of tags to push.
20+
description: Comma-separated list of tags to push (or to load, when push is off).
2121
required: true
22+
push:
23+
description: Push the tags to their registries. 'false' builds without publishing, for validation.
24+
required: false
25+
default: 'true'
26+
load:
27+
description: Load the built image into the runner's Docker daemon, so later steps can run it.
28+
required: false
29+
default: 'false'
2230
build-args:
2331
description: Newline-separated Docker build arguments.
2432
required: false
@@ -27,6 +35,13 @@ inputs:
2735
description: Dockerfile stage to build. Empty builds the final stage.
2836
required: false
2937
default: ''
38+
cache-key-suffix:
39+
description: >-
40+
Appended to the Blacksmith layer cache key, so a caller that must not share
41+
the deploy pipeline's sticky disk (a pull request build) gets its own. Empty
42+
keeps the shared key.
43+
required: false
44+
default: ''
3045
max-cache-size-mb:
3146
description: >-
3247
Layer cache to retain after this action prunes, in MB. Must stay above one
@@ -58,7 +73,8 @@ runs:
5873
env:
5974
FILE: ${{ inputs.file }}
6075
PLATFORMS: ${{ inputs.platforms }}
61-
run: echo "value=${GITHUB_REPOSITORY##*/}/${FILE#./}/${PLATFORMS//\//-}" >> "$GITHUB_OUTPUT"
76+
SUFFIX: ${{ inputs.cache-key-suffix }}
77+
run: echo "value=${GITHUB_REPOSITORY##*/}/${FILE#./}/${PLATFORMS//\//-}${SUFFIX}" >> "$GITHUB_OUTPUT"
6278

6379
# This action does NOT bound the disk — see the prune step below. BuildKit's
6480
# own GC is time-based only (layers unused for 8 days), and these disks are
@@ -78,7 +94,8 @@ runs:
7894
context: ${{ inputs.context }}
7995
file: ${{ inputs.file }}
8096
platforms: ${{ inputs.platforms }}
81-
push: true
97+
push: ${{ inputs.push }}
98+
load: ${{ inputs.load }}
8299
tags: ${{ inputs.tags }}
83100
build-args: ${{ inputs.build-args }}
84101
target: ${{ inputs.target }}
@@ -185,7 +202,8 @@ runs:
185202
context: ${{ inputs.context }}
186203
file: ${{ inputs.file }}
187204
platforms: ${{ inputs.platforms }}
188-
push: true
205+
push: ${{ inputs.push }}
206+
load: ${{ inputs.load }}
189207
tags: ${{ inputs.tags }}
190208
build-args: ${{ inputs.build-args }}
191209
target: ${{ inputs.target }}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: k3s-diagnostics
2+
description: >-
3+
Collect what explains a failed k3s run into $RUNNER_TEMP/diagnostics: every pod,
4+
pod descriptions for the given namespaces, the app's and its migrations' logs when
5+
a release namespace is given, cluster events, the k3s journal, and disk usage.
6+
Each command writes its own error into its file, so one failing never hides the rest.
7+
8+
inputs:
9+
describe-namespaces:
10+
description: Space-separated namespaces whose pods to describe.
11+
required: true
12+
app-namespace:
13+
description: Namespace of the Helm release whose app logs to collect. Empty skips them.
14+
required: false
15+
default: ''
16+
17+
runs:
18+
using: composite
19+
steps:
20+
- name: Collect diagnostics
21+
shell: bash
22+
env:
23+
DESCRIBE_NAMESPACES: ${{ inputs.describe-namespaces }}
24+
APP_NAMESPACE: ${{ inputs.app-namespace }}
25+
run: |
26+
# Best effort by design: a command that fails records its error in its file
27+
# and the collection goes on.
28+
set +e
29+
out="$RUNNER_TEMP/diagnostics"
30+
mkdir -p "$out"
31+
kubectl get pods --all-namespaces -o wide > "$out/pods.txt" 2>&1
32+
for namespace in $DESCRIBE_NAMESPACES; do
33+
kubectl describe pods --namespace "$namespace" > "$out/pods-${namespace}.txt" 2>&1
34+
done
35+
if [ -n "$APP_NAMESPACE" ]; then
36+
kubectl logs --namespace "$APP_NAMESPACE" deploy/sim-app -c migrations --tail=200 > "$out/migrations.log" 2>&1
37+
kubectl logs --namespace "$APP_NAMESPACE" deploy/sim-app --tail=2000 > "$out/app.log" 2>&1
38+
fi
39+
kubectl get events --all-namespaces --sort-by=.lastTimestamp > "$out/events.txt" 2>&1
40+
sudo journalctl --unit k3s --no-pager --lines 2000 > "$out/k3s.log" 2>&1
41+
df -h / > "$out/disk.txt" 2>&1
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
name: k3s-gvisor
2+
description: >-
3+
Start a single-node k3s cluster whose containerd carries gVisor (runsc) as a runtime
4+
handler, with k3s's built-in kube-router NetworkPolicy controller, plus Helm. Exports
5+
KUBECONFIG (cluster-admin) and NODE_IP to later steps. For ephemeral GitHub-hosted VMs.
6+
7+
# Pinned with their published checksums; bump each version and checksum together.
8+
inputs:
9+
k3s-version:
10+
description: k3s release.
11+
required: false
12+
default: v1.36.6+k3s1
13+
k3s-sha256:
14+
description: sha256 of that release's amd64 `k3s` binary (sha256sum-amd64.txt).
15+
required: false
16+
default: 66ceb8e67edfa547195135d74783bfadc2ecc04a91059e90ae5f70a3dbc98c15
17+
gvisor-release:
18+
description: gVisor release (storage.googleapis.com/gvisor/releases/release/<release>).
19+
required: false
20+
default: '20261123.2'
21+
gvisor-sha512:
22+
description: sha512 of that release's x86_64 gvisor.tar.bz2.
23+
required: false
24+
default: bd0c27a0ad9489d5df82bce740512311db01755e2bc5be66564bbdf8febddf8eec46881a1d02fc79f7b2d167b6a320dc7596259df4d20f2e8dcf36db2273e967
25+
26+
outputs:
27+
node-ip:
28+
description: The node's address, which pods reach the runner at.
29+
value: ${{ steps.k3s.outputs.node-ip }}
30+
31+
runs:
32+
using: composite
33+
steps:
34+
# Sandbox images are several GB and live twice (Docker, then containerd).
35+
- name: Free disk space
36+
shell: bash
37+
run: |
38+
set -euo pipefail
39+
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL
40+
df -h /
41+
42+
- name: Install gVisor
43+
shell: bash
44+
env:
45+
GVISOR_RELEASE: ${{ inputs.gvisor-release }}
46+
GVISOR_SHA512: ${{ inputs.gvisor-sha512 }}
47+
run: |
48+
set -euo pipefail
49+
workdir="$(mktemp -d)"
50+
curl -fsSL --retry 3 --retry-all-errors \
51+
"https://storage.googleapis.com/gvisor/releases/release/${GVISOR_RELEASE}/x86_64/gvisor.tar.bz2" \
52+
-o "${workdir}/gvisor.tar.bz2"
53+
echo "${GVISOR_SHA512} ${workdir}/gvisor.tar.bz2" | sha512sum -c -
54+
tar -xjf "${workdir}/gvisor.tar.bz2" -C "$workdir"
55+
sudo install -m 0755 "${workdir}/runsc" "${workdir}/containerd-shim-runsc-v1" /usr/local/bin/
56+
# runsc runs its sentry and helpers from gvisor-bin/ beside its own binary.
57+
sudo install -d -m 0755 /usr/local/bin/gvisor-bin
58+
sudo install -m 0755 "${workdir}"/gvisor-bin/* /usr/local/bin/gvisor-bin/
59+
runsc --version
60+
61+
- name: Install and start k3s
62+
id: k3s
63+
shell: bash
64+
env:
65+
K3S_VERSION: ${{ inputs.k3s-version }}
66+
K3S_SHA256: ${{ inputs.k3s-sha256 }}
67+
run: |
68+
set -euo pipefail
69+
curl -fsSL --retry 3 --retry-all-errors \
70+
"https://github.com/k3s-io/k3s/releases/download/${K3S_VERSION//+/%2B}/k3s" -o /tmp/k3s
71+
echo "${K3S_SHA256} /tmp/k3s" | sha256sum -c -
72+
sudo install -m 0755 /tmp/k3s /usr/local/bin/k3s
73+
# k3s's embedded kubectl, so the client matches the server exactly.
74+
sudo ln -sf /usr/local/bin/k3s /usr/local/bin/kubectl
75+
76+
# runsc must use the same cgroup driver as the kubelet. k3s picks it at
77+
# start and exposes it to the template as .SystemdCgroup, so one runsc
78+
# config exists per value and the template selects the matching one.
79+
sudo mkdir -p /etc/containerd /var/lib/rancher/k3s/agent/etc/containerd
80+
printf '[runsc_config]\n systemd-cgroup = "true"\n' | sudo tee /etc/containerd/runsc-systemd-true.toml > /dev/null
81+
printf '[runsc_config]\n systemd-cgroup = "false"\n' | sudo tee /etc/containerd/runsc-systemd-false.toml > /dev/null
82+
sudo tee /var/lib/rancher/k3s/agent/etc/containerd/config-v3.toml.tmpl > /dev/null <<'EOF'
83+
{{ template "base" . }}
84+
85+
[plugins.'io.containerd.cri.v1.runtime'.containerd.runtimes.runsc]
86+
runtime_type = "io.containerd.runsc.v1"
87+
[plugins.'io.containerd.cri.v1.runtime'.containerd.runtimes.runsc.options]
88+
TypeUrl = "io.containerd.runsc.v1.options"
89+
ConfigPath = "/etc/containerd/runsc-systemd-{{ .SystemdCgroup }}.toml"
90+
EOF
91+
92+
node_ip="$(ip -4 route get 1.1.1.1 | awk '{for (i = 1; i < NF; i++) if ($i == "src") print $(i + 1)}')"
93+
echo "NODE_IP=${node_ip}" >> "$GITHUB_ENV"
94+
echo "node-ip=${node_ip}" >> "$GITHUB_OUTPUT"
95+
96+
# NetworkPolicy enforcement is k3s's default (its embedded kube-router
97+
# controller); only --disable-network-policy turns it off, and it is
98+
# deliberately absent.
99+
sudo systemd-run --unit=k3s --description='k3s server' \
100+
-p Type=notify -p Delegate=yes -p KillMode=process -p TimeoutStartSec=300 \
101+
-p LimitNOFILE=1048576 -p LimitNPROC=infinity -p LimitCORE=infinity -p TasksMax=infinity \
102+
/usr/local/bin/k3s server \
103+
--node-ip "$node_ip" \
104+
--disable=traefik,metrics-server,servicelb \
105+
--write-kubeconfig-mode=0600
106+
107+
mkdir -p "$HOME/.kube"
108+
sudo install -m 0600 -o "$(id -u)" -g "$(id -g)" /etc/rancher/k3s/k3s.yaml "$HOME/.kube/admin.yaml"
109+
echo "KUBECONFIG=$HOME/.kube/admin.yaml" >> "$GITHUB_ENV"
110+
111+
- name: Wait for the cluster
112+
shell: bash
113+
run: |
114+
set -euo pipefail
115+
# The node and CoreDNS objects appear a few seconds after the API does.
116+
for _ in $(seq 1 60); do
117+
if kubectl get node -o name | grep -q . && kubectl -n kube-system get deployment coredns > /dev/null 2>&1; then
118+
break
119+
fi
120+
sleep 3
121+
done
122+
kubectl wait --for=condition=Ready node --all --timeout=180s
123+
kubectl -n kube-system rollout status deployment/coredns --timeout=180s
124+
kubectl version
125+
sudo grep -A3 "runtimes.runsc" /var/lib/rancher/k3s/agent/etc/containerd/config.toml
126+
127+
- name: Set up Helm
128+
uses: azure/setup-helm@2f5e7bc67f1f9972ab16657bb795f36d8f04de0e # v5.1.0
129+
with:
130+
version: v3.16.4
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: k3s-image
2+
description: >-
3+
Put one image into the local k3s containerd, so pods start from it without a
4+
registry. With `kind`, a sandbox image at the content-addressed reference
5+
images.generated.json names: with `archive: 'true'`, imported from the workflow's
6+
`sandbox-image-<kind>` artifact (a `ref` file naming the image, plus its
7+
`docker save` archive as `image.tar`), else pulled from GHCR, where that
8+
reference already holds the same image. With `artifact` and `tag`, an image built
9+
from this checkout, imported from that artifact in the same layout.
10+
11+
inputs:
12+
kind:
13+
description: Sandbox image kind in images.generated.json (agent, function, pi). Instead of artifact and tag.
14+
required: false
15+
default: ''
16+
archive:
17+
description: With kind, 'true' when the workflow built the image and uploaded its archive.
18+
required: false
19+
default: 'false'
20+
artifact:
21+
description: Name of the artifact holding the image. Needs tag.
22+
required: false
23+
default: ''
24+
tag:
25+
description: Reference the artifact holds, exactly as pods will name it.
26+
required: false
27+
default: ''
28+
29+
outputs:
30+
ref:
31+
description: The image reference now in k3s.
32+
value: ${{ steps.ref.outputs.ref }}
33+
34+
runs:
35+
using: composite
36+
steps:
37+
- name: Resolve image reference
38+
id: ref
39+
shell: bash
40+
env:
41+
KIND: ${{ inputs.kind }}
42+
ARCHIVE: ${{ inputs.archive }}
43+
ARTIFACT: ${{ inputs.artifact }}
44+
TAG: ${{ inputs.tag }}
45+
MANIFEST: apps/sim/lib/execution/remote-sandbox/kubernetes/images.generated.json
46+
run: |
47+
set -euo pipefail
48+
if [ -n "$KIND" ] && [ -z "$ARTIFACT" ] && [ -z "$TAG" ]; then
49+
echo "ref=$(jq -er --arg kind "$KIND" '.[$kind]' "$MANIFEST")" >> "$GITHUB_OUTPUT"
50+
if [ "$ARCHIVE" = "true" ]; then
51+
echo "artifact=sandbox-image-${KIND}" >> "$GITHUB_OUTPUT"
52+
fi
53+
elif [ -z "$KIND" ] && [ -n "$ARTIFACT" ] && [ -n "$TAG" ]; then
54+
echo "ref=${TAG}" >> "$GITHUB_OUTPUT"
55+
echo "artifact=${ARTIFACT}" >> "$GITHUB_OUTPUT"
56+
else
57+
echo "::error::k3s-image takes kind, or artifact and tag"
58+
exit 1
59+
fi
60+
61+
- name: Pull image
62+
if: steps.ref.outputs.artifact == ''
63+
shell: bash
64+
env:
65+
IMAGE: ${{ steps.ref.outputs.ref }}
66+
run: sudo k3s crictl pull "$IMAGE"
67+
68+
- name: Download image
69+
if: steps.ref.outputs.artifact != ''
70+
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
71+
with:
72+
name: ${{ steps.ref.outputs.artifact }}
73+
path: ${{ runner.temp }}/${{ steps.ref.outputs.artifact }}
74+
75+
- name: Import image
76+
if: steps.ref.outputs.artifact != ''
77+
shell: bash
78+
env:
79+
DIR: ${{ runner.temp }}/${{ steps.ref.outputs.artifact }}
80+
IMAGE: ${{ steps.ref.outputs.ref }}
81+
run: |
82+
set -euo pipefail
83+
if [ "$(cat "${DIR}/ref")" != "$IMAGE" ]; then
84+
echo "::error::The ${DIR##*/} artifact holds $(cat "${DIR}/ref"), not ${IMAGE}"
85+
exit 1
86+
fi
87+
sudo k3s ctr -n k8s.io images import "${DIR}/image.tar"
88+
rm -rf "$DIR"
89+
df -h /

0 commit comments

Comments
 (0)