Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
7c1c78d
improvement(sandbox): derive provider availability and seams from dec…
waleedlatif1 Dec 2, 2026
7c1edd7
improvement(sandbox): parameterize provider conformance suite by a fi…
waleedlatif1 Dec 2, 2026
c39108c
improvement(sandbox): pin provider lists, test the kind gate, and doc…
waleedlatif1 Dec 2, 2026
853bb11
feat(sandbox): generate content-addressed Function and Pi sandbox ima…
waleedlatif1 Dec 2, 2026
fd6edd9
feat(sandbox): publish the sandbox images from their own workflow
waleedlatif1 Dec 2, 2026
5773a90
feat(sandbox): add sim-sandbox-agent and its wire protocol
waleedlatif1 Dec 2, 2026
11dea32
refactor(sandbox): share process-backed runCode between providers
waleedlatif1 Dec 2, 2026
192b777
feat(sandbox): add a SandboxHandle over the sandbox agent protocol
waleedlatif1 Dec 2, 2026
6bc5ae1
feat(sandbox): add the sandbox-agent carrier image
waleedlatif1 Dec 2, 2026
5b49148
fix(sandbox): pass the image environment to sandbox processes
waleedlatif1 Dec 2, 2026
599be28
fix(sandbox): run sandbox-user file operations in an unprivileged worker
waleedlatif1 Dec 2, 2026
9657737
fix(sandbox): coalesce process output and stream events on demand
waleedlatif1 Dec 2, 2026
c43e59d
fix(sandbox): bound agent request bodies, in-flight requests, and idl…
waleedlatif1 Dec 2, 2026
b6fe472
fix(sandbox): bound directory walks by names visited and shorten stag…
waleedlatif1 Dec 2, 2026
9e6840f
test(sandbox): hold the agent's in-flight cap open with raw sockets
waleedlatif1 Dec 2, 2026
7fdf610
fix(sandbox): refuse a root sandbox user and only hand over homes the…
waleedlatif1 Dec 2, 2026
1aaee8c
fix(sandbox): re-exec the CLI verifier from /proc/self/exe and docume…
waleedlatif1 Dec 2, 2026
93bac66
build(sandbox): pin the sandbox-agent builder base image by digest
waleedlatif1 Dec 2, 2026
4e9fd56
fix(sandbox): settle session commands and report lifetime expiry in t…
waleedlatif1 Dec 2, 2026
0cb6d8c
refactor(sandbox): share login-shell PATH handling and environment va…
waleedlatif1 Dec 2, 2026
646f114
fix(sandbox): settle agent session commands like E2B and surface life…
waleedlatif1 Dec 2, 2026
24e4981
feat(sandbox): add the Kubernetes sandbox provider
waleedlatif1 Dec 2, 2026
1ee01f4
feat(sandbox): hash every input of the agent image build
waleedlatif1 Dec 2, 2026
c71aa85
feat(sandbox): sweep finished and orphaned sandboxes from the session…
waleedlatif1 Dec 2, 2026
09604f8
fix(sandbox): recognise only isolating runtimes and tighten the sandb…
waleedlatif1 Dec 2, 2026
59b15a1
fix(sandbox): bound and harden Kubernetes sandbox creation, lookup, a…
waleedlatif1 Dec 2, 2026
3265bf7
fix(sandbox): settle the paused and expired sandbox sweeps independently
waleedlatif1 Dec 2, 2026
8db6279
feat(helm): add the Kubernetes sandbox provider's namespace, RBAC, an…
waleedlatif1 Dec 2, 2026
0d7b832
docs(sandbox): document the Kubernetes sandbox provider
waleedlatif1 Dec 2, 2026
5fc14fa
test(sandbox): live end-to-end suite for the Kubernetes sandbox provider
waleedlatif1 Dec 2, 2026
8785eef
ci(sandbox): run the Kubernetes sandbox suite on k3s with gVisor
waleedlatif1 Dec 2, 2026
e62fcb9
ci(sandbox): apply the chart's sandbox manifests and share the k3s setup
waleedlatif1 Dec 2, 2026
515b626
ci(sandbox): full-stack Kubernetes sandbox job through the Helm-insta…
waleedlatif1 Dec 2, 2026
43830f9
fix(sandbox): extend agent lifetimes by duration within the pod's cap…
waleedlatif1 Dec 2, 2026
a0e02bd
fix(sandbox): let the app list events in the sandbox namespace
waleedlatif1 Dec 2, 2026
6a358c0
fix(sandbox): align the Kubernetes live suites with the provider as b…
waleedlatif1 Dec 2, 2026
434810c
fix(sandbox): run the Kubernetes sandbox e2e workflow for every file …
waleedlatif1 Dec 2, 2026
f31a3d1
fix(sandbox): regenerate the sandbox-agent image tag for the integrat…
waleedlatif1 Dec 2, 2026
2009683
fix(sandbox): give the agent handle integration suite's spawn env a N…
waleedlatif1 Dec 2, 2026
b541684
fix(sandbox): key the SDK-mock conformance table by the providers it …
waleedlatif1 Dec 2, 2026
8ab3761
fix(helm): format the sandbox values schema
waleedlatif1 Dec 2, 2026
f211814
improvement(sandbox): simplify the agent path and share the command-r…
waleedlatif1 Dec 2, 2026
315c7e4
improvement(sandbox): resolve kubernetes provider access once and sim…
waleedlatif1 Dec 2, 2026
689e97d
improvement(sandbox): stop recorded session commands through the prov…
waleedlatif1 Dec 2, 2026
adf4de3
improvement(sandbox): declare the Kubernetes and Trigger.dev conflict…
waleedlatif1 Dec 2, 2026
8634175
improvement(sandbox): derive the Pi lifetime ceiling from the provide…
waleedlatif1 Dec 2, 2026
56ed9bb
improvement(sandbox): name the shared Function base constants for bot…
waleedlatif1 Dec 2, 2026
3c586de
improvement(helm): tighten the Kubernetes sandbox chart and add an ad…
waleedlatif1 Dec 2, 2026
4e717a3
ci(sandbox): build sandbox images once, narrow the full-stack job, an…
waleedlatif1 Dec 2, 2026
aab7c50
improvement(sandbox): derive the pod token digest with the protocol's…
waleedlatif1 Dec 2, 2026
283d7d3
test(sandbox): run the shared conformance scenarios against the Kuber…
waleedlatif1 Dec 2, 2026
882f127
test(sandbox): align the Kubernetes live suite with the simplified ag…
waleedlatif1 Dec 2, 2026
a5b516d
improvement(sandbox): regenerate the agent image tag for the integrat…
waleedlatif1 Dec 2, 2026
c223711
improvement(sandbox): document the trusted runtime handlers and the T…
waleedlatif1 Dec 2, 2026
27538ec
improvement(sandbox): tighten comments across the sandbox provider
waleedlatif1 Dec 2, 2026
2eec77b
test(sandbox): start the metered-cost scenarios from the real clock
waleedlatif1 Dec 2, 2026
9415e42
test(sandbox): end a test agent's processes the way pod deletion does
waleedlatif1 Dec 2, 2026
84f72e9
test(sandbox): give conformance scenarios a budget they are not testing
waleedlatif1 Dec 2, 2026
4748892
test(sandbox): route the Kubernetes provider's stand-in agent through…
waleedlatif1 Dec 2, 2026
9b89ad8
test(sandbox): start the pod only after the watches a backoff test sc…
waleedlatif1 Dec 2, 2026
002e20a
test(sandbox): grow the file after the agent opens it, not from a rac…
waleedlatif1 Dec 2, 2026
68a6412
test(sandbox): make the per-event output charge visible however write…
waleedlatif1 Dec 2, 2026
fc5b2a2
test(sandbox): wait for every descendant pid instead of sleeping 0.3 s
waleedlatif1 Dec 2, 2026
139c007
test(sandbox): bind the handle suite's proxies to the port the OS ass…
waleedlatif1 Dec 2, 2026
bab1d15
test(sandbox): close three gaps the test authoring gate found
waleedlatif1 Dec 2, 2026
626b1f3
test(sandbox): run the Kubernetes conformance leg in the integration …
waleedlatif1 Dec 2, 2026
70d9a55
test(sandbox): sweep a stopping test agent's processes without yielding
waleedlatif1 Dec 2, 2026
69f7686
test(sandbox): bound the oversized chunked-body upload so the client …
waleedlatif1 Dec 2, 2026
1fc329f
improvement(sandbox): address the agent image by its Dockerfile and s…
waleedlatif1 Dec 2, 2026
93a7cbb
fix(sandbox): hash the agent bundle's source inputs and record the ne…
waleedlatif1 Dec 2, 2026
43cb9f6
fix(sandbox): address review findings
waleedlatif1 Dec 2, 2026
83875bb
ci(sandbox): install gVisor's helper binaries beside runsc
waleedlatif1 Dec 2, 2026
2fbf59d
fix(sandbox): address second review round
waleedlatif1 Dec 3, 2026
76ccd8c
fix(sandbox): address issues found running on EKS Nitro sandboxes
waleedlatif1 Dec 3, 2026
7175eca
fix(sandbox): let the agent prepare user-owned input and output direc…
waleedlatif1 Dec 3, 2026
3c68881
fix(sandbox): address third review round and e2e CI findings
waleedlatif1 Dec 3, 2026
dbbb90a
fix(sandbox): address fourth review round
waleedlatif1 Dec 3, 2026
cc6ab37
fix(sandbox): reject unrepresentable quantities and keep the wizard's…
waleedlatif1 Dec 3, 2026
a791a66
fix(sandbox): address final audit findings in the provider and agent
waleedlatif1 Dec 3, 2026
15d268d
improvement(sandbox): split provider startup, session pod selection, …
waleedlatif1 Dec 3, 2026
05c036c
fix(sandbox): harden the chart, image publishing, and docs from the f…
waleedlatif1 Dec 3, 2026
048e203
fix(sandbox): address final review round
waleedlatif1 Dec 3, 2026
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
6 changes: 6 additions & 0 deletions .github/actionlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Runner labels actionlint cannot know: GitHub larger runners defined for this
# organization. Workflows that pick one through a CI_PROVIDER expression were never
# checked; a workflow that names one directly is.
self-hosted-runner:
labels:
- linux-x64-8-core
57 changes: 57 additions & 0 deletions .github/actions/attest-image/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: attest-image
description: >-
Attest and sign one pushed image by digest: an SPDX SBOM attestation when
sbom-image is set, build provenance, and a keyless Cosign signature, all pushed to
the registry beside the image. Needs a registry login and the job permissions
id-token, attestations, artifact-metadata, and packages write.
inputs:
image:
description: Image repository, without tag or digest.
required: true
digest:
description: Digest of the pushed image or index (sha256:...).
required: true
sbom-image:
description: Reference to generate the SBOM from. Empty attests provenance only.
required: false
default: ''

runs:
using: composite
steps:
- name: Generate SBOM
if: inputs.sbom-image != ''
uses: anchore/sbom-action@dfcb83b97731532d72be422cbc51ee64adb6fd56 # v0.24.4
with:
image: ${{ inputs.sbom-image }}
format: spdx-json
output-file: sbom.spdx.json
upload-artifact: false
upload-release-assets: false

- name: Attest SBOM
if: inputs.sbom-image != ''
uses: actions/attest@1e69f48acb82d1966a394da916b4c1698aa569d6 # v4.2.2
with:
subject-name: ${{ inputs.image }}
subject-digest: ${{ inputs.digest }}
sbom-path: sbom.spdx.json
push-to-registry: true

- name: Attest build provenance
uses: actions/attest@1e69f48acb82d1966a394da916b4c1698aa569d6 # v4.2.2
with:
subject-name: ${{ inputs.image }}
subject-digest: ${{ inputs.digest }}
push-to-registry: true

- name: Install Cosign
uses: sigstore/cosign-installer@881c63bd87e38389154debd8331404ce7ca8a3ab # v4.1.4

- name: Sign image
shell: bash
env:
IMAGE: ${{ inputs.image }}
DIGEST: ${{ inputs.digest }}
run: cosign sign --yes "${IMAGE}@${DIGEST}"
26 changes: 22 additions & 4 deletions .github/actions/image/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,16 @@ inputs:
description: Target platforms, e.g. linux/amd64.
required: true
tags:
description: Comma-separated list of tags to push.
description: Comma-separated list of tags to push (or to load, when push is off).
required: true
push:
description: Push the tags to their registries. 'false' builds without publishing, for validation.
required: false
default: 'true'
load:
description: Load the built image into the runner's Docker daemon, so later steps can run it.
required: false
default: 'false'
build-args:
description: Newline-separated Docker build arguments.
required: false
Expand All @@ -27,6 +35,13 @@ inputs:
description: Dockerfile stage to build. Empty builds the final stage.
required: false
default: ''
cache-key-suffix:
description: >-
Appended to the Blacksmith layer cache key, so a caller that must not share
the deploy pipeline's sticky disk (a pull request build) gets its own. Empty
keeps the shared key.
required: false
default: ''
max-cache-size-mb:
description: >-
Layer cache to retain after this action prunes, in MB. Must stay above one
Expand Down Expand Up @@ -58,7 +73,8 @@ runs:
env:
FILE: ${{ inputs.file }}
PLATFORMS: ${{ inputs.platforms }}
run: echo "value=${GITHUB_REPOSITORY##*/}/${FILE#./}/${PLATFORMS//\//-}" >> "$GITHUB_OUTPUT"
SUFFIX: ${{ inputs.cache-key-suffix }}
run: echo "value=${GITHUB_REPOSITORY##*/}/${FILE#./}/${PLATFORMS//\//-}${SUFFIX}" >> "$GITHUB_OUTPUT"

# This action does NOT bound the disk — see the prune step below. BuildKit's
# own GC is time-based only (layers unused for 8 days), and these disks are
Expand All @@ -78,7 +94,8 @@ runs:
context: ${{ inputs.context }}
file: ${{ inputs.file }}
platforms: ${{ inputs.platforms }}
push: true
push: ${{ inputs.push }}
load: ${{ inputs.load }}
tags: ${{ inputs.tags }}
build-args: ${{ inputs.build-args }}
target: ${{ inputs.target }}
Expand Down Expand Up @@ -185,7 +202,8 @@ runs:
context: ${{ inputs.context }}
file: ${{ inputs.file }}
platforms: ${{ inputs.platforms }}
push: true
push: ${{ inputs.push }}
load: ${{ inputs.load }}
tags: ${{ inputs.tags }}
build-args: ${{ inputs.build-args }}
target: ${{ inputs.target }}
Expand Down
41 changes: 41 additions & 0 deletions .github/actions/k3s-diagnostics/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: k3s-diagnostics
description: >-
Collect what explains a failed k3s run into $RUNNER_TEMP/diagnostics: every pod,
pod descriptions for the given namespaces, the app's and its migrations' logs when
a release namespace is given, cluster events, the k3s journal, and disk usage.
Each command writes its own error into its file, so one failing never hides the rest.
inputs:
describe-namespaces:
description: Space-separated namespaces whose pods to describe.
required: true
app-namespace:
description: Namespace of the Helm release whose app logs to collect. Empty skips them.
required: false
default: ''

runs:
using: composite
steps:
- name: Collect diagnostics
shell: bash
env:
DESCRIBE_NAMESPACES: ${{ inputs.describe-namespaces }}
APP_NAMESPACE: ${{ inputs.app-namespace }}
run: |
# Best effort by design: a command that fails records its error in its file
# and the collection goes on.
set +e
out="$RUNNER_TEMP/diagnostics"
mkdir -p "$out"
kubectl get pods --all-namespaces -o wide > "$out/pods.txt" 2>&1
for namespace in $DESCRIBE_NAMESPACES; do
kubectl describe pods --namespace "$namespace" > "$out/pods-${namespace}.txt" 2>&1
done
if [ -n "$APP_NAMESPACE" ]; then
kubectl logs --namespace "$APP_NAMESPACE" deploy/sim-app -c migrations --tail=200 > "$out/migrations.log" 2>&1
kubectl logs --namespace "$APP_NAMESPACE" deploy/sim-app --tail=2000 > "$out/app.log" 2>&1
fi
kubectl get events --all-namespaces --sort-by=.lastTimestamp > "$out/events.txt" 2>&1
sudo journalctl --unit k3s --no-pager --lines 2000 > "$out/k3s.log" 2>&1
df -h / > "$out/disk.txt" 2>&1
130 changes: 130 additions & 0 deletions .github/actions/k3s-gvisor/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
name: k3s-gvisor
description: >-
Start a single-node k3s cluster whose containerd carries gVisor (runsc) as a runtime
handler, with k3s's built-in kube-router NetworkPolicy controller, plus Helm. Exports
KUBECONFIG (cluster-admin) and NODE_IP to later steps. For ephemeral GitHub-hosted VMs.

# Pinned with their published checksums; bump each version and checksum together.
inputs:
k3s-version:
description: k3s release.
required: false
default: v1.36.6+k3s1
k3s-sha256:
description: sha256 of that release's amd64 `k3s` binary (sha256sum-amd64.txt).
required: false
default: 66ceb8e67edfa547195135d74783bfadc2ecc04a91059e90ae5f70a3dbc98c15
gvisor-release:
description: gVisor release (storage.googleapis.com/gvisor/releases/release/<release>).
required: false
default: '20261123.2'
gvisor-sha512:
description: sha512 of that release's x86_64 gvisor.tar.bz2.
required: false
default: bd0c27a0ad9489d5df82bce740512311db01755e2bc5be66564bbdf8febddf8eec46881a1d02fc79f7b2d167b6a320dc7596259df4d20f2e8dcf36db2273e967

outputs:
node-ip:
description: The node's address, which pods reach the runner at.
value: ${{ steps.k3s.outputs.node-ip }}

runs:
using: composite
steps:
# Sandbox images are several GB and live twice (Docker, then containerd).
- name: Free disk space
shell: bash
run: |
set -euo pipefail
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL
df -h /

- name: Install gVisor
shell: bash
env:
GVISOR_RELEASE: ${{ inputs.gvisor-release }}
GVISOR_SHA512: ${{ inputs.gvisor-sha512 }}
run: |
set -euo pipefail
workdir="$(mktemp -d)"
curl -fsSL --retry 3 --retry-all-errors \
"https://storage.googleapis.com/gvisor/releases/release/${GVISOR_RELEASE}/x86_64/gvisor.tar.bz2" \
-o "${workdir}/gvisor.tar.bz2"
echo "${GVISOR_SHA512} ${workdir}/gvisor.tar.bz2" | sha512sum -c -
tar -xjf "${workdir}/gvisor.tar.bz2" -C "$workdir"
sudo install -m 0755 "${workdir}/runsc" "${workdir}/containerd-shim-runsc-v1" /usr/local/bin/
# runsc runs its sentry and helpers from gvisor-bin/ beside its own binary.
sudo install -d -m 0755 /usr/local/bin/gvisor-bin
sudo install -m 0755 "${workdir}"/gvisor-bin/* /usr/local/bin/gvisor-bin/
runsc --version

- name: Install and start k3s
id: k3s
shell: bash
env:
K3S_VERSION: ${{ inputs.k3s-version }}
K3S_SHA256: ${{ inputs.k3s-sha256 }}
run: |
set -euo pipefail
curl -fsSL --retry 3 --retry-all-errors \
"https://github.com/k3s-io/k3s/releases/download/${K3S_VERSION//+/%2B}/k3s" -o /tmp/k3s
echo "${K3S_SHA256} /tmp/k3s" | sha256sum -c -
sudo install -m 0755 /tmp/k3s /usr/local/bin/k3s
# k3s's embedded kubectl, so the client matches the server exactly.
sudo ln -sf /usr/local/bin/k3s /usr/local/bin/kubectl

# runsc must use the same cgroup driver as the kubelet. k3s picks it at
# start and exposes it to the template as .SystemdCgroup, so one runsc
# config exists per value and the template selects the matching one.
sudo mkdir -p /etc/containerd /var/lib/rancher/k3s/agent/etc/containerd
printf '[runsc_config]\n systemd-cgroup = "true"\n' | sudo tee /etc/containerd/runsc-systemd-true.toml > /dev/null
printf '[runsc_config]\n systemd-cgroup = "false"\n' | sudo tee /etc/containerd/runsc-systemd-false.toml > /dev/null
sudo tee /var/lib/rancher/k3s/agent/etc/containerd/config-v3.toml.tmpl > /dev/null <<'EOF'
{{ template "base" . }}

[plugins.'io.containerd.cri.v1.runtime'.containerd.runtimes.runsc]
runtime_type = "io.containerd.runsc.v1"
[plugins.'io.containerd.cri.v1.runtime'.containerd.runtimes.runsc.options]
TypeUrl = "io.containerd.runsc.v1.options"
ConfigPath = "/etc/containerd/runsc-systemd-{{ .SystemdCgroup }}.toml"
EOF

node_ip="$(ip -4 route get 1.1.1.1 | awk '{for (i = 1; i < NF; i++) if ($i == "src") print $(i + 1)}')"
echo "NODE_IP=${node_ip}" >> "$GITHUB_ENV"
echo "node-ip=${node_ip}" >> "$GITHUB_OUTPUT"

# NetworkPolicy enforcement is k3s's default (its embedded kube-router
# controller); only --disable-network-policy turns it off, and it is
# deliberately absent.
sudo systemd-run --unit=k3s --description='k3s server' \
-p Type=notify -p Delegate=yes -p KillMode=process -p TimeoutStartSec=300 \
-p LimitNOFILE=1048576 -p LimitNPROC=infinity -p LimitCORE=infinity -p TasksMax=infinity \
/usr/local/bin/k3s server \
--node-ip "$node_ip" \
--disable=traefik,metrics-server,servicelb \
--write-kubeconfig-mode=0600

mkdir -p "$HOME/.kube"
sudo install -m 0600 -o "$(id -u)" -g "$(id -g)" /etc/rancher/k3s/k3s.yaml "$HOME/.kube/admin.yaml"
echo "KUBECONFIG=$HOME/.kube/admin.yaml" >> "$GITHUB_ENV"

- name: Wait for the cluster
shell: bash
run: |
set -euo pipefail
# The node and CoreDNS objects appear a few seconds after the API does.
for _ in $(seq 1 60); do
if kubectl get node -o name | grep -q . && kubectl -n kube-system get deployment coredns > /dev/null 2>&1; then
break
fi
sleep 3
done
kubectl wait --for=condition=Ready node --all --timeout=180s
kubectl -n kube-system rollout status deployment/coredns --timeout=180s
kubectl version
sudo grep -A3 "runtimes.runsc" /var/lib/rancher/k3s/agent/etc/containerd/config.toml

- name: Set up Helm
uses: azure/setup-helm@2f5e7bc67f1f9972ab16657bb795f36d8f04de0e # v5.1.0
with:
version: v3.16.4
89 changes: 89 additions & 0 deletions .github/actions/k3s-image/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: k3s-image
description: >-
Put one image into the local k3s containerd, so pods start from it without a
registry. With `kind`, a sandbox image at the content-addressed reference
images.generated.json names: with `archive: 'true'`, imported from the workflow's
`sandbox-image-<kind>` artifact (a `ref` file naming the image, plus its
`docker save` archive as `image.tar`), else pulled from GHCR, where that
reference already holds the same image. With `artifact` and `tag`, an image built
from this checkout, imported from that artifact in the same layout.

inputs:
kind:
description: Sandbox image kind in images.generated.json (agent, function, pi). Instead of artifact and tag.
required: false
default: ''
archive:
description: With kind, 'true' when the workflow built the image and uploaded its archive.
required: false
default: 'false'
artifact:
description: Name of the artifact holding the image. Needs tag.
required: false
default: ''
tag:
description: Reference the artifact holds, exactly as pods will name it.
required: false
default: ''

outputs:
ref:
description: The image reference now in k3s.
value: ${{ steps.ref.outputs.ref }}

runs:
using: composite
steps:
- name: Resolve image reference
id: ref
shell: bash
env:
KIND: ${{ inputs.kind }}
ARCHIVE: ${{ inputs.archive }}
ARTIFACT: ${{ inputs.artifact }}
TAG: ${{ inputs.tag }}
MANIFEST: apps/sim/lib/execution/remote-sandbox/kubernetes/images.generated.json
run: |
set -euo pipefail
if [ -n "$KIND" ] && [ -z "$ARTIFACT" ] && [ -z "$TAG" ]; then
echo "ref=$(jq -er --arg kind "$KIND" '.[$kind]' "$MANIFEST")" >> "$GITHUB_OUTPUT"
if [ "$ARCHIVE" = "true" ]; then
echo "artifact=sandbox-image-${KIND}" >> "$GITHUB_OUTPUT"
fi
elif [ -z "$KIND" ] && [ -n "$ARTIFACT" ] && [ -n "$TAG" ]; then
echo "ref=${TAG}" >> "$GITHUB_OUTPUT"
echo "artifact=${ARTIFACT}" >> "$GITHUB_OUTPUT"
else
echo "::error::k3s-image takes kind, or artifact and tag"
exit 1
fi

- name: Pull image
if: steps.ref.outputs.artifact == ''
shell: bash
env:
IMAGE: ${{ steps.ref.outputs.ref }}
run: sudo k3s crictl pull "$IMAGE"

- name: Download image
if: steps.ref.outputs.artifact != ''
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: ${{ steps.ref.outputs.artifact }}
path: ${{ runner.temp }}/${{ steps.ref.outputs.artifact }}

- name: Import image
if: steps.ref.outputs.artifact != ''
shell: bash
env:
DIR: ${{ runner.temp }}/${{ steps.ref.outputs.artifact }}
IMAGE: ${{ steps.ref.outputs.ref }}
run: |
set -euo pipefail
if [ "$(cat "${DIR}/ref")" != "$IMAGE" ]; then
echo "::error::The ${DIR##*/} artifact holds $(cat "${DIR}/ref"), not ${IMAGE}"
exit 1
fi
sudo k3s ctr -n k8s.io images import "${DIR}/image.tar"
rm -rf "$DIR"
df -h /
Loading
Loading