diff --git a/.github/workflows/actionlint.yaml b/.github/workflows/actionlint.yaml
index ea1cd7e3c..c33d136e1 100644
--- a/.github/workflows/actionlint.yaml
+++ b/.github/workflows/actionlint.yaml
@@ -15,7 +15,7 @@ jobs:
actionlint:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v7
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Run actionlint
uses: unikraft-cloud/x/.github/actions/actionlint@prod-staging
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index 1f55e7217..ac2257981 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -47,12 +47,12 @@ jobs:
steps:
- name: Checkout
- uses: actions/checkout@v7
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: Setup Go
- uses: actions/setup-go@v7
+ uses: actions/setup-go@d8cbb8045d7f43706b9177cceb36c1f91a6644d5 # v7.1.0
with:
go-version-file: go.mod
@@ -66,7 +66,7 @@ jobs:
} >>"$GITHUB_OUTPUT"
- name: Go caches
- uses: actions/cache@v6
+ uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
${{ steps.goenv.outputs.cache }}
@@ -76,7 +76,7 @@ jobs:
${{ github.job }}-${{ runner.os }}-go-
- name: Install Task
- uses: go-task/setup-task@v2
+ uses: go-task/setup-task@a00fbb05ce67b35648be3c78cbc9fd85354c757e # v2.2.0
- name: Build
shell: bash
@@ -84,7 +84,7 @@ jobs:
VERSION=pr-${{ github.event.number }} GOOS=${{ matrix.GOOS }} GOARCH=${{ matrix.GOARCH }} task --yes ${{ matrix.task || 'cli' }}
- name: Upload build artifacts to GitHub
- uses: actions/upload-artifact@v7
+ uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
if: github.event_name == 'push'
with:
name: unikraft-cli-${{ matrix.GOOS }}-${{ matrix.GOARCH }}-${{ github.sha }}
diff --git a/.github/workflows/check-pr.yaml b/.github/workflows/check-pr.yaml
index 1f40de4b9..0499f84ae 100644
--- a/.github/workflows/check-pr.yaml
+++ b/.github/workflows/check-pr.yaml
@@ -9,7 +9,7 @@ jobs:
check-pr:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v7
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
diff --git a/.github/workflows/check-static.yaml b/.github/workflows/check-static.yaml
index fa97e4b5f..fc8792be8 100644
--- a/.github/workflows/check-static.yaml
+++ b/.github/workflows/check-static.yaml
@@ -24,11 +24,11 @@ jobs:
go:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v7
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- - uses: go-task/setup-task@v2
+ - uses: go-task/setup-task@a00fbb05ce67b35648be3c78cbc9fd85354c757e # v2.2.0
- - uses: actions/setup-go@v7
+ - uses: actions/setup-go@d8cbb8045d7f43706b9177cceb36c1f91a6644d5 # v7.1.0
with:
go-version-file: go.mod
@@ -42,7 +42,7 @@ jobs:
} >>"$GITHUB_OUTPUT"
- name: Go caches
- uses: actions/cache@v6
+ uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
${{ steps.goenv.outputs.cache }}
diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml
index 5dedcf7e5..04349f1ec 100644
--- a/.github/workflows/docs.yaml
+++ b/.github/workflows/docs.yaml
@@ -32,13 +32,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
- uses: actions/checkout@v7
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Task
- uses: go-task/setup-task@v2
+ uses: go-task/setup-task@a00fbb05ce67b35648be3c78cbc9fd85354c757e # v2.2.0
- name: Setup Go
- uses: actions/setup-go@v7
+ uses: actions/setup-go@d8cbb8045d7f43706b9177cceb36c1f91a6644d5 # v7.1.0
with:
go-version-file: go.mod
@@ -52,7 +52,7 @@ jobs:
} >>"$GITHUB_OUTPUT"
- name: Go caches
- uses: actions/cache@v6
+ uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
${{ steps.goenv.outputs.cache }}
@@ -67,7 +67,7 @@ jobs:
make docs
- name: Upload docs artifacts to GitHub
- uses: actions/upload-artifact@v7
+ uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
if: github.event_name == 'push'
with:
name: unikraft-docs-${{ github.event.pull_request.number || github.sha }}
@@ -77,7 +77,7 @@ jobs:
overwrite: true
- name: Upload man artifacts to GitHub
- uses: actions/upload-artifact@v7
+ uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
if: github.event_name == 'push'
with:
name: unikraft-man-${{ github.sha }}
diff --git a/.github/workflows/mirror.yaml b/.github/workflows/mirror.yaml
index 410b4189a..7e29b44ce 100644
--- a/.github/workflows/mirror.yaml
+++ b/.github/workflows/mirror.yaml
@@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
- uses: actions/checkout@v7
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
index dfe1c4597..8f328ca65 100644
--- a/.github/workflows/release.yaml
+++ b/.github/workflows/release.yaml
@@ -19,7 +19,7 @@ jobs:
release:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v7
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
@@ -27,7 +27,7 @@ jobs:
shell: bash
run: git fetch --force --tags
- - uses: actions/setup-go@v7
+ - uses: actions/setup-go@d8cbb8045d7f43706b9177cceb36c1f91a6644d5 # v7.1.0
with:
go-version-file: go.mod
@@ -41,7 +41,7 @@ jobs:
} >>"$GITHUB_OUTPUT"
- name: Go caches
- uses: actions/cache@v6
+ uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
${{ steps.goenv.outputs.cache }}
@@ -124,16 +124,16 @@ jobs:
export YTT_DEB_PRERELEASE_VERSION
make goreleaser-yaml
- - uses: docker/setup-buildx-action@v4
+ - uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1
- - uses: docker/login-action@v4
+ - uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 # v4.8.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Run GoReleaser
- uses: goreleaser/goreleaser-action@v7
+ uses: goreleaser/goreleaser-action@a4f02ab5355a589de60d917a659ce617ed19b3de # v7.3.0
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
GITHUB_TOKEN_UNIKRAFT: ${{ secrets.GH_MIRROR_PAT }}
@@ -142,7 +142,7 @@ jobs:
UNIKRAFT_POSTHOG_API_KEY: ${{ secrets.UNIKRAFT_POSTHOG_API_KEY }}
UNIKRAFT_POSTHOG_HOST: ${{ secrets.UNIKRAFT_POSTHOG_HOST }}
with:
- version: latest
+ version: v2.20.2
args: release --clean
- name: Publish to APT repository
diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml
index 8c97a4a18..99be60b32 100644
--- a/.github/workflows/test.yaml
+++ b/.github/workflows/test.yaml
@@ -27,14 +27,14 @@ jobs:
run:
shell: bash
steps:
- - uses: actions/checkout@v7
- - uses: go-task/setup-task@v2
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+ - uses: go-task/setup-task@a00fbb05ce67b35648be3c78cbc9fd85354c757e # v2.2.0
- name: Authenticate git for remote Taskfiles
env:
GH_TOKEN: ${{ github.token }}
run: |
git config --global url."https://x-access-token:${GH_TOKEN}@github.com/".insteadOf "https://github.com/"
- - uses: actions/setup-go@v7
+ - uses: actions/setup-go@d8cbb8045d7f43706b9177cceb36c1f91a6644d5 # v7.1.0
with:
go-version-file: 'go.mod'
@@ -48,7 +48,7 @@ jobs:
} >>"$GITHUB_OUTPUT"
- name: Go caches
- uses: actions/cache@v6
+ uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
${{ steps.goenv.outputs.cache }}
@@ -88,30 +88,30 @@ jobs:
UNIKRAFT_SERVER_STABLE: stable
UNIKRAFT_SERVER_PROD: prod
steps:
- - uses: actions/checkout@v7
- - uses: go-task/setup-task@v2
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+ - uses: go-task/setup-task@a00fbb05ce67b35648be3c78cbc9fd85354c757e # v2.2.0
- name: Authenticate git for remote Taskfiles
env:
GH_TOKEN: ${{ github.token }}
run: |
git config --global url."https://x-access-token:${GH_TOKEN}@github.com/".insteadOf "https://github.com/"
- - uses: actions/setup-go@v7
+ - uses: actions/setup-go@d8cbb8045d7f43706b9177cceb36c1f91a6644d5 # v7.1.0
with:
go-version-file: 'go.mod'
- # Multi-platform rootfs builds run the target architecture's binaries,
- # which needs a binfmt handler registered with the kernel.
- - name: Set up QEMU
- uses: docker/setup-qemu-action@v4
- with:
- platforms: arm64
-
- name: Login to Docker Hub
uses: unikraft-cloud/x/.github/actions/login-docker-hub@prod-staging
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
+ # Multi-platform rootfs builds run the target architecture's binaries,
+ # which needs a binfmt handler registered with the kernel.
+ - name: Set up QEMU
+ uses: docker/setup-qemu-action@99012661954931238ded8c8b007157a8430204e1 # v4.4.0
+ with:
+ platforms: arm64
+
- name: Set Go variables
id: goenv
run: |
@@ -122,7 +122,7 @@ jobs:
} >>"$GITHUB_OUTPUT"
- name: Go caches
- uses: actions/cache@v6
+ uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
${{ steps.goenv.outputs.cache }}
@@ -165,6 +165,7 @@ jobs:
UNIKRAFT_ENDPOINT: ${{ secrets[format('UNIKRAFT_ENDPOINT_{0}', matrix.target)] }}
UNIKRAFT_X_TEST_SERVER: ${{ env[format('UNIKRAFT_SERVER_{0}', matrix.target)] }}
UNIKRAFT_X_TEST_BUILD_URL: ${{ matrix.target == 'STABLE' && secrets.UNIKRAFT_BUILD_URL_STABLE || '' }}
+ UNIKRAFT_X_TEST_UDP_IP: ${{ matrix.target == 'STAGING' && vars.UNIKRAFT_UDP_IP_STAGING || '' }}
# The hosted Windows runners reach only the public prod endpoint. The runners
# take turns, so that both do not use the same organization at once.
@@ -184,31 +185,31 @@ jobs:
run:
shell: bash
steps:
- - uses: actions/checkout@v7
- - uses: go-task/setup-task@v2
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+ - uses: go-task/setup-task@a00fbb05ce67b35648be3c78cbc9fd85354c757e # v2.2.0
- name: Authenticate git for remote Taskfiles
env:
GH_TOKEN: ${{ github.token }}
run: |
git config --global url."https://x-access-token:${GH_TOKEN}@github.com/".insteadOf "https://github.com/"
- - uses: actions/setup-go@v7
+ - uses: actions/setup-go@d8cbb8045d7f43706b9177cceb36c1f91a6644d5 # v7.1.0
with:
go-version-file: 'go.mod'
+ - name: Login to Docker Hub
+ uses: unikraft-cloud/x/.github/actions/login-docker-hub@prod-staging
+ with:
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
+
# Multi-platform rootfs builds run the target architecture's binaries,
# which needs a binfmt handler registered with the kernel.
- name: Set up QEMU
if: runner.os == 'Linux'
- uses: docker/setup-qemu-action@v4
+ uses: docker/setup-qemu-action@99012661954931238ded8c8b007157a8430204e1 # v4.4.0
with:
platforms: arm64
- - name: Login to Docker Hub
- uses: unikraft-cloud/x/.github/actions/login-docker-hub@prod-staging
- with:
- username: ${{ secrets.DOCKERHUB_USERNAME }}
- password: ${{ secrets.DOCKERHUB_TOKEN }}
-
- name: Set Go variables
id: goenv
run: |
@@ -219,7 +220,7 @@ jobs:
} >>"$GITHUB_OUTPUT"
- name: Go caches
- uses: actions/cache@v6
+ uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
${{ steps.goenv.outputs.cache }}
diff --git a/.goreleaser.Dockerfile b/.goreleaser.Dockerfile
index 0f0a95069..7fed6a738 100644
--- a/.goreleaser.Dockerfile
+++ b/.goreleaser.Dockerfile
@@ -1,4 +1,4 @@
-FROM alpine:3.24
+FROM alpine:3.24.4@sha256:f59abe656b692d901e184be3445e084786602108599d2a51d229c0f5a48c71bf
ARG TARGETPLATFORM
COPY $TARGETPLATFORM/unikraft /usr/local/bin/unikraft
ENTRYPOINT ["unikraft"]
diff --git a/.taskrc.yml b/.taskrc.yml
index dc0006181..04b727428 100644
--- a/.taskrc.yml
+++ b/.taskrc.yml
@@ -1,7 +1,7 @@
remote:
insecure: false
offline: false
- timeout: "5s"
+ timeout: "30s"
cache-dir: ~/.cache/taskfiles
cache-expiry: "24h"
trusted-hosts:
diff --git a/AGENTS.md b/AGENTS.md
index f103a1d2a..1958e5970 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -20,7 +20,7 @@ This repo contains the Go-based Unikraft CLI. Use this file for contributor-faci
- Core `Model` interface (`pkg/model`) models API objects with `Type`, `Key`, `Fields`, and `Raw`, and is extended by get/list/create/edit/delete behaviors.
- Model data is expressed as a tree of `Field` nodes: each node has a name, optional value, nested subfields, and an `Elem` template for homogeneous arrays; patch metadata and verbosity drive editing and output.
- Model utilities live alongside the model layer (inside `pkg/model`): struct↔field conversion, field cloning/merging/deduping, map/slice encoding, path-based filtering/selection, and patch helpers for edits.
-- `pkg/` is public API, used by other CLIs (like consolectl) to build their own commands, TUI and MCP server on the model layer: `pkg/model` (with `cmd`, `tui`, `mcp`, `patch` and `value`), `pkg/mcpserver` and `pkg/logfmt`. Keep anything specific to Unikraft Cloud out of it, and avoid exposing `internal/` types in its exported API.
+- `pkg/` is public API. `pkg/model` (with `cmd`, `tui`, `mcp`, `patch` and `value`), `pkg/mcpserver` and `pkg/logfmt` are generic: other CLIs (like consolectl) build their own commands, TUI and MCP server on them, so keep anything specific to Unikraft Cloud out of them. `pkg/mcpserver/cli` serves the MCP server of `unikraft mcp` to other CLIs, which cannot import its tools from `internal/`. Avoid exposing `internal/` types in the exported API of `pkg/`.
- Everything else lives under `internal/` and is organized by domain: configuration/profile handling, API client communication, the Unikraft Cloud models and commands, output utilities, multi-region support, and shared helpers.
- Build artifacts and generated docs go to `dist/`; developer tooling/scripts live at the repo root and under `tools/`.
diff --git a/Dockerfile b/Dockerfile
index cfbeaeffa..6c940a52a 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,6 +1,4 @@
-# syntax=docker/dockerfile:1
-
-FROM --platform=$BUILDPLATFORM golang:1.27.4-alpine AS build
+FROM --platform=$BUILDPLATFORM golang:1.27.4-alpine@sha256:70bd7ddea8b6cbe5d6943cde279d6b67feb10cc924fb9100d1d8757c1575b280 AS build
WORKDIR /src
ARG TARGETOS TARGETARCH
RUN --mount=type=bind,target=. \
@@ -13,6 +11,6 @@ RUN --mount=type=bind,target=. \
-X unikraft.com/x/version.Issues=https://github.com/unikraft-cloud/cli/issues" \
./cmd/unikraft
-FROM alpine:3.24
+FROM alpine:3.24.4@sha256:f59abe656b692d901e184be3445e084786602108599d2a51d229c0f5a48c71bf
COPY --from=build /out/unikraft /usr/local/bin/unikraft
ENTRYPOINT ["unikraft"]
diff --git a/README.md b/README.md
index fda946f5c..548a35983 100644
--- a/README.md
+++ b/README.md
@@ -202,6 +202,51 @@ to install the CLI in your workflow:
+
+Docker
+
+The CLI is published as a container image for `linux/amd64` and `linux/arm64`, with `unikraft` as the entrypoint:
+
+```sh
+docker run --rm \
+ -e UNIKRAFT_PROFILE_ENV=true \
+ -e UKC_TOKEN \
+ -e UKC_METRO=fra \
+ ghcr.io/unikraft-cloud/cli instances list
+```
+
+Or reuse the profiles from your existing config:
+
+```sh
+docker run --rm \
+ -v ~/.config/unikraft:/root/.config/unikraft \
+ ghcr.io/unikraft-cloud/cli instances list
+```
+
+| Tag | Description |
+| ----------- | ---------------------------------------------- |
+| `latest` | Latest **stable** release |
+| `X.Y` | Latest **stable** release in the `X.Y` series |
+| `staging` | Latest **pre-release** (`-staging`) build |
+| `` | A specific release, e.g. `0.9.0` |
+
+The image has a shell, so it also works as a CI job image. GitLab CI runs `script:` through a shell, so it needs the entrypoint cleared:
+
+```yaml
+deploy:
+ image:
+ name: ghcr.io/unikraft-cloud/cli:latest
+ entrypoint: [""]
+ variables:
+ UNIKRAFT_PROFILE_ENV: "true"
+ UKC_METRO: fra
+ # UKC_TOKEN set as a masked CI/CD variable
+ script:
+ - unikraft instances list
+```
+
+
+
From Source
diff --git a/cmd/unikraft/help_test.go b/cmd/unikraft/help_test.go
index 488f2ad27..ee7788e7c 100644
--- a/cmd/unikraft/help_test.go
+++ b/cmd/unikraft/help_test.go
@@ -113,6 +113,7 @@ func instancesHelpTests(t *testing.T, unikraftPath string) {
[]string{"unikraft", "instance", "template", "create", "--help"},
[]string{"unikraft", "instance", "template", "edit", "--help"},
[]string{"unikraft", "instance", "template", "delete", "--help"},
+ []string{"unikraft", "instance", "template", "history", "--help"},
[]string{"unikraft", "instance", "checkpoint", "--help"},
[]string{"unikraft", "instance", "checkpoint", "get", "--help"},
[]string{"unikraft", "instance", "checkpoint", "list", "--help"},
diff --git a/cmd/unikraft/integration/build_test.go b/cmd/unikraft/integration/build_test.go
index 8041ed1c0..0761e099d 100644
--- a/cmd/unikraft/integration/build_test.go
+++ b/cmd/unikraft/integration/build_test.go
@@ -114,7 +114,7 @@ roms:
require.NoError(t, fstest.Apply(
fstest.CreateFile("Dockerfile", []byte(`
FROM busybox:latest
-RUN echo "unikraft-e2e" > /etc/unikraft-e2e
+RUN echo "unikraft-e2e `+imageTag+`" > /etc/unikraft-e2e
COPY < /etc/unikraft-e2e
+RUN echo "unikraft-e2e `+imageTag+`" > /etc/unikraft-e2e
CMD ["sh", "-c", "cat /etc/unikraft-e2e && echo UNIKRAFT_E2E_OK"]
`), 0o644),
).Apply(dir))
@@ -228,7 +229,7 @@ RUN echo "wrong-context" > /etc/unikraft-e2e
fstest.CreateDir("proj", 0o755),
fstest.CreateFile("proj/Dockerfile", []byte(`
FROM busybox:latest
-RUN echo "right-context" > /etc/unikraft-e2e
+RUN echo "right-context `+imageTag+`" > /etc/unikraft-e2e
CMD ["sh", "-c", "echo DOCKERFILE_CMD_USED"]
`), 0o644),
fstest.CreateFile("proj/Kraftfile", []byte(`
@@ -274,7 +275,7 @@ cmd: ["sh", "-c", "cat /etc/unikraft-e2e && echo UNIKRAFT_E2E_OK"]
require.NoError(t, fstest.Apply(
fstest.CreateFile("Dockerfile", []byte(`
FROM busybox:latest
-RUN echo "unikraft-e2e" > /etc/unikraft-e2e
+RUN echo "unikraft-e2e `+imageTag+`" > /etc/unikraft-e2e
CMD ["sh", "-c", "echo DOCKERFILE_CMD_USED"]
`), 0o644),
fstest.CreateFile("Kraftfile", []byte(`
diff --git a/cmd/unikraft/integration/builder_test.go b/cmd/unikraft/integration/builder_test.go
index e34d0a74d..4633c7836 100644
--- a/cmd/unikraft/integration/builder_test.go
+++ b/cmd/unikraft/integration/builder_test.go
@@ -38,7 +38,7 @@ func TestBuilder(t *testing.T) {
assert.Regexp(t, `(?m)^instance: +.*name=remote-builder-default\b`, out)
out = r.Run(t, []string{"unikraft", "builder", "list"}, env)
- assert.Regexp(t, `(?m)^default +true +`, out)
+ assert.Regexp(t, `(?m)^default +\S+ +true +`, out)
out = r.Run(t, []string{"unikraft", "builder", "du"}, env)
assert.Regexp(t, `(?m)^Reclaimable: +\S+\nTotal: +\S+$`, out)
diff --git a/cmd/unikraft/integration/instance_checkpoint_test.go b/cmd/unikraft/integration/instance_checkpoint_test.go
index 99fbb459d..bb309546c 100644
--- a/cmd/unikraft/integration/instance_checkpoint_test.go
+++ b/cmd/unikraft/integration/instance_checkpoint_test.go
@@ -50,22 +50,37 @@ func TestInstanceCheckpoints(t *testing.T) {
out = r.Run(t, []string{"unikraft", "instance", "checkpoint", "inspect", checkpointName, "-f", "all"})
assert.Contains(t, out, "env-dev")
- // The source instance's history lists its checkpoints.
+ r.Run(t, []string{
+ "unikraft", "instance", "create",
+ "--output", "quiet",
+ "--set", "name=test-" + instName + "-fork",
+ "--set", "metro=" + r.MetroName,
+ "--set", "autostart=false",
+ "--checkpoint", checkpointName,
+ })
+
+ // The default view draws the lineage of the source as a graph.
out = r.Run(t, []string{"unikraft", "instance", "history", "test-" + instName})
assert.Contains(t, out, checkpointName)
+ assert.Contains(t, out, "◉")
+ assert.Contains(t, out, "test-"+instName+"-fork")
- // A checkpoint's own history (ancestor checkpoints) is empty for a
- // freshly-created checkpoint; the command should still succeed and
- // render the table header.
+ // The lineage of the checkpoint is the same tree.
out = r.Run(t, []string{"unikraft", "instance", "checkpoint", "history", checkpointName})
- assert.Contains(t, out, "CREATED")
+ assert.Contains(t, out, "test-"+instName+"-fork")
+
+ r.Run(t, []string{"unikraft", "instance", "delete", "test-" + instName + "-fork"})
+ r.Run(t, []string{"unikraft", "instance", "delete", "test-" + instName})
+
+ // A checkpoint of a deleted instance hangs under a deleted node.
+ out = r.Run(t, []string{"unikraft", "instance", "checkpoint", "history", checkpointName})
+ assert.Contains(t, out, checkpointName)
+ assert.Contains(t, out, "deleted")
r.Run(t, []string{"unikraft", "instance", "checkpoint", "delete", checkpointName})
out = r.Run(t, []string{"unikraft", "instance", "checkpoint", "list", "--output", "quiet"})
assert.NotContains(t, out, checkpointName)
-
- r.Run(t, []string{"unikraft", "instance", "delete", "test-" + instName})
})
t.Run("create-is-immediately-visible", func(t *testing.T) {
diff --git a/cmd/unikraft/integration/instance_template_test.go b/cmd/unikraft/integration/instance_template_test.go
index 13271c026..377c19cf8 100644
--- a/cmd/unikraft/integration/instance_template_test.go
+++ b/cmd/unikraft/integration/instance_template_test.go
@@ -110,6 +110,10 @@ func TestInstanceTemplates(t *testing.T) {
assert.Regexp(t, `state:\s+(stopping|stopped)\b`, out)
assert.Regexp(t, `memory:\s+128`, out)
+ // The lineage of the template lists the instance created from it.
+ out = r.Run(t, []string{"unikraft", "instance", "template", "history", templateName, "-o", "json", "-f", "name,relation"})
+ assert.Regexp(t, `"name": "test-from-template-`+instName+`",\s+"relation": "created-from"`, out)
+
r.Run(t, []string{"unikraft", "instance", "template", "delete", templateName})
})
diff --git a/cmd/unikraft/integration/instance_test.go b/cmd/unikraft/integration/instance_test.go
index fdbbbc754..1df7372fc 100644
--- a/cmd/unikraft/integration/instance_test.go
+++ b/cmd/unikraft/integration/instance_test.go
@@ -9,7 +9,9 @@ import (
"context"
_ "embed"
"encoding/json"
+ "fmt"
"regexp"
+ "slices"
"strings"
"testing"
"time"
@@ -76,7 +78,7 @@ func scriptArgs(t *testing.T, script string) string {
return "runtime.args=" + string(args)
}
-const sandboxPluginRom = "plugins/sandbox:latest"
+const sandboxPluginRom = "plugins/sandbox:staging"
// tunnelProxyUUIDs queries the platform directly (bypassing the CLI's
// resource partition, which never tracks the tunnel command's internal proxy
@@ -1464,7 +1466,7 @@ func TestInstances(t *testing.T) {
fstest.CreateDir("v1", 0o755),
fstest.CreateFile("v1/Dockerfile", []byte(`
FROM busybox:latest
-RUN echo pull-policy-v1 > /marker.txt
+RUN echo pull-policy-v1 `+imageTag+` > /marker.txt
`), 0o644),
fstest.CreateFile("v1/Kraftfile", []byte(`
spec: v0.7
@@ -1502,7 +1504,7 @@ cmd: ["cat", "/marker.txt"]
fstest.CreateDir("v2", 0o755),
fstest.CreateFile("v2/Dockerfile", []byte(`
FROM busybox:latest
-RUN echo pull-policy-v2 > /marker.txt
+RUN echo pull-policy-v2 `+imageTag+` > /marker.txt
`), 0o644),
fstest.CreateFile("v2/Kraftfile", []byte(`
spec: v0.7
@@ -1556,11 +1558,84 @@ cmd: ["cat", "/marker.txt"]
out = r.Run(t, []string{"unikraft", "instance", "logs", "test-" + alwaysName})
assert.Contains(t, out, "pull-policy-v2")
assert.NotContains(t, out, "pull-policy-v1")
+
+ require.NoError(t, fstest.Apply(
+ fstest.CreateDir("v3", 0o755),
+ fstest.CreateFile("v3/Dockerfile", []byte(`
+FROM busybox:latest
+RUN echo pull-policy-v3 > /marker.txt
+`), 0o644),
+ fstest.CreateFile("v3/Kraftfile", []byte(`
+spec: v0.7
+name: pull-policy-e2e
+runtime: base-compat:latest
+rootfs:
+ format: erofs
+ source: ./Dockerfile
+cmd: ["cat", "/marker.txt"]
+`), 0o644),
+ ).Apply(dir))
+ r.Run(t, []string{"unikraft", "build", "v3", "--output", image}, integ.WithWorkDir(dir))
+
+ r.Run(t, []string{
+ "unikraft", "instance", "edit", "test-" + alwaysName,
+ "--output", "quiet",
+ "--image", image,
+ "--pull-policy", "always",
+ })
+ out = r.Run(t, []string{
+ "unikraft", "instance", "start",
+ "--follow",
+ "test-" + alwaysName,
+ }, integ.WithTimeout(60*time.Second))
+ assert.Contains(t, out, "pull-policy-v3")
+ assert.NotContains(t, out, "pull-policy-v2")
r.Run(t, []string{"unikraft", "instance", "delete", "test-" + alwaysName})
r.Run(t, []string{"unikraft", "image", "delete", image})
})
+ t.Run("image-headers", func(t *testing.T) {
+ r := runner(t, true, []string{staging, stable})
+ instName := uniq()
+
+ create := []string{
+ "unikraft", "instance", "create",
+ "--output", "quiet",
+ "--name", "test-" + instName,
+ "--metro", r.MetroName,
+ "--image", "nginx:latest",
+ "--memory", "128",
+ }
+ edit := []string{
+ "unikraft", "instance", "edit", "test-" + instName,
+ "--output", "quiet",
+ "--image", "nginx:latest",
+ }
+ var flags []string
+ var keys string
+ for i := range 17 {
+ flags = append(flags, "--image-header", fmt.Sprintf("X-Unikraft-Test-%d=1", i))
+ keys += fmt.Sprintf(",headers.X-Unikraft-Test-%d=1", i)
+ }
+
+ for _, tooMany := range [][]string{
+ flags,
+ {"--rom", "name=r,image=nginx:latest" + keys},
+ {"--plugin", "name=p,image=nginx:latest" + keys},
+ } {
+ out := r.Run(t, slices.Concat(create, tooMany), integ.ExpectFail())
+ assert.Regexp(t, `more than 16 headers`, out)
+ }
+
+ r.Run(t, slices.Concat(create, []string{"--image-header", "X-Unikraft-Test=1"}))
+ r.Run(t, slices.Concat(edit, []string{"--image-header", "X-Unikraft-Test=2"}))
+ out := r.Run(t, slices.Concat(edit, flags), integ.ExpectFail())
+ assert.Regexp(t, `more than 16 headers`, out)
+
+ r.Run(t, []string{"unikraft", "instance", "delete", "test-" + instName})
+ })
+
t.Run("replicas", func(t *testing.T) {
r := runner(t, true, []string{staging, stable})
instName := uniq()
diff --git a/cmd/unikraft/integration/mcp_test.go b/cmd/unikraft/integration/mcp_test.go
index ada97a522..3b88f46cb 100644
--- a/cmd/unikraft/integration/mcp_test.go
+++ b/cmd/unikraft/integration/mcp_test.go
@@ -38,7 +38,7 @@ func TestMCP(t *testing.T) {
"metro": r.MetroName,
"image": image,
"runtime.args": "tail -f /dev/null",
- "plugins": []string{"name=" + sandboxPlugin + ",rom=" + sandboxPluginRom},
+ "plugins": []string{"name=" + sandboxPlugin + ",rom=" + sandboxPluginRom + ",pull-policy=always"},
"resources.memory": "512MiB",
"resources.vcpus": 1,
}})
diff --git a/cmd/unikraft/integration/sandbox_test.go b/cmd/unikraft/integration/sandbox_test.go
index adc17a6f2..65160c5ab 100644
--- a/cmd/unikraft/integration/sandbox_test.go
+++ b/cmd/unikraft/integration/sandbox_test.go
@@ -40,7 +40,7 @@ func newSandboxInstance(t *testing.T, r *integ.TestEnv) string {
"--metro", r.MetroName,
"--image", image,
"--args", "tail -f /dev/null",
- "--plugin", "name=" + sandboxPlugin + ",rom=" + sandboxPluginRom,
+ "--plugin", "name=" + sandboxPlugin + ",rom=" + sandboxPluginRom + ",pull-policy=always",
"--memory", "512",
"--vcpus", "1",
"--autostart",
diff --git a/cmd/unikraft/integration/service_test.go b/cmd/unikraft/integration/service_test.go
index ffe07f94b..49dc0ce16 100644
--- a/cmd/unikraft/integration/service_test.go
+++ b/cmd/unikraft/integration/service_test.go
@@ -6,6 +6,10 @@
package integration
import (
+ "fmt"
+ "math/rand/v2"
+ "os"
+ "regexp"
"strings"
"testing"
@@ -143,6 +147,59 @@ func TestServices(t *testing.T) {
r.Run(t, []string{"unikraft", "service", "delete", "test-" + svcName})
})
+ t.Run("udp", func(t *testing.T) {
+ r := runner(t, true, []string{staging})
+
+ out := r.Run(t, []string{
+ "unikraft", "service", "create",
+ "--metro", r.MetroName,
+ "--service", "53:53/udp",
+ }, integ.ExpectFail())
+ assert.Contains(t, out, "UDP services must have an IP address configured")
+ })
+
+ t.Run("udp-ip", func(t *testing.T) {
+ ip := os.Getenv("UNIKRAFT_X_TEST_UDP_IP")
+ if ip == "" {
+ t.Skip("udp test requires UNIKRAFT_X_TEST_UDP_IP")
+ }
+ r := runner(t, true, []string{staging})
+ svcName := "test-" + uniq()
+ port := 20000 + rand.IntN(40000)
+ udpSvc := fmt.Sprintf("%d:%d/udp@%s", port, port, ip)
+ tcpSvc := fmt.Sprintf("%d:8080/tls@%s", port, ip)
+ udpOut := fmt.Sprintf(`source:\s+%d\s+destination:\s+%d\s+protocol:\s+udp\s+ip:\s+%s`, port, port, regexp.QuoteMeta(ip))
+ tcpOut := fmt.Sprintf(`source:\s+%d\s+destination:\s+8080\s+protocol:\s+tcp\s+ip:\s+%s`, port, regexp.QuoteMeta(ip))
+
+ out := r.Run(t, []string{
+ "unikraft", "service", "create",
+ "--name", svcName,
+ "--metro", r.MetroName,
+ "--service", udpSvc,
+ })
+ assert.Regexp(t, udpOut, out)
+
+ r.Run(t, []string{
+ "unikraft", "service", "edit", svcName,
+ "--output", "quiet",
+ "--add", "services=" + tcpSvc,
+ })
+ out = r.Run(t, []string{"unikraft", "service", "inspect", svcName})
+ assert.Regexp(t, udpOut, out)
+ assert.Regexp(t, tcpOut, out)
+
+ r.Run(t, []string{
+ "unikraft", "service", "edit", svcName,
+ "--output", "quiet",
+ "--del", "services=" + udpSvc,
+ })
+ out = r.Run(t, []string{"unikraft", "service", "inspect", svcName})
+ assert.NotRegexp(t, udpOut, out)
+ assert.Regexp(t, tcpOut, out)
+
+ r.Run(t, []string{"unikraft", "service", "delete", svcName})
+ })
+
t.Run("delete-drain", func(t *testing.T) {
r := runner(t, true, []string{staging, stable})
svcName := "test-" + uniq()
diff --git a/cmd/unikraft/testdata/TestHelp/build b/cmd/unikraft/testdata/TestHelp/build
index b645c0ed2..e774665f9 100644
--- a/cmd/unikraft/testdata/TestHelp/build
+++ b/cmd/unikraft/testdata/TestHelp/build
@@ -34,9 +34,9 @@ Examples:
Flags:
-o, --output
- Output destination.
+ Output destination. A remote build needs an image with a tag, such as my-org/my-app:latest.
--arch
- Only build the Kraftfile targets of these architectures. Defaults to every declared target, or x86_64 when only a runtime is declared. Required when the project declares no targets and no runtime, such as a bare Dockerfile.
+ Only build the Kraftfile targets of these architectures. Defaults to every declared target, or x86_64 when only a runtime is declared. A local build requires it when the project declares no targets and no runtime, such as a bare Dockerfile. A remote build of such a project defaults to x86_64.
[examples: x86_64, arm64]
--build-arg
Set build-time variables.
@@ -49,7 +49,7 @@ Flags:
--insecure
Allow insecure (HTTP/unverified TLS) connections to registries. Specify hostnames to restrict, or omit to apply to all.
--remote= ($UNIKRAFT_BUILD_URL)
- Build on the build service at this URL and push the image from there, instead of building locally. Defaults to the build_url of the profile, or https://controlplane.unikraft.com. Creates a builder with the default sizes if you have none. To set the sizes, use 'unikraft builder create'.
+ Build on the build service at this URL and push the image from there, instead of building locally. Defaults to the build_url of the profile, or https://controlplane.unikraft.com. Write a URL as --remote=, because the flag does not take the next argument. Creates a builder with the default sizes if you have none. To set the sizes, use 'unikraft builder create'.
--metro= ...
Metros that a remote build may run in, by name or API URL. Defaults to the build service's choice.
@@ -95,6 +95,7 @@ Commands:
Fields:
name
+ metro
default
running
waiting
@@ -145,7 +146,9 @@ Flags:
--cache=
Size of the builder's cache volume. Defaults to the build service's.
--remote= ($UNIKRAFT_BUILD_URL)
- URL of the build service that manages the builder. Defaults to the build_url of the profile.
+ URL of the build service that manages the builder. Defaults to the build_url of the profile, or https://controlplane.unikraft.com.
+ --metro=
+ Metro of the builder, by name or API URL. Defaults to the first metro that your builds may run in.
Global flags:
-h, --help
@@ -183,6 +186,7 @@ Examples:
Fields:
name
+ metro
default
running
waiting
@@ -198,7 +202,9 @@ Flags:
-o, --output
Output format. One of: kv, table, json, yaml, raw, quiet, template.
--remote= ($UNIKRAFT_BUILD_URL)
- URL of the build service that manages the builder. Defaults to the build_url of the profile.
+ URL of the build service that manages the builder. Defaults to the build_url of the profile, or https://controlplane.unikraft.com.
+ --metro=
+ Metro of the builder, by name or API URL. Defaults to the first metro that your builds may run in.
Global flags:
-h, --help
@@ -223,6 +229,11 @@ $ unikraft builder list --help
List builders.
+Each replica of the build service runs up to max-builds builds on a
+builder at once, so running can be higher than max-builds. Waiting
+counts the builds that have not started: those that wait for a build
+slot and those that wait for their client's session.
+
Usage:
unikraft builder list [ ...] [flags]
@@ -236,6 +247,7 @@ Examples:
Fields:
name
+ metro
default
running
waiting
@@ -259,7 +271,7 @@ Flags:
-o, --output
Output format. One of: kv, table, json, yaml, raw, quiet, template.
--remote= ($UNIKRAFT_BUILD_URL)
- URL of the build service that manages the builders. Defaults to the build_url of the profile.
+ URL of the build service that manages the builders. Defaults to the build_url of the profile, or https://controlplane.unikraft.com.
Global flags:
-h, --help
@@ -297,6 +309,7 @@ Examples:
Fields:
name
+ metro
default
running
waiting
@@ -310,7 +323,9 @@ Flags:
-o, --output
Output format. One of: kv, table, json, yaml, raw, quiet, template.
--remote= ($UNIKRAFT_BUILD_URL)
- URL of the build service that manages the builder. Defaults to the build_url of the profile.
+ URL of the build service that manages the builder. Defaults to the build_url of the profile, or https://controlplane.unikraft.com.
+ --metro=
+ Metro of the builder, by name or API URL. Defaults to the first metro that your builds may run in.
Global flags:
-h, --help
@@ -349,7 +364,9 @@ Examples:
Flags:
--remote= ($UNIKRAFT_BUILD_URL)
- URL of the build service that manages the builder. Defaults to the build_url of the profile.
+ URL of the build service that manages the builder. Defaults to the build_url of the profile, or https://controlplane.unikraft.com.
+ --metro=
+ Metro of the builder, by name or API URL. Defaults to the first metro that your builds may run in.
Global flags:
-h, --help
@@ -388,7 +405,9 @@ Examples:
Flags:
--remote= ($UNIKRAFT_BUILD_URL)
- URL of the build service that manages the builder. Defaults to the build_url of the profile.
+ URL of the build service that manages the builder. Defaults to the build_url of the profile, or https://controlplane.unikraft.com.
+ --metro=
+ Metro of the builder, by name or API URL. Defaults to the first metro that your builds may run in.
Global flags:
-h, --help
diff --git a/cmd/unikraft/testdata/TestHelp/config b/cmd/unikraft/testdata/TestHelp/config
index 6edf20c8d..e372ba9dd 100644
--- a/cmd/unikraft/testdata/TestHelp/config
+++ b/cmd/unikraft/testdata/TestHelp/config
@@ -14,9 +14,10 @@ Fields:
profile
profiles, profiles.*, profiles.*.name, profiles.*.type, profiles.*.token,
profiles.*.organization, profiles.*.user-uuid, profiles.*.organization-uuid,
- profiles.*.control-plane, profiles.*.insecure, profiles.*.registry-mirror,
- profiles.*.build-url, profiles.*.metros, profiles.*.metros.*,
- profiles.*.metros.*.name, profiles.*.metros.*.endpoint,
+ profiles.*.control-plane, profiles.*.insecure, profiles.*.registry,
+ profiles.*.registry.host, profiles.*.registry.mirror,
+ profiles.*.registry.insecure, profiles.*.build-url, profiles.*.metros,
+ profiles.*.metros.*, profiles.*.metros.*.name, profiles.*.metros.*.endpoint,
profiles.*.metros.*.proxy, profiles.*.metros.*.location,
profiles.*.metros.*.insecure, profiles.*.metro-default
@@ -59,9 +60,10 @@ Fields:
profile
profiles, profiles.*, profiles.*.name, profiles.*.type, profiles.*.token,
profiles.*.organization, profiles.*.user-uuid, profiles.*.organization-uuid,
- profiles.*.control-plane, profiles.*.insecure, profiles.*.registry-mirror,
- profiles.*.build-url, profiles.*.metros, profiles.*.metros.*,
- profiles.*.metros.*.name, profiles.*.metros.*.endpoint,
+ profiles.*.control-plane, profiles.*.insecure, profiles.*.registry,
+ profiles.*.registry.host, profiles.*.registry.mirror,
+ profiles.*.registry.insecure, profiles.*.build-url, profiles.*.metros,
+ profiles.*.metros.*, profiles.*.metros.*.name, profiles.*.metros.*.endpoint,
profiles.*.metros.*.proxy, profiles.*.metros.*.location,
profiles.*.metros.*.insecure, profiles.*.metro-default
diff --git a/cmd/unikraft/testdata/TestHelp/images b/cmd/unikraft/testdata/TestHelp/images
index bbebf4bba..b2c37fc0b 100644
--- a/cmd/unikraft/testdata/TestHelp/images
+++ b/cmd/unikraft/testdata/TestHelp/images
@@ -78,9 +78,9 @@ Examples:
Flags:
-o, --output
- Output destination.
+ Output destination. A remote build needs an image with a tag, such as my-org/my-app:latest.
--arch
- Only build the Kraftfile targets of these architectures. Defaults to every declared target, or x86_64 when only a runtime is declared. Required when the project declares no targets and no runtime, such as a bare Dockerfile.
+ Only build the Kraftfile targets of these architectures. Defaults to every declared target, or x86_64 when only a runtime is declared. A local build requires it when the project declares no targets and no runtime, such as a bare Dockerfile. A remote build of such a project defaults to x86_64.
[examples: x86_64, arm64]
--build-arg
Set build-time variables.
@@ -93,7 +93,7 @@ Flags:
--insecure
Allow insecure (HTTP/unverified TLS) connections to registries. Specify hostnames to restrict, or omit to apply to all.
--remote= ($UNIKRAFT_BUILD_URL)
- Build on the build service at this URL and push the image from there, instead of building locally. Defaults to the build_url of the profile, or https://controlplane.unikraft.com. Creates a builder with the default sizes if you have none. To set the sizes, use 'unikraft builder create'.
+ Build on the build service at this URL and push the image from there, instead of building locally. Defaults to the build_url of the profile, or https://controlplane.unikraft.com. Write a URL as --remote=, because the flag does not take the next argument. Creates a builder with the default sizes if you have none. To set the sizes, use 'unikraft builder create'.
--metro= ...
Metros that a remote build may run in, by name or API URL. Defaults to the build service's choice.
diff --git a/cmd/unikraft/testdata/TestHelp/instances b/cmd/unikraft/testdata/TestHelp/instances
index 6c8469401..403a796e4 100644
--- a/cmd/unikraft/testdata/TestHelp/instances
+++ b/cmd/unikraft/testdata/TestHelp/instances
@@ -33,7 +33,7 @@ Resources:
tunnel, port-forward
Forward a local port to an unexposed instance.
history
- Show checkpoint history for an instance.
+ Show the lineage of an instance.
shell, sh
Open an interactive shell on a sandbox instance.
exec
@@ -63,6 +63,7 @@ Fields:
state
image
pull-policy
+ image-headers
type
runtime, runtime.args, runtime.env
resources, resources.memory, resources.vcpus, resources.gpus
@@ -72,8 +73,10 @@ Fields:
service.soft-limit, service.hard-limit
volumes, volumes.*, volumes.*.name, volumes.*.uuid, volumes.*.at,
volumes.*.readonly, volumes.*.size
- roms, roms.*, roms.*.name, roms.*.image, roms.*.dir, roms.*.at
- plugins, plugins.*, plugins.*.name, plugins.*.image, plugins.*.config
+ roms, roms.*, roms.*.name, roms.*.image, roms.*.pull-policy, roms.*.headers,
+ roms.*.dir, roms.*.at
+ plugins, plugins.*, plugins.*.name, plugins.*.image, plugins.*.pull-policy,
+ plugins.*.headers, plugins.*.config
private-fqdn
networks, networks.*, networks.*.name, networks.*.uuid, networks.*.private-ip,
networks.*.mac, networks.*.tap-name, networks.*.relay, networks.*.relay.name,
@@ -144,6 +147,7 @@ Fields:
state
image
pull-policy
+ image-headers
type
runtime, runtime.args, runtime.env
resources, resources.memory, resources.vcpus, resources.gpus
@@ -153,8 +157,10 @@ Fields:
service.soft-limit, service.hard-limit
volumes, volumes.*, volumes.*.name, volumes.*.uuid, volumes.*.at,
volumes.*.readonly, volumes.*.size
- roms, roms.*, roms.*.name, roms.*.image, roms.*.dir, roms.*.at
- plugins, plugins.*, plugins.*.name, plugins.*.image, plugins.*.config
+ roms, roms.*, roms.*.name, roms.*.image, roms.*.pull-policy, roms.*.headers,
+ roms.*.dir, roms.*.at
+ plugins, plugins.*, plugins.*.name, plugins.*.image, plugins.*.pull-policy,
+ plugins.*.headers, plugins.*.config
private-fqdn
networks, networks.*, networks.*.name, networks.*.uuid, networks.*.private-ip,
networks.*.mac, networks.*.tap-name, networks.*.relay, networks.*.relay.name,
@@ -233,6 +239,7 @@ Fields:
state
image
pull-policy
+ image-headers
type
runtime, runtime.args, runtime.env
resources, resources.memory, resources.vcpus, resources.gpus
@@ -242,8 +249,10 @@ Fields:
service.soft-limit, service.hard-limit
volumes, volumes.*, volumes.*.name, volumes.*.uuid, volumes.*.at,
volumes.*.readonly, volumes.*.size
- roms, roms.*, roms.*.name, roms.*.image, roms.*.dir, roms.*.at
- plugins, plugins.*, plugins.*.name, plugins.*.image, plugins.*.config
+ roms, roms.*, roms.*.name, roms.*.image, roms.*.pull-policy, roms.*.headers,
+ roms.*.dir, roms.*.at
+ plugins, plugins.*, plugins.*.name, plugins.*.image, plugins.*.pull-policy,
+ plugins.*.headers, plugins.*.config
private-fqdn
networks, networks.*, networks.*.name, networks.*.uuid, networks.*.private-ip,
networks.*.mac, networks.*.tap-name, networks.*.relay, networks.*.relay.name,
@@ -326,6 +335,7 @@ Fields:
state
image
pull-policy
+ image-headers
type
runtime, runtime.args, runtime.env
resources, resources.memory, resources.vcpus, resources.gpus
@@ -335,8 +345,10 @@ Fields:
service.soft-limit, service.hard-limit
volumes, volumes.*, volumes.*.name, volumes.*.uuid, volumes.*.at,
volumes.*.readonly, volumes.*.size
- roms, roms.*, roms.*.name, roms.*.image, roms.*.dir, roms.*.at
- plugins, plugins.*, plugins.*.name, plugins.*.image, plugins.*.config
+ roms, roms.*, roms.*.name, roms.*.image, roms.*.pull-policy, roms.*.headers,
+ roms.*.dir, roms.*.at
+ plugins, plugins.*, plugins.*.name, plugins.*.image, plugins.*.pull-policy,
+ plugins.*.headers, plugins.*.config
private-fqdn
networks, networks.*, networks.*.name, networks.*.uuid, networks.*.private-ip,
networks.*.mac, networks.*.tap-name, networks.*.relay, networks.*.relay.name,
@@ -469,6 +481,7 @@ Fields:
state
image
pull-policy
+ image-headers
type
runtime, runtime.args, runtime.env
resources, resources.memory, resources.vcpus, resources.gpus
@@ -478,8 +491,10 @@ Fields:
service.soft-limit, service.hard-limit
volumes, volumes.*, volumes.*.name, volumes.*.uuid, volumes.*.at,
volumes.*.readonly, volumes.*.size
- roms, roms.*, roms.*.name, roms.*.image, roms.*.dir, roms.*.at
- plugins, plugins.*, plugins.*.name, plugins.*.image, plugins.*.config
+ roms, roms.*, roms.*.name, roms.*.image, roms.*.pull-policy, roms.*.headers,
+ roms.*.dir, roms.*.at
+ plugins, plugins.*, plugins.*.name, plugins.*.image, plugins.*.pull-policy,
+ plugins.*.headers, plugins.*.config
private-fqdn
networks, networks.*, networks.*.name, networks.*.uuid, networks.*.private-ip,
networks.*.mac, networks.*.tap-name, networks.*.relay, networks.*.relay.name,
@@ -559,8 +574,11 @@ Create flags:
Image to deploy, as an OCI reference or a full registry URL. On create, required unless template, branch or checkpoint is given, and cannot be combined with them.
[examples: nginx:latest, my-app:v1.2.3]
--pull-policy=
- When to pull the image relative to the node's cache: always, if_not_present or never.
+ When to pull the image relative to the node's cache: always, if_not_present or never. Needs image in the same create or edit. Each image edit replaces the pull policy and headers, so set both again.
[examples: always, if_not_present, never]
+ --image-header== ...
+ HTTP header sent when fetching the image, as KEY=value, up to 16. Needs image in the same create or edit. Each image edit replaces the pull policy and headers, so set both again.
+ [example: Authorization=Bearer ]
--type=
Virtual machine type.
micro: Firecracker microVM (default)
@@ -583,12 +601,15 @@ Create flags:
[examples: 0, 1]
--service=
Service group to join, by name or UUID. Leave unset and give service.services or service.domains to create a group owned by the instance. Without any service the instance is reachable only privately.
- -p, --publish=:[/] ...
- Published port as SOURCE:DESTINATION[/HANDLERS], with handlers joined by +. Port 80 must use http, port 443 http+tls, and any other port tls only.
+ -p, --publish=:[/][@] ...
+ Published port as SOURCE:DESTINATION[/OPTIONS][@IP], with options joined by +. TCP port 80 must use http, port 443 http+tls, and any other port tls only. UDP ports take no handlers and need an IP.
http: load balance per HTTP request instead of per TCP connection
tls: terminate TLS at the platform
- redirect: redirect HTTP on port 80 to HTTPS, as in 80:443/http+redirect.
- [examples: 443:8080/http+tls, 80:443/http+redirect]
+ redirect: redirect HTTP on port 80 to HTTPS, as in 80:443/http+redirect
+ tcp: publish a TCP port, the default
+ udp: publish a UDP port instead of TCP, as in 53:53/udp@203.0.113.10
+ @IP: public IP assigned to you on the group's node.
+ [examples: 443:8080/http+tls, 80:443/http+redirect, 53:53/udp@203.0.113.10]
--domain= ...
Domain for the group.
myapp: a bare label becomes a subdomain of the metro
@@ -597,11 +618,11 @@ Create flags:
-v, --volume=[]:[:] ...
Volume to attach as NAME:/MOUNT[:ro], where the mount path is absolute and outside /uk. On create, leave NAME empty and add :size=SIZE, as in :/data:size=1GiB, to make a new volume with a generated name.
[examples: my-vol:/data, cache:/tmp:ro, :/data:size=1GiB]
- --rom=name=,image=[,at= ...
- Read-only ROM device from an image or a local directory. The name uses letters, digits, - and _, and appears as /dev/ukp_rom_NAME in the guest.
+ --rom=name=,image=][[,pull-policy=][,headers.=],at= ...
+ Read-only ROM device from an image or a local directory. The name uses letters, digits, - and _, and appears as /dev/ukp_rom_NAME in the guest. Add pull-policy=always|if_not_present|never to control when the image is pulled. Add headers.KEY=value for each HTTP header sent when fetching the image; for a value with a comma, use headers={"KEY":"a,b"}.
[examples: name=my-rom,image=myuser/my-rom:latest,at=/rom0, name=mydata,dir=./mydata,at=/rom]
- --plugin=name=,image=][[,config=] ...
- Plugin loaded from an image, with an optional JSON config passed to it on start. Up to 8 per instance.
+ --plugin=name=,image=][[,pull-policy=][,headers.=][,config=] ...
+ Plugin loaded from an image, with an optional JSON config passed to it on start. Up to 8 per instance. Add pull-policy=always|if_not_present|never to control when the image is pulled. Add headers.KEY=value for each HTTP header sent when fetching the image; for a value with a comma, use headers={"KEY":"a,b"}.
[examples: name=sandbox,image=plugins/sandbox:latest, name=sandbox,image=plugins/sandbox:latest,config={"persist_path":"/data"}]
--network== ...
Network interface to attach, one per flag and up to 4. The first one is the primary interface. Needs the net_manager permission.
@@ -738,6 +759,7 @@ Fields:
state
image
pull-policy
+ image-headers
type
runtime, runtime.args, runtime.env
resources, resources.memory, resources.vcpus, resources.gpus
@@ -747,8 +769,10 @@ Fields:
service.soft-limit, service.hard-limit
volumes, volumes.*, volumes.*.name, volumes.*.uuid, volumes.*.at,
volumes.*.readonly, volumes.*.size
- roms, roms.*, roms.*.name, roms.*.image, roms.*.dir, roms.*.at
- plugins, plugins.*, plugins.*.name, plugins.*.image, plugins.*.config
+ roms, roms.*, roms.*.name, roms.*.image, roms.*.pull-policy, roms.*.headers,
+ roms.*.dir, roms.*.at
+ plugins, plugins.*, plugins.*.name, plugins.*.image, plugins.*.pull-policy,
+ plugins.*.headers, plugins.*.config
private-fqdn
networks, networks.*, networks.*.name, networks.*.uuid, networks.*.private-ip,
networks.*.mac, networks.*.tap-name, networks.*.relay, networks.*.relay.name,
@@ -828,8 +852,11 @@ Create flags:
Image to deploy, as an OCI reference or a full registry URL. On create, required unless template, branch or checkpoint is given, and cannot be combined with them.
[examples: nginx:latest, my-app:v1.2.3]
--pull-policy=
- When to pull the image relative to the node's cache: always, if_not_present or never.
+ When to pull the image relative to the node's cache: always, if_not_present or never. Needs image in the same create or edit. Each image edit replaces the pull policy and headers, so set both again.
[examples: always, if_not_present, never]
+ --image-header== ...
+ HTTP header sent when fetching the image, as KEY=value, up to 16. Needs image in the same create or edit. Each image edit replaces the pull policy and headers, so set both again.
+ [example: Authorization=Bearer ]
--type=
Virtual machine type.
micro: Firecracker microVM (default)
@@ -852,12 +879,15 @@ Create flags:
[examples: 0, 1]
--service=
Service group to join, by name or UUID. Leave unset and give service.services or service.domains to create a group owned by the instance. Without any service the instance is reachable only privately.
- -p, --publish=:[/] ...
- Published port as SOURCE:DESTINATION[/HANDLERS], with handlers joined by +. Port 80 must use http, port 443 http+tls, and any other port tls only.
+ -p, --publish=:[/][@] ...
+ Published port as SOURCE:DESTINATION[/OPTIONS][@IP], with options joined by +. TCP port 80 must use http, port 443 http+tls, and any other port tls only. UDP ports take no handlers and need an IP.
http: load balance per HTTP request instead of per TCP connection
tls: terminate TLS at the platform
- redirect: redirect HTTP on port 80 to HTTPS, as in 80:443/http+redirect.
- [examples: 443:8080/http+tls, 80:443/http+redirect]
+ redirect: redirect HTTP on port 80 to HTTPS, as in 80:443/http+redirect
+ tcp: publish a TCP port, the default
+ udp: publish a UDP port instead of TCP, as in 53:53/udp@203.0.113.10
+ @IP: public IP assigned to you on the group's node.
+ [examples: 443:8080/http+tls, 80:443/http+redirect, 53:53/udp@203.0.113.10]
--domain= ...
Domain for the group.
myapp: a bare label becomes a subdomain of the metro
@@ -866,11 +896,11 @@ Create flags:
-v, --volume=[]:[:] ...
Volume to attach as NAME:/MOUNT[:ro], where the mount path is absolute and outside /uk. On create, leave NAME empty and add :size=SIZE, as in :/data:size=1GiB, to make a new volume with a generated name.
[examples: my-vol:/data, cache:/tmp:ro, :/data:size=1GiB]
- --rom=name=,image=][,at= ...
- Read-only ROM device from an image or a local directory. The name uses letters, digits, - and _, and appears as /dev/ukp_rom_NAME in the guest.
+ --rom=name=,image=][[,pull-policy=][,headers.=],at= ...
+ Read-only ROM device from an image or a local directory. The name uses letters, digits, - and _, and appears as /dev/ukp_rom_NAME in the guest. Add pull-policy=always|if_not_present|never to control when the image is pulled. Add headers.KEY=value for each HTTP header sent when fetching the image; for a value with a comma, use headers={"KEY":"a,b"}.
[examples: name=my-rom,image=myuser/my-rom:latest,at=/rom0, name=mydata,dir=./mydata,at=/rom]
- --plugin=name=,image=][[,config=] ...
- Plugin loaded from an image, with an optional JSON config passed to it on start. Up to 8 per instance.
+ --plugin=name=,image=][[,pull-policy=][,headers.=][,config=] ...
+ Plugin loaded from an image, with an optional JSON config passed to it on start. Up to 8 per instance. Add pull-policy=always|if_not_present|never to control when the image is pulled. Add headers.KEY=value for each HTTP header sent when fetching the image; for a value with a comma, use headers={"KEY":"a,b"}.
[examples: name=sandbox,image=plugins/sandbox:latest, name=sandbox,image=plugins/sandbox:latest,config={"persist_path":"/data"}]
--network== ...
Network interface to attach, one per flag and up to 4. The first one is the primary interface. Needs the net_manager permission.
@@ -991,6 +1021,7 @@ Fields:
state
image
pull-policy
+ image-headers
type
runtime, runtime.args, runtime.env
resources, resources.memory, resources.vcpus, resources.gpus
@@ -1000,8 +1031,10 @@ Fields:
service.soft-limit, service.hard-limit
volumes, volumes.*, volumes.*.name, volumes.*.uuid, volumes.*.at,
volumes.*.readonly, volumes.*.size
- roms, roms.*, roms.*.name, roms.*.image, roms.*.dir, roms.*.at
- plugins, plugins.*, plugins.*.name, plugins.*.image, plugins.*.config
+ roms, roms.*, roms.*.name, roms.*.image, roms.*.pull-policy, roms.*.headers,
+ roms.*.dir, roms.*.at
+ plugins, plugins.*, plugins.*.name, plugins.*.image, plugins.*.pull-policy,
+ plugins.*.headers, plugins.*.config
private-fqdn
networks, networks.*, networks.*.name, networks.*.uuid, networks.*.private-ip,
networks.*.mac, networks.*.tap-name, networks.*.relay, networks.*.relay.name,
@@ -1083,8 +1116,11 @@ Create flags:
Image to deploy, as an OCI reference or a full registry URL. On create, required unless template, branch or checkpoint is given, and cannot be combined with them.
[examples: nginx:latest, my-app:v1.2.3]
--pull-policy=
- When to pull the image relative to the node's cache: always, if_not_present or never.
+ When to pull the image relative to the node's cache: always, if_not_present or never. Needs image in the same create or edit. Each image edit replaces the pull policy and headers, so set both again.
[examples: always, if_not_present, never]
+ --image-header== ...
+ HTTP header sent when fetching the image, as KEY=value, up to 16. Needs image in the same create or edit. Each image edit replaces the pull policy and headers, so set both again.
+ [example: Authorization=Bearer ]
--type=
Virtual machine type.
micro: Firecracker microVM (default)
@@ -1107,12 +1143,15 @@ Create flags:
[examples: 0, 1]
--service=
Service group to join, by name or UUID. Leave unset and give service.services or service.domains to create a group owned by the instance. Without any service the instance is reachable only privately.
- -p, --publish=:[/] ...
- Published port as SOURCE:DESTINATION[/HANDLERS], with handlers joined by +. Port 80 must use http, port 443 http+tls, and any other port tls only.
+ -p, --publish=:[/][@] ...
+ Published port as SOURCE:DESTINATION[/OPTIONS][@IP], with options joined by +. TCP port 80 must use http, port 443 http+tls, and any other port tls only. UDP ports take no handlers and need an IP.
http: load balance per HTTP request instead of per TCP connection
tls: terminate TLS at the platform
- redirect: redirect HTTP on port 80 to HTTPS, as in 80:443/http+redirect.
- [examples: 443:8080/http+tls, 80:443/http+redirect]
+ redirect: redirect HTTP on port 80 to HTTPS, as in 80:443/http+redirect
+ tcp: publish a TCP port, the default
+ udp: publish a UDP port instead of TCP, as in 53:53/udp@203.0.113.10
+ @IP: public IP assigned to you on the group's node.
+ [examples: 443:8080/http+tls, 80:443/http+redirect, 53:53/udp@203.0.113.10]
--domain= ...
Domain for the group.
myapp: a bare label becomes a subdomain of the metro
@@ -1121,11 +1160,11 @@ Create flags:
-v, --volume=[]:[:] ...
Volume to attach as NAME:/MOUNT[:ro], where the mount path is absolute and outside /uk. On create, leave NAME empty and add :size=SIZE, as in :/data:size=1GiB, to make a new volume with a generated name.
[examples: my-vol:/data, cache:/tmp:ro, :/data:size=1GiB]
- --rom=name=,image=][,at= ...
- Read-only ROM device from an image or a local directory. The name uses letters, digits, - and _, and appears as /dev/ukp_rom_NAME in the guest.
+ --rom=name=,image=][[,pull-policy=][,headers.=],at= ...
+ Read-only ROM device from an image or a local directory. The name uses letters, digits, - and _, and appears as /dev/ukp_rom_NAME in the guest. Add pull-policy=always|if_not_present|never to control when the image is pulled. Add headers.KEY=value for each HTTP header sent when fetching the image; for a value with a comma, use headers={"KEY":"a,b"}.
[examples: name=my-rom,image=myuser/my-rom:latest,at=/rom0, name=mydata,dir=./mydata,at=/rom]
- --plugin=name=,image=][[,config=] ...
- Plugin loaded from an image, with an optional JSON config passed to it on start. Up to 8 per instance.
+ --plugin=name=,image=][[,pull-policy=][,headers.=][,config=] ...
+ Plugin loaded from an image, with an optional JSON config passed to it on start. Up to 8 per instance. Add pull-policy=always|if_not_present|never to control when the image is pulled. Add headers.KEY=value for each HTTP header sent when fetching the image; for a value with a comma, use headers={"KEY":"a,b"}.
[examples: name=sandbox,image=plugins/sandbox:latest, name=sandbox,image=plugins/sandbox:latest,config={"persist_path":"/data"}]
--network== ...
Network interface to attach, one per flag and up to 4. The first one is the primary interface. Needs the net_manager permission.
@@ -1202,6 +1241,9 @@ Examples:
# Resize instance memory
unikraft instance edit demo-instance --memory 256
+ # Change the image and always pull it, even if the node has it cached
+ unikraft instance edit demo-instance --image my-app:v2 --pull-policy always
+
# Attach a ROM image to an instance
unikraft instance edit demo-instance \
--set roms=name=my-rom,image=myuser/my-rom:latest,at=/rom0
@@ -1229,6 +1271,7 @@ Fields:
state
image
pull-policy
+ image-headers
type
runtime, runtime.args, runtime.env
resources, resources.memory, resources.vcpus, resources.gpus
@@ -1238,8 +1281,10 @@ Fields:
service.soft-limit, service.hard-limit
volumes, volumes.*, volumes.*.name, volumes.*.uuid, volumes.*.at,
volumes.*.readonly, volumes.*.size
- roms, roms.*, roms.*.name, roms.*.image, roms.*.dir, roms.*.at
- plugins, plugins.*, plugins.*.name, plugins.*.image, plugins.*.config
+ roms, roms.*, roms.*.name, roms.*.image, roms.*.pull-policy, roms.*.headers,
+ roms.*.dir, roms.*.at
+ plugins, plugins.*, plugins.*.name, plugins.*.image, plugins.*.pull-policy,
+ plugins.*.headers, plugins.*.config
private-fqdn
networks, networks.*, networks.*.name, networks.*.uuid, networks.*.private-ip,
networks.*.mac, networks.*.tap-name, networks.*.relay, networks.*.relay.name,
@@ -1315,6 +1360,12 @@ Edit flags:
--image=:
Image to deploy, as an OCI reference or a full registry URL. On create, required unless template, branch or checkpoint is given, and cannot be combined with them.
[examples: nginx:latest, my-app:v1.2.3]
+ --pull-policy=
+ When to pull the image relative to the node's cache: always, if_not_present or never. Needs image in the same create or edit. Each image edit replaces the pull policy and headers, so set both again.
+ [examples: always, if_not_present, never]
+ --image-header== ...
+ HTTP header sent when fetching the image, as KEY=value, up to 16. Needs image in the same create or edit. Each image edit replaces the pull policy and headers, so set both again.
+ [example: Authorization=Bearer ]
--args=
Command-line arguments passed to the instance at start.
[example: --port=8080]
@@ -1327,11 +1378,11 @@ Edit flags:
--vcpus=
Number of vCPUs, within the range the plan allows (see quotas.limits.vcpus on the metro). Defaults to 1 on create.
[examples: 1, 2, 4]
- --rom=name=,image=][,at= ...
- Read-only ROM device from an image or a local directory. The name uses letters, digits, - and _, and appears as /dev/ukp_rom_NAME in the guest.
+ --rom=name=,image=][[,pull-policy=][,headers.=],at= ...
+ Read-only ROM device from an image or a local directory. The name uses letters, digits, - and _, and appears as /dev/ukp_rom_NAME in the guest. Add pull-policy=always|if_not_present|never to control when the image is pulled. Add headers.KEY=value for each HTTP header sent when fetching the image; for a value with a comma, use headers={"KEY":"a,b"}.
[examples: name=my-rom,image=myuser/my-rom:latest,at=/rom0, name=mydata,dir=./mydata,at=/rom]
- --plugin=name=,image=][[,config=] ...
- Plugin loaded from an image, with an optional JSON config passed to it on start. Up to 8 per instance.
+ --plugin=name=,image=][[,pull-policy=][,headers.=][,config=] ...
+ Plugin loaded from an image, with an optional JSON config passed to it on start. Up to 8 per instance. Add pull-policy=always|if_not_present|never to control when the image is pulled. Add headers.KEY=value for each HTTP header sent when fetching the image; for a value with a comma, use headers={"KEY":"a,b"}.
[examples: name=sandbox,image=plugins/sandbox:latest, name=sandbox,image=plugins/sandbox:latest,config={"persist_path":"/data"}]
--scale-to-zero==
Scale-to-zero options. Traffic through a service or to the private IP wakes the instance.
@@ -1376,6 +1427,7 @@ Fields:
state
image
pull-policy
+ image-headers
type
runtime, runtime.args, runtime.env
resources, resources.memory, resources.vcpus, resources.gpus
@@ -1385,8 +1437,10 @@ Fields:
service.soft-limit, service.hard-limit
volumes, volumes.*, volumes.*.name, volumes.*.uuid, volumes.*.at,
volumes.*.readonly, volumes.*.size
- roms, roms.*, roms.*.name, roms.*.image, roms.*.dir, roms.*.at
- plugins, plugins.*, plugins.*.name, plugins.*.image, plugins.*.config
+ roms, roms.*, roms.*.name, roms.*.image, roms.*.pull-policy, roms.*.headers,
+ roms.*.dir, roms.*.at
+ plugins, plugins.*, plugins.*.name, plugins.*.image, plugins.*.pull-policy,
+ plugins.*.headers, plugins.*.config
private-fqdn
networks, networks.*, networks.*.name, networks.*.uuid, networks.*.private-ip,
networks.*.mac, networks.*.tap-name, networks.*.relay, networks.*.relay.name,
@@ -1463,6 +1517,8 @@ Templates:
Create an instance template.
edit
Edit an instance template.
+ history
+ Show the lineage of an instance template.
Fields:
metro
@@ -1475,6 +1531,8 @@ Fields:
autokill, autokill.time
state
image
+ pull-policy
+ image-headers
type
runtime, runtime.args, runtime.env
resources, resources.memory, resources.vcpus
@@ -1533,6 +1591,8 @@ Fields:
autokill, autokill.time
state
image
+ pull-policy
+ image-headers
type
runtime, runtime.args, runtime.env
resources, resources.memory, resources.vcpus
@@ -1599,6 +1659,8 @@ Fields:
autokill, autokill.time
state
image
+ pull-policy
+ image-headers
type
runtime, runtime.args, runtime.env
resources, resources.memory, resources.vcpus
@@ -1673,6 +1735,8 @@ Fields:
autokill, autokill.time
state
image
+ pull-policy
+ image-headers
type
runtime, runtime.args, runtime.env
resources, resources.memory, resources.vcpus
@@ -1742,6 +1806,10 @@ Examples:
# Update template tags
unikraft instance template edit demo-template --set tags=env-dev
+ # Change the template image and always pull it
+ unikraft instance template edit demo-template --image my-app:v2 --pull-policy
+ always
+
Fields:
metro
name
@@ -1753,6 +1821,8 @@ Fields:
autokill, autokill.time
state
image
+ pull-policy
+ image-headers
type
runtime, runtime.args, runtime.env
resources, resources.memory, resources.vcpus
@@ -1815,6 +1885,15 @@ Edit flags:
Autokill options.
time: time since the template was last cloned before it is deleted, such as 24h, 0 disables.
[example: time=24h]
+ --image=:
+ Image of the template, as an OCI reference or a full registry URL.
+ [examples: nginx:latest, my-app:v1.2.3]
+ --pull-policy=
+ When to pull the image relative to the node's cache: always, if_not_present or never. Needs image in the same edit. Each image edit replaces the pull policy and headers, so set both again.
+ [examples: always, if_not_present, never]
+ --image-header== ...
+ HTTP header sent when fetching the image, as KEY=value, up to 16. Needs image in the same edit. Each image edit replaces the pull policy and headers, so set both again.
+ [example: Authorization=Bearer ]
$ unikraft instance template delete --help
@@ -1842,6 +1921,8 @@ Fields:
autokill, autokill.time
state
image
+ pull-policy
+ image-headers
type
runtime, runtime.args, runtime.env
resources, resources.memory, resources.vcpus
@@ -1887,6 +1968,65 @@ Global flags:
--timeout= ($UNIKRAFT_TIMEOUT)
Set a deadline for the command (e.g. 30s, 5m, 1h).
+$ unikraft instance template history --help
+
+Show the whole lineage tree of an instance template: every instance, template
+and checkpoint in it. A table draws the tree in its graph column: ◉ is the
+target, ● an instance, ○ a checkpoint, ◎ a template and ◌ a deleted instance.
+
+Usage:
+ unikraft instances template history ... [flags]
+
+Arguments:
+ ...
+ Target templates to show the lineage of.
+
+Examples:
+ # Show the lineage of a template
+ unikraft instance template history my-template
+
+ # Show the lineage with the UUID of each node
+ unikraft instance template history my-template -f +uuid
+
+Fields:
+ graph
+ metro
+ name
+ kind
+ state
+ created
+ uuid
+ parent
+ relation
+ target
+
+Flags:
+ --limit
+ Show at most this many nodes of each lineage: the newest ones and the target. 0 shows all.
+ -f, --field
+ Specify which fields to include in the output.
+ -o, --output
+ Output format. One of: kv, table, json, yaml, raw, quiet, template.
+
+Global flags:
+ -h, --help
+ Show context-sensitive help.
+ --config= ($UNIKRAFT_CONFIG)
+ Path to the configuration file.
+ --log-level= ($UNIKRAFT_LOG_LEVEL)
+ Set the logging level.
+ [default: info, choices: trace, debug, info, warn, error, fatal]
+ --log-type= ($UNIKRAFT_LOG_TYPE)
+ Set the log type.
+ [default: text, choices: text, json]
+ --profile= ($UNIKRAFT_PROFILE)
+ Set the current profile.
+ --[no-]telemetry ($UNIKRAFT_TELEMETRY)
+ Toggle usage analytics.
+ [default: true]
+ --timeout= ($UNIKRAFT_TIMEOUT)
+ Set a deadline for the command (e.g. 30s, 5m, 1h).
+
$ unikraft instance checkpoint --help
Manage instance checkpoints.
@@ -1908,7 +2048,7 @@ Checkpoints:
edit
Edit an instance checkpoint.
history
- Show the history of a checkpoint.
+ Show the lineage of a checkpoint.
Fields:
metro
@@ -2401,20 +2541,39 @@ Global flags:
$ unikraft instance checkpoint history --help
-Show the history of a checkpoint.
+Show the whole lineage tree of a checkpoint: every instance, template and
+checkpoint in it. A table draws the tree in its graph column: ◉ is the target, ●
+an instance, ○ a checkpoint, ◎ a template and ◌ a deleted instance.
Usage:
unikraft instances checkpoint history ... [flags]
Arguments:
...
- Target checkpoints to show history for.
+ Target checkpoints to show the lineage of.
Examples:
- # Show the history of a checkpoint
+ # Show the lineage of a checkpoint
unikraft instance checkpoint history my-checkpoint
+ # Show the lineage with the UUID of each node
+ unikraft instance checkpoint history my-checkpoint -f +uuid
+
+Fields:
+ graph
+ metro
+ name
+ kind
+ state
+ created
+ uuid
+ parent
+ relation
+ target
+
Flags:
+ --limit
+ Show at most this many nodes of each lineage: the newest ones and the target. 0 shows all.
-f, --field
Specify which fields to include in the output.
-o, --output
@@ -2738,20 +2897,42 @@ Global flags:
$ unikraft instance history --help
-Show checkpoint history for an instance.
+Show the whole lineage tree of an instance: every instance, template and
+checkpoint in it. A table draws the tree in its graph column: ◉ is the target, ●
+an instance, ○ a checkpoint, ◎ a template and ◌ a deleted instance.
Usage:
unikraft instances history ... [flags]
Arguments:
...
- Target instances to show history for.
+ Target instances to show the lineage of.
Examples:
- # Show the checkpoint history of an instance
+ # Show the lineage of an instance
unikraft instance history my-instance
+ # Show the lineage with the UUID of each node
+ unikraft instance history my-instance -f +uuid
+
+ # Show the lineage as JSON
+ unikraft instance history my-instance -o json
+
+Fields:
+ graph
+ metro
+ name
+ kind
+ state
+ created
+ uuid
+ parent
+ relation
+ target
+
Flags:
+ --limit
+ Show at most this many nodes of each lineage: the newest ones and the target. 0 shows all.
-f, --field
Specify which fields to include in the output.
-o, --output
@@ -2811,7 +2992,7 @@ Flags:
Name of the sandbox plugin to use.
[default: sandbox]
--plugin-image=][
- Image of the sandbox plugin to attach when the instance has none.
+ Image of the sandbox plugin to attach when the instance has none. It asks first, so it only attaches from a terminal.
[default: plugins/sandbox:latest]
-w, --dir=
Directory to start the shell in.
@@ -2881,7 +3062,7 @@ Flags:
Name of the sandbox plugin to use.
[default: sandbox]
--plugin-image=][
- Image of the sandbox plugin to attach when the instance has none.
+ Image of the sandbox plugin to attach when the instance has none. It asks first, so it only attaches from a terminal.
[default: plugins/sandbox:latest]
-w, --dir=
Directory to execute the command from.
@@ -2952,7 +3133,7 @@ Flags:
Name of the sandbox plugin to use.
[default: sandbox]
--plugin-image=][
- Image of the sandbox plugin to attach when the instance has none.
+ Image of the sandbox plugin to attach when the instance has none. It asks first, so it only attaches from a terminal.
[default: plugins/sandbox:latest]
--force
Overwrite the local file if it already exists.
@@ -3009,7 +3190,7 @@ Flags:
Name of the sandbox plugin to use.
[default: sandbox]
--plugin-image=][
- Image of the sandbox plugin to attach when the instance has none.
+ Image of the sandbox plugin to attach when the instance has none. It asks first, so it only attaches from a terminal.
[default: plugins/sandbox:latest]
--append
Append to the remote file instead of overwriting it.
@@ -3069,7 +3250,7 @@ Flags:
Name of the sandbox plugin to use.
[default: sandbox]
--plugin-image=][
- Image of the sandbox plugin to attach when the instance has none.
+ Image of the sandbox plugin to attach when the instance has none. It asks first, so it only attaches from a terminal.
[default: plugins/sandbox:latest]
--force
Overwrite the local file if it already exists.
diff --git a/cmd/unikraft/testdata/TestHelp/run b/cmd/unikraft/testdata/TestHelp/run
index 14ae617ab..4c0a03b0b 100644
--- a/cmd/unikraft/testdata/TestHelp/run
+++ b/cmd/unikraft/testdata/TestHelp/run
@@ -56,6 +56,7 @@ Fields:
state
image
pull-policy
+ image-headers
type
runtime, runtime.args, runtime.env
resources, resources.memory, resources.vcpus, resources.gpus
@@ -65,8 +66,10 @@ Fields:
service.soft-limit, service.hard-limit
volumes, volumes.*, volumes.*.name, volumes.*.uuid, volumes.*.at,
volumes.*.readonly, volumes.*.size
- roms, roms.*, roms.*.name, roms.*.image, roms.*.dir, roms.*.at
- plugins, plugins.*, plugins.*.name, plugins.*.image, plugins.*.config
+ roms, roms.*, roms.*.name, roms.*.image, roms.*.pull-policy, roms.*.headers,
+ roms.*.dir, roms.*.at
+ plugins, plugins.*, plugins.*.name, plugins.*.image, plugins.*.pull-policy,
+ plugins.*.headers, plugins.*.config
private-fqdn
networks, networks.*, networks.*.name, networks.*.uuid, networks.*.private-ip,
networks.*.mac, networks.*.tap-name, networks.*.relay, networks.*.relay.name,
@@ -148,8 +151,11 @@ Create flags:
Image to deploy, as an OCI reference or a full registry URL. On create, required unless template, branch or checkpoint is given, and cannot be combined with them.
[examples: nginx:latest, my-app:v1.2.3]
--pull-policy=
- When to pull the image relative to the node's cache: always, if_not_present or never.
+ When to pull the image relative to the node's cache: always, if_not_present or never. Needs image in the same create or edit. Each image edit replaces the pull policy and headers, so set both again.
[examples: always, if_not_present, never]
+ --image-header== ...
+ HTTP header sent when fetching the image, as KEY=value, up to 16. Needs image in the same create or edit. Each image edit replaces the pull policy and headers, so set both again.
+ [example: Authorization=Bearer ]
--type=
Virtual machine type.
micro: Firecracker microVM (default)
@@ -172,12 +178,15 @@ Create flags:
[examples: 0, 1]
--service=
Service group to join, by name or UUID. Leave unset and give service.services or service.domains to create a group owned by the instance. Without any service the instance is reachable only privately.
- -p, --publish=:[/] ...
- Published port as SOURCE:DESTINATION[/HANDLERS], with handlers joined by +. Port 80 must use http, port 443 http+tls, and any other port tls only.
+ -p, --publish=:[/][@] ...
+ Published port as SOURCE:DESTINATION[/OPTIONS][@IP], with options joined by +. TCP port 80 must use http, port 443 http+tls, and any other port tls only. UDP ports take no handlers and need an IP.
http: load balance per HTTP request instead of per TCP connection
tls: terminate TLS at the platform
- redirect: redirect HTTP on port 80 to HTTPS, as in 80:443/http+redirect.
- [examples: 443:8080/http+tls, 80:443/http+redirect]
+ redirect: redirect HTTP on port 80 to HTTPS, as in 80:443/http+redirect
+ tcp: publish a TCP port, the default
+ udp: publish a UDP port instead of TCP, as in 53:53/udp@203.0.113.10
+ @IP: public IP assigned to you on the group's node.
+ [examples: 443:8080/http+tls, 80:443/http+redirect, 53:53/udp@203.0.113.10]
--domain= ...
Domain for the group.
myapp: a bare label becomes a subdomain of the metro
@@ -186,11 +195,11 @@ Create flags:
-v, --volume=[]:[:] ...
Volume to attach as NAME:/MOUNT[:ro], where the mount path is absolute and outside /uk. On create, leave NAME empty and add :size=SIZE, as in :/data:size=1GiB, to make a new volume with a generated name.
[examples: my-vol:/data, cache:/tmp:ro, :/data:size=1GiB]
- --rom=name=,image=][,at= ...
- Read-only ROM device from an image or a local directory. The name uses letters, digits, - and _, and appears as /dev/ukp_rom_NAME in the guest.
+ --rom=name=,image=][[,pull-policy=][,headers.=],at= ...
+ Read-only ROM device from an image or a local directory. The name uses letters, digits, - and _, and appears as /dev/ukp_rom_NAME in the guest. Add pull-policy=always|if_not_present|never to control when the image is pulled. Add headers.KEY=value for each HTTP header sent when fetching the image; for a value with a comma, use headers={"KEY":"a,b"}.
[examples: name=my-rom,image=myuser/my-rom:latest,at=/rom0, name=mydata,dir=./mydata,at=/rom]
- --plugin=name=,image=][[,config=] ...
- Plugin loaded from an image, with an optional JSON config passed to it on start. Up to 8 per instance.
+ --plugin=name=,image=][[,pull-policy=][,headers.=][,config=] ...
+ Plugin loaded from an image, with an optional JSON config passed to it on start. Up to 8 per instance. Add pull-policy=always|if_not_present|never to control when the image is pulled. Add headers.KEY=value for each HTTP header sent when fetching the image; for a value with a comma, use headers={"KEY":"a,b"}.
[examples: name=sandbox,image=plugins/sandbox:latest, name=sandbox,image=plugins/sandbox:latest,config={"persist_path":"/data"}]
--network== ...
Network interface to attach, one per flag and up to 4. The first one is the primary interface. Needs the net_manager permission.
diff --git a/cmd/unikraft/testdata/TestHelp/services b/cmd/unikraft/testdata/TestHelp/services
index 542cc4af0..5bbce7649 100644
--- a/cmd/unikraft/testdata/TestHelp/services
+++ b/cmd/unikraft/testdata/TestHelp/services
@@ -33,7 +33,7 @@ Fields:
domains.*.certificate.name, domains.*.certificate.uuid
instances, instances.*, instances.*.name, instances.*.uuid
services, services.*, services.*.source, services.*.destination,
- services.*.handlers
+ services.*.protocol, services.*.ip, services.*.handlers
Global flags:
-h, --help
@@ -83,7 +83,7 @@ Fields:
domains.*.certificate.name, domains.*.certificate.uuid
instances, instances.*, instances.*.name, instances.*.uuid
services, services.*, services.*.source, services.*.destination,
- services.*.handlers
+ services.*.protocol, services.*.ip, services.*.handlers
Flags:
-w, --watch=
@@ -141,7 +141,7 @@ Fields:
domains.*.certificate.name, domains.*.certificate.uuid
instances, instances.*, instances.*.name, instances.*.uuid
services, services.*, services.*.source, services.*.destination,
- services.*.handlers
+ services.*.protocol, services.*.ip, services.*.handlers
Flags:
--filter
@@ -203,7 +203,7 @@ Fields:
domains.*.certificate.name, domains.*.certificate.uuid
instances, instances.*, instances.*.name, instances.*.uuid
services, services.*, services.*.source, services.*.destination,
- services.*.handlers
+ services.*.protocol, services.*.ip, services.*.handlers
Flags:
--until, --filter
@@ -251,6 +251,12 @@ Examples:
--domain demo \
--service 443:8080/tls+http
+ # Create a service group with a UDP port on a dedicated IP
+ unikraft service create \
+ --name dns \
+ --metro fra \
+ --service 53:53/udp@203.0.113.10
+
Fields:
metro
name
@@ -265,7 +271,7 @@ Fields:
domains.*.certificate.name, domains.*.certificate.uuid
instances, instances.*, instances.*.name, instances.*.uuid
services, services.*, services.*.source, services.*.destination,
- services.*.handlers
+ services.*.protocol, services.*.ip, services.*.handlers
Flags:
--set== ..., --set-file== ...
@@ -325,12 +331,15 @@ Create flags:
myapp: a bare label becomes a subdomain of the metro
example.com: a dotted name is a custom domain, with a certificate issued automatically unless given as fqdn=example.com,certificate=my-cert.
[examples: example.com, myapp]
- --service=:[/] ...
- Published port as SOURCE:DESTINATION[/HANDLERS], with handlers joined by +. Port 80 must use http, port 443 http+tls, and any other port tls only.
+ --service=:[/][@] ...
+ Published port as SOURCE:DESTINATION[/OPTIONS][@IP], with options joined by +. TCP port 80 must use http, port 443 http+tls, and any other port tls only. UDP ports take no handlers and need an IP.
http: load balance per HTTP request instead of per TCP connection
tls: terminate TLS at the platform
- redirect: redirect HTTP on port 80 to HTTPS, as in 80:443/http+redirect.
- [examples: 443:8080/http+tls, 80:443/http+redirect]
+ redirect: redirect HTTP on port 80 to HTTPS, as in 80:443/http+redirect
+ tcp: publish a TCP port, the default
+ udp: publish a UDP port instead of TCP, as in 53:53/udp@203.0.113.10
+ @IP: public IP assigned to you on the group's node.
+ [examples: 443:8080/http+tls, 80:443/http+redirect, 53:53/udp@203.0.113.10]
$ unikraft service edit --help
@@ -361,7 +370,7 @@ Fields:
domains.*.certificate.name, domains.*.certificate.uuid
instances, instances.*, instances.*.name, instances.*.uuid
services, services.*, services.*.source, services.*.destination,
- services.*.handlers
+ services.*.protocol, services.*.ip, services.*.handlers
Flags:
--set== ..., --set-file== ...
@@ -418,12 +427,15 @@ Edit flags:
myapp: a bare label becomes a subdomain of the metro
example.com: a dotted name is a custom domain, with a certificate issued automatically unless given as fqdn=example.com,certificate=my-cert.
[examples: example.com, myapp]
- --service=:[/] ...
- Published port as SOURCE:DESTINATION[/HANDLERS], with handlers joined by +. Port 80 must use http, port 443 http+tls, and any other port tls only.
+ --service=:[/][@] ...
+ Published port as SOURCE:DESTINATION[/OPTIONS][@IP], with options joined by +. TCP port 80 must use http, port 443 http+tls, and any other port tls only. UDP ports take no handlers and need an IP.
http: load balance per HTTP request instead of per TCP connection
tls: terminate TLS at the platform
- redirect: redirect HTTP on port 80 to HTTPS, as in 80:443/http+redirect.
- [examples: 443:8080/http+tls, 80:443/http+redirect]
+ redirect: redirect HTTP on port 80 to HTTPS, as in 80:443/http+redirect
+ tcp: publish a TCP port, the default
+ udp: publish a UDP port instead of TCP, as in 53:53/udp@203.0.113.10
+ @IP: public IP assigned to you on the group's node.
+ [examples: 443:8080/http+tls, 80:443/http+redirect, 53:53/udp@203.0.113.10]
$ unikraft service delete --help
@@ -460,7 +472,7 @@ Fields:
domains.*.certificate.name, domains.*.certificate.uuid
instances, instances.*, instances.*.name, instances.*.uuid
services, services.*, services.*.source, services.*.destination,
- services.*.handlers
+ services.*.protocol, services.*.ip, services.*.handlers
Flags:
--all
diff --git a/go.mod b/go.mod
index 4f4e17a67..c62a55e02 100644
--- a/go.mod
+++ b/go.mod
@@ -6,14 +6,14 @@ tool github.com/caarlos0/svu/v3
require (
charm.land/bubbles/v2 v2.2.1
- charm.land/bubbletea/v2 v2.1.1
- charm.land/lipgloss/v2 v2.0.6
+ charm.land/bubbletea/v2 v2.1.2
+ charm.land/lipgloss/v2 v2.1.2-0.20261126165533-22b09d7f3566
github.com/MakeNowJust/heredoc v1.0.0
github.com/Masterminds/sprig/v3 v3.3.0
github.com/alecthomas/kong v1.17.0
github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de
github.com/charmbracelet/colorprofile v0.4.3
- github.com/charmbracelet/x/ansi v0.11.9
+ github.com/charmbracelet/x/ansi v0.11.10
github.com/charmbracelet/x/term v0.2.2
github.com/coder/websocket v1.8.15
github.com/containerd/containerd/v2 v2.4.2
@@ -23,7 +23,7 @@ require (
github.com/containerd/platforms v1.0.0-rc.5
github.com/cpuguy83/go-md2man/v2 v2.0.7
github.com/creack/pty v1.1.24
- github.com/docker/cli v29.9.3+incompatible
+ github.com/docker/cli v29.10.0+incompatible
github.com/docker/go-units v0.5.0
github.com/ettle/strcase v0.2.0
github.com/go-json-experiment/json v1.27.2
@@ -38,14 +38,14 @@ require (
github.com/opencontainers/image-spec v1.1.1
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c
github.com/posener/complete v1.2.3
- github.com/posthog/posthog-go v1.42.4
+ github.com/posthog/posthog-go v1.44.1
github.com/rs/zerolog v1.35.1
- github.com/sergi/go-diff v1.4.0
+ github.com/sergi/go-diff v1.4.5
github.com/sirupsen/logrus v1.10.2
github.com/stretchr/testify v1.12.1
- github.com/tidwall/gjson v1.20.2
+ github.com/tidwall/gjson v1.20.4
github.com/tonistiigi/fsutil v0.0.0-20261103125000-e075fd9305eb
- github.com/unikraft/go-archivefs v0.0.0-20261106133356-c81ad57e55c4
+ github.com/unikraft/go-archivefs v0.0.0-20261124155100-7c53c03d86ce
golang.org/x/mod v0.43.0
golang.org/x/sync v0.25.0
golang.org/x/sys v0.50.0
@@ -54,24 +54,24 @@ require (
gotest.tools/v3 v3.5.2
mvdan.cc/sh/v3 v3.14.1
sigs.k8s.io/yaml v1.6.0
- unikraft.com/cloud/plugins/sandbox v0.0.0-20261110115830-def4e9d2e457
- unikraft.com/cloud/sdk v0.4.1-staging.14
- unikraft.com/cloud/sdk/build v0.0.0-20261112083743-f904b5bfc966
- unikraft.com/cloud/sdk/plugins/sandbox v0.0.0-20261113085313-a2a9f94fc300
- unikraft.com/x/build v0.0.0-20261111120215-5177d0f4c7b6
+ unikraft.com/cloud/plugins/sandbox v0.0.0-20261125131623-d66f7dd900a2
+ unikraft.com/cloud/sdk v0.4.6-staging.9
+ unikraft.com/cloud/sdk/build v0.4.6-staging.6
+ unikraft.com/cloud/sdk/plugins/sandbox v0.4.6-staging.7
+ unikraft.com/x/build v0.0.0-20261126162113-a81b5204c19b
unikraft.com/x/buildkit v0.0.0-20261111120215-5177d0f4c7b6
unikraft.com/x/colors v0.0.0-20261111120215-5177d0f4c7b6
unikraft.com/x/filters v0.0.0-20261111120215-5177d0f4c7b6
unikraft.com/x/fingerprint v0.0.0-20261111120215-5177d0f4c7b6
unikraft.com/x/guesstermwidth v0.0.0-20261111120215-5177d0f4c7b6
- unikraft.com/x/image-spec v0.0.0-20261111120215-5177d0f4c7b6
+ unikraft.com/x/image-spec v0.0.0-20261126162113-a81b5204c19b
unikraft.com/x/io v0.0.0-20261111120215-5177d0f4c7b6
unikraft.com/x/joinerrgroup v0.0.0-20261111120215-5177d0f4c7b6
unikraft.com/x/kingkong v0.0.0-20261111120215-5177d0f4c7b6
- unikraft.com/x/kraftfile v0.0.0-20261111120215-5177d0f4c7b6
- unikraft.com/x/log v0.0.0-20261111120215-5177d0f4c7b6
+ unikraft.com/x/kraftfile v0.0.0-20261120151658-ea11ec33af9a
+ unikraft.com/x/log v0.0.0-20261116145447-f4dbf6ae0056
unikraft.com/x/ptr v0.0.0-20261111120215-5177d0f4c7b6
- unikraft.com/x/shell v0.0.0-20261113145058-65fc641f4af8
+ unikraft.com/x/shell v0.0.0-20261117090838-250b71577700
unikraft.com/x/signal v0.0.0-20261111120215-5177d0f4c7b6
unikraft.com/x/stdio v0.0.0-20261111120215-5177d0f4c7b6
unikraft.com/x/version v0.0.0-20261111120215-5177d0f4c7b6
@@ -83,7 +83,7 @@ require (
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.5.0 // indirect
github.com/Microsoft/go-winio v0.6.4 // indirect
- github.com/andybalholm/brotli v1.1.1 // indirect
+ github.com/andybalholm/brotli v1.3.0 // indirect
github.com/atotto/clipboard v0.1.4 // indirect
github.com/bahlo/generic-list-go v0.2.0 // indirect
github.com/buger/jsonparser v1.1.2 // indirect
@@ -131,10 +131,10 @@ require (
github.com/in-toto/in-toto-golang v0.11.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/invopop/jsonschema v0.14.0 // indirect
- github.com/klauspost/compress v1.20.3 // indirect
+ github.com/klauspost/compress v1.20.4 // indirect
github.com/lucasb-eyer/go-colorful v1.4.1 // indirect
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
- github.com/mattn/go-colorable v0.1.15 // indirect
+ github.com/mattn/go-colorable v0.1.16 // indirect
github.com/mattn/go-isatty v0.0.24 // indirect
github.com/mattn/go-runewidth v0.0.31 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
@@ -199,23 +199,20 @@ require (
go.yaml.in/yaml/v3 v3.0.6 // indirect
go.yaml.in/yaml/v4 v4.0.0 // indirect
go4.org/mem v0.0.0-20240501181205-ae6ca9944745 // indirect
- golang.org/x/crypto v0.58.0 // indirect
+ golang.org/x/crypto v0.59.0 // indirect
golang.org/x/exp v0.0.0-20260908205506-85c1c2202aba // indirect
golang.org/x/net v0.62.0 // indirect
golang.org/x/oauth2 v0.37.0 // indirect
- golang.org/x/term v0.47.0 // indirect
+ golang.org/x/term v0.48.0 // indirect
golang.org/x/time v0.16.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20261012220534-4341edf3f941 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20261012220534-4341edf3f941 // indirect
google.golang.org/grpc v1.85.0 // indirect
google.golang.org/protobuf v1.36.12 // indirect
tailscale.com v1.104.5 // indirect
+ unikraft.com/x/dockerfile v0.0.0-20261118100745-28172ae5f28c // indirect
)
-// Use the fork with charmbracelet/lipgloss#746 until a release has it.
-// It stops the Windows hang at startup when stdin is redirected.
-replace charm.land/lipgloss/v2 => github.com/unikraft-cloud/lipgloss/v2 v2.0.0-20260921145830-9a285e5dd507
-
// Use master with mvdan/sh#1433 until a release has it.
// It resolves the instance's Unix paths as such on Windows.
replace mvdan.cc/sh/v3 => mvdan.cc/sh/v3 v3.14.1-0.20261019164542-27edea01b10f
diff --git a/go.sum b/go.sum
index 7d8e74949..3a4075677 100644
--- a/go.sum
+++ b/go.sum
@@ -1,9 +1,11 @@
charm.land/bubbles/v2 v2.2.1 h1:Fq1+qm5hV6GkvzLQDhCBpXXE5tLgvh1PRriCLwSvIQU=
charm.land/bubbles/v2 v2.2.1/go.mod h1:wdMgn+sje1KNXdwFizIWjbf328fIUBxqEmJ/vYPo8yc=
-charm.land/bubbletea/v2 v2.1.1 h1:S1S9l37pCZGrj1JexBcr9x4Nr3MVeM42InqCYM/tDpU=
-charm.land/bubbletea/v2 v2.1.1/go.mod h1:xWHeyxIX9/wiFU2kgPW04ojOZyTzrWf+8lGjUCaftiU=
+charm.land/bubbletea/v2 v2.1.2 h1:vB3XAcHhLB2gR3HOHpwO3lHB3nbvaowIgL3e5x/DUZo=
+charm.land/bubbletea/v2 v2.1.2/go.mod h1:xWHeyxIX9/wiFU2kgPW04ojOZyTzrWf+8lGjUCaftiU=
charm.land/fang/v2 v2.0.1 h1:zQCM8JQJ1JnQX/66B5jlCYBUxL2as5JXQZ2KJ6EL0mY=
charm.land/fang/v2 v2.0.1/go.mod h1:S1GmkpcvK+OB5w9caywUnJcsMew45Ot8FXqoz8ALrII=
+charm.land/lipgloss/v2 v2.1.2-0.20261126165533-22b09d7f3566 h1:JjEXjT4hwlmmlQW4JjKa0C4EpgBw9uDPVM8y1SodE/s=
+charm.land/lipgloss/v2 v2.1.2-0.20261126165533-22b09d7f3566/go.mod h1:k79y/56yThpkJvbwyrcHr8MyZF42e84Q5fW9Ibu6LFc=
dario.cat/mergo v1.0.2 h1:85+piFYR1tMbRrLcDwR18y4UKJ3aH1Tbzi24VRW1TK8=
dario.cat/mergo v1.0.2/go.mod h1:E/hbnu0NxMFBjpMIE34DRGLWqDy0g5FuKDhCb31ngxA=
filippo.io/edwards25519 v1.2.0 h1:crnVqOiS4jqYleHd9vaKZ+HKtHfllngJIiOpNpoJsjo=
@@ -24,6 +26,8 @@ github.com/Microsoft/hcsshim v0.15.0 h1:AWiHGf0+9f7cDcfhuU3zXORCAPmIOWzTYfHhcrMc
github.com/Microsoft/hcsshim v0.15.0/go.mod h1:eStXUkML1Fmkgmwr6XHbYkBC1j7p2FA8ZtA9dyRMbts=
github.com/ProtonMail/go-crypto v1.4.1 h1:9RfcZHqEQUvP8RzecWEUafnZVtEvrBVL9BiF67IQOfM=
github.com/ProtonMail/go-crypto v1.4.1/go.mod h1:e1OaTyu5SYVrO9gKOEhTc+5UcXtTUa+P3uLudwcgPqo=
+github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo=
+github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
github.com/alecthomas/assert/v2 v2.11.0 h1:2Q9r3ki8+JYXvGsDyBXwH3LcJ+WK5D0gc5E8vS6K3D0=
github.com/alecthomas/assert/v2 v2.11.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k=
github.com/alecthomas/kong v1.17.0 h1:f52BVWChYMDkMkCoqkEWRuFOk/K4B5LO7xIijeLJRdk=
@@ -32,8 +36,8 @@ github.com/alecthomas/repr v0.5.2 h1:SU73FTI9D1P5UNtvseffFSGmdNci/O6RsqzeXJtP0Qs
github.com/alecthomas/repr v0.5.2/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4=
github.com/anchore/go-struct-converter v0.1.0 h1:2rDRssAl6mgKBSLNiVCMADgZRhoqtw9dedlWa0OhD30=
github.com/anchore/go-struct-converter v0.1.0/go.mod h1:rYqSE9HbjzpHTI74vwPvae4ZVYZd1lue2ta6xHPdblA=
-github.com/andybalholm/brotli v1.1.1 h1:PR2pgnyFznKEugtsUo0xLdDop5SKXd5Qf5ysW+7XdTA=
-github.com/andybalholm/brotli v1.1.1/go.mod h1:05ib4cKhjx3OQYUY22hTVd34Bc8upXjOLL2rKwwZBoA=
+github.com/andybalholm/brotli v1.3.0 h1:IdkhjSe/+34U+fP7FSR2Q6Poj1hnHUa2GoWmzXJd6qY=
+github.com/andybalholm/brotli v1.3.0/go.mod h1:rzTDkvFWvIrjDXZHkuS16NPggd91W3kUSvPlQ1pLaKY=
github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de h1:FxWPpzIjnTlhPwqqXc4/vE0f7GvRjuAsbW+HOIe8KnA=
github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de/go.mod h1:DCaWoUhZrYW9p1lxo/cm8EmUOOzAPSEZNGF2DK1dJgw=
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so=
@@ -86,8 +90,8 @@ github.com/charmbracelet/harmonica v0.2.0 h1:8NxJWRWg/bzKqqEaaeFNipOu77YR5t8aSwG
github.com/charmbracelet/harmonica v0.2.0/go.mod h1:KSri/1RMQOZLbw7AHqgcBycp8pgJnQMYYT8QZRqZ1Ao=
github.com/charmbracelet/ultraviolet v0.0.0-20261008173134-6b8d4baf91b4 h1:hISLzUbwcvJbGoNR6A3L/TpguRRnACBmZOee8LcHLJw=
github.com/charmbracelet/ultraviolet v0.0.0-20261008173134-6b8d4baf91b4/go.mod h1:aJDVk+WOVM1K04rdc/71PMPoUGfjxjhvXfP3Pjz1Zio=
-github.com/charmbracelet/x/ansi v0.11.9 h1:kIrqLBxtTVbLyyHO2Evoi93EjQo1mylWmpNEsfPxXAM=
-github.com/charmbracelet/x/ansi v0.11.9/go.mod h1:DG/hpOnaI2QJ/KMMqLL2h0KVhluuJLazf8973P+Vy5w=
+github.com/charmbracelet/x/ansi v0.11.10 h1:GjcX3+rAk+8wDX/jY0XwrZstxkjRcLkYU3TvwzZWiRA=
+github.com/charmbracelet/x/ansi v0.11.10/go.mod h1:DG/hpOnaI2QJ/KMMqLL2h0KVhluuJLazf8973P+Vy5w=
github.com/charmbracelet/x/exp/charmtone v0.0.0-20250603201427-c31516f43444 h1:IJDiTgVE56gkAGfq0lBEloWgkXMk4hl/bmuPoicI4R0=
github.com/charmbracelet/x/exp/charmtone v0.0.0-20250603201427-c31516f43444/go.mod h1:T9jr8CzFpjhFVHjNjKwbAD7KwBNyFnj2pntAO7F2zw0=
github.com/charmbracelet/x/exp/golden v0.0.0-20250806222409-83e3a29d542f h1:pk6gmGpCE7F3FcjaOEKYriCvpmIN4+6OS/RD0vm4uIA=
@@ -160,8 +164,8 @@ github.com/digitorus/timestamp v0.0.0-20231217203849-220c5c2851b7 h1:lxmTCgmHE1G
github.com/digitorus/timestamp v0.0.0-20231217203849-220c5c2851b7/go.mod h1:GvWntX9qiTlOud0WkQ6ewFm0LPy5JUR1Xo0Ngbd1w6Y=
github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk=
github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E=
-github.com/docker/cli v29.9.3+incompatible h1:SBaMp7ecohadEHMDrUJg22t9I3awqsAVhnJ7GOcWpfE=
-github.com/docker/cli v29.9.3+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=
+github.com/docker/cli v29.10.0+incompatible h1:lCL+clBUJnHsmjBCr6TwvfQFkmBidPxi5SkuXCoYxc0=
+github.com/docker/cli v29.10.0+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=
github.com/docker/docker-credential-helpers v0.9.9 h1:BkydjIgZ46JnDbqyM2p2fc63KMw6y+KHL3Em/2AGJ7w=
github.com/docker/docker-credential-helpers v0.9.9/go.mod h1:v1S+hepowrQXITkEfw6o4+BMbGot02wiKpzWhGUZK6c=
github.com/docker/go-connections v0.8.2 h1:9d9DEokx5W7qlr0shkFXIxEA7+TTD+llwzcykSlxMNc=
@@ -295,8 +299,8 @@ github.com/jotaen/kong-completion v0.0.15 h1:ygxUE1S2Ec4OOnJxQEXDf8UdSQryrQzYksg
github.com/jotaen/kong-completion v0.0.15/go.mod h1:dyIG20e3qq128SUBtF8jzI7YtkfzjWMlgbqkAJd6xHQ=
github.com/juju/errors v1.0.0 h1:yiq7kjCLll1BiaRuNY53MGI0+EQ3rF6GB+wvboZDefM=
github.com/juju/errors v1.0.0/go.mod h1:B5x9thDqx0wIMH3+aLIMP9HjItInYWObRovoCFM5Qe8=
-github.com/klauspost/compress v1.20.3 h1:zWNoFqq/lSuYQRim3dUXlXeA0IqwuZGicdG5ZTfY5j4=
-github.com/klauspost/compress v1.20.3/go.mod h1:LUdAzn7YLVvxLpc7y3V1m40wESHTgc1422pwwBSKYuI=
+github.com/klauspost/compress v1.20.4 h1:dD0v/bvxtjCBqQu6sx1TNWkalEY5lNTIe+HY9w8TeNI=
+github.com/klauspost/compress v1.20.4/go.mod h1:LUdAzn7YLVvxLpc7y3V1m40wESHTgc1422pwwBSKYuI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
@@ -308,8 +312,8 @@ github.com/lucasb-eyer/go-colorful v1.4.1 h1:1EO+WB73+EH8EVbzlrG3KLAfEypQWVHIBql
github.com/lucasb-eyer/go-colorful v1.4.1/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4=
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I=
-github.com/mattn/go-colorable v0.1.15 h1:+u9SLTRGnXv73cEsnsmoZBom+dMU88B2M0aDcWy0/jY=
-github.com/mattn/go-colorable v0.1.15/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
+github.com/mattn/go-colorable v0.1.16 h1:+2YjeAe7xP1OQbZW1jERPWWCDLlNqFNCvjiqGiAt84A=
+github.com/mattn/go-colorable v0.1.16/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
github.com/mattn/go-isatty v0.0.24 h1:tGZZoVgT/KiqK1c8ocVLeDS8BSWMRd47J3Lbz7vsReI=
github.com/mattn/go-isatty v0.0.24/go.mod h1:nMCL3Zebbrt45jsMDgnfIwz6ydEQApk5oEI3HqDio6A=
github.com/mattn/go-runewidth v0.0.10/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk=
@@ -378,8 +382,8 @@ github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/posener/complete v1.2.3 h1:NP0eAhjcjImqslEwo/1hq7gpajME0fTLTezBKDqfXqo=
github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s=
-github.com/posthog/posthog-go v1.42.4 h1:uPmI3fqx7pSZuPofvf30KbKOtJPKjlMTEbwWd9pn3UY=
-github.com/posthog/posthog-go v1.42.4/go.mod h1:rN0C9Urenhytgo3KQ/QVorGkyGfpouquDTSs2Ujzr+g=
+github.com/posthog/posthog-go v1.44.1 h1:0EWi9vEXwW0u6NGtCYArOsPGPLiFuMFLyvTs+7a9X9o=
+github.com/posthog/posthog-go v1.44.1/go.mod h1:rN0C9Urenhytgo3KQ/QVorGkyGfpouquDTSs2Ujzr+g=
github.com/power-devops/perfstat v0.0.0-20260805114148-88456608a4f6 h1:jL3a8soXdzuTCcRnKhOmtcsVOObdDTFf4O2B403HPRU=
github.com/power-devops/perfstat v0.0.0-20260805114148-88456608a4f6/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE=
github.com/reeflective/readline v1.3.0 h1:uh9c2SEmyoy7A/auequfXZjvK0NP5HVEAJFcL9Uf7qE=
@@ -406,8 +410,8 @@ github.com/segmentio/asm v1.1.3 h1:WM03sfUOENvvKexOLp+pCqgb/WDjsi7EK8gIsICtzhc=
github.com/segmentio/asm v1.1.3/go.mod h1:Ld3L4ZXGNcSLRg4JBsZ3//1+f/TjYl0Mzen/DQy1EJg=
github.com/segmentio/encoding v0.5.4 h1:OW1VRern8Nw6ITAtwSZ7Idrl3MXCFwXHPgqESYfvNt0=
github.com/segmentio/encoding v0.5.4/go.mod h1:HS1ZKa3kSN32ZHVZ7ZLPLXWvOVIiZtyJnO1gPH1sKt0=
-github.com/sergi/go-diff v1.4.0 h1:n/SP9D5ad1fORl+llWyN+D6qoUETXNZARKjyY2/KVCw=
-github.com/sergi/go-diff v1.4.0/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4=
+github.com/sergi/go-diff v1.4.5 h1:3LvhZn2aCAWagLwIhga3BZiEZ82j5+oQ0vKDwkhjHCI=
+github.com/sergi/go-diff v1.4.5/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4=
github.com/shibumi/go-pathspec v1.3.0 h1:QUyMZhFo0Md5B8zV8x2tesohbb5kfbpTi9rBnKh5dkI=
github.com/shibumi/go-pathspec v1.3.0/go.mod h1:Xutfslp817l2I1cZvgcfeMQJG5QnU2lh5tVaaMCl3jE=
github.com/shirou/gopsutil/v4 v4.26.10 h1:MJN6euesJx53MVEjscYeyRSRcrdIcy3sz5k9nosjldg=
@@ -453,8 +457,8 @@ github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
github.com/theupdateframework/go-tuf/v2 v2.4.2 h1:w7976/W8uTwlsegP5nRymlpjPgrwSh+AXUf85is6nJk=
github.com/theupdateframework/go-tuf/v2 v2.4.2/go.mod h1:JqBrIUnNLAaNq/8GmBcEMFWfAFBbqp/MkJEJseXKbks=
-github.com/tidwall/gjson v1.20.2 h1:Ag48cSOUCOq/sheSLXV3M4ZS0FOd4YMnY1N7FRoxGQY=
-github.com/tidwall/gjson v1.20.2/go.mod h1:jV1Xkr7LRLVFhesDFU/nInoQ+MjVlnuqkUreTWMveUo=
+github.com/tidwall/gjson v1.20.4 h1:3A/Gmx6kyM902v2nepualaq7aYIGhF0eykJBTiIxryw=
+github.com/tidwall/gjson v1.20.4/go.mod h1:jV1Xkr7LRLVFhesDFU/nInoQ+MjVlnuqkUreTWMveUo=
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
github.com/tidwall/pretty v1.3.0 h1:DZmEzADnMIbThFXXslDgq9C0LCC/xzMrONm7iM77RM0=
@@ -475,10 +479,8 @@ github.com/transparency-dev/formats v0.1.1 h1:4bVHJc+KdBgpA1OJD1yjI+g0i5Z1graCpp
github.com/transparency-dev/formats v0.1.1/go.mod h1:qtZ8goRuJ8FTBG9c9+Bj0rn2rUG7eG/AUTkr+Aw3jFw=
github.com/transparency-dev/merkle v0.0.2 h1:Q9nBoQcZcgPamMkGn7ghV8XiTZ/kRxn1yCG81+twTK4=
github.com/transparency-dev/merkle v0.0.2/go.mod h1:pqSy+OXefQ1EDUVmAJ8MUhHB9TXGuzVAT58PqBoHz1A=
-github.com/unikraft-cloud/lipgloss/v2 v2.0.0-20260921145830-9a285e5dd507 h1:Pshbef+pR9j+qiRihFkbpBZK5ptj6ikk70uO0MJj1D8=
-github.com/unikraft-cloud/lipgloss/v2 v2.0.0-20260921145830-9a285e5dd507/go.mod h1:wwfOgrNqUA9yjL8nmG6BIO0qQnmkEgJ8ISptbme83gI=
-github.com/unikraft/go-archivefs v0.0.0-20261106133356-c81ad57e55c4 h1:Do8BfD6VM6bYg44KYvaB+xd9Q+BQs10QDziwMkMqdQk=
-github.com/unikraft/go-archivefs v0.0.0-20261106133356-c81ad57e55c4/go.mod h1:NLWtSTdsTRLGQN87zqm9+vN01Ei9JX+FWwuOme2wJXw=
+github.com/unikraft/go-archivefs v0.0.0-20261124155100-7c53c03d86ce h1:iDLanVjLs39hVbWid8dkIWCmcCihhfq0M0OOUY6EQao=
+github.com/unikraft/go-archivefs v0.0.0-20261124155100-7c53c03d86ce/go.mod h1:NLWtSTdsTRLGQN87zqm9+vN01Ei9JX+FWwuOme2wJXw=
github.com/vbatts/tar-split v0.12.3 h1:Cd46rkGXI3Td4yrVNwU8ripbxFaQbmesqhjBUUYAJSw=
github.com/vbatts/tar-split v0.12.3/go.mod h1:sQOc6OlqGCr7HkGx/IDBeKiTIvqhmj8KffNhEXG4Nq0=
github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
@@ -530,8 +532,8 @@ go.yaml.in/yaml/v4 v4.0.0 h1:/LG1pNO84Z4l603j/xMn69CcS5OYhMQ/f7l2LoQUGuw=
go.yaml.in/yaml/v4 v4.0.0/go.mod h1:aZqd9kCMsGL7AuUv/m/PvWLdg5sjJsZ4oHDEnfPPfY0=
go4.org/mem v0.0.0-20240501181205-ae6ca9944745 h1:Tl++JLUCe4sxGu8cTpDzRLd3tN7US4hOxG5YpKCzkek=
go4.org/mem v0.0.0-20240501181205-ae6ca9944745/go.mod h1:reUoABIJ9ikfM5sgtSF3Wushcza7+WeD01VB9Lirh3g=
-golang.org/x/crypto v0.58.0 h1:COkYLr4k7nDI4r6QtMML2AfzeIswWHAJthLS6K/M/54=
-golang.org/x/crypto v0.58.0/go.mod h1:Xh+kl5A+M0gMiWDytH2Hhr5Z7WbNCpv/eB/EFgfSk+w=
+golang.org/x/crypto v0.59.0 h1:xS2jhqYbzNrpvkWP2YTDf4TJwBy3ykR03i8vFDxEc7c=
+golang.org/x/crypto v0.59.0/go.mod h1:veDyUwATGs3c+vN3VfTbzViMGXeTBk3WyhBOkn+F/4U=
golang.org/x/exp v0.0.0-20260908205506-85c1c2202aba h1:Ck8QetSgk912qxWLMCKxd0in+aiyBQyDSMae6e/xmpU=
golang.org/x/exp v0.0.0-20260908205506-85c1c2202aba/go.mod h1:50RgIsmK7OwqzTTeqcSXQW8SswW0o8fRcDxmqGluJ8E=
golang.org/x/mod v0.43.0 h1:MFuq5J6s35W9D3IjkwyWc9vHh0nENOrt5K8Iof4ofmg=
@@ -547,8 +549,8 @@ golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.50.0 h1:dkKZEFTEKaLr1sjhs0WiKqoi8Jj5nHbS3Njmx1UoMJs=
golang.org/x/sys v0.50.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og=
-golang.org/x/term v0.47.0 h1:cpyOwQkr2Nzxe2p6KnrTG7Ei2wtzjsuSjhpXXepZ/BM=
-golang.org/x/term v0.47.0/go.mod h1:efAfAuG6RKABvg1ArGebRkvX6LXul14SM67o2e4mUCY=
+golang.org/x/term v0.48.0 h1:G6UU1eiSB8nl3DzeUGt7Mg+2SctI8tPS6Z5/mBt6cOk=
+golang.org/x/term v0.48.0/go.mod h1:BRDLHCZr2SUjIeBHHpRyQeC9xzSAVbzY2rvKgafnHf4=
golang.org/x/text v0.44.0 h1:YItdp/mQNGnsmrgpcdA5yQ3bnRxCfo/Tj/iByGW9GGo=
golang.org/x/text v0.44.0/go.mod h1:S4FR1waQ9LbjQTls97SyRjDaUUVkaM+cXwwuG/G+MwY=
golang.org/x/time v0.16.0 h1:vMb6ptszcQMkcwiRTAuNNU50gom6++Q/6gY2hDM6VDE=
@@ -587,28 +589,30 @@ sigs.k8s.io/yaml v1.6.0 h1:G8fkbMSAFqgEFgh4b1wmtzDnioxFCUgTZhlbj5P9QYs=
sigs.k8s.io/yaml v1.6.0/go.mod h1:796bPqUfzR/0jLAl6XjHl3Ck7MiyVv8dbTdyT3/pMf4=
tailscale.com v1.104.5 h1:TLemRww20+bcQ0FEVTTZ7yMtVDZ4pOpSCL86Oo9g3mA=
tailscale.com v1.104.5/go.mod h1:Hq4zB8UpaxMW1fvqO30CLVQo3A7Ith0t9MnvEyiuoSA=
-unikraft.com/cloud/plugins/sandbox v0.0.0-20261110115830-def4e9d2e457 h1:Y+yniFXgmhVcywvhkgEDUHEvTgdUbXu/E4L2uBO52YE=
-unikraft.com/cloud/plugins/sandbox v0.0.0-20261110115830-def4e9d2e457/go.mod h1:FEt8GD8sVIPGfh4taRsjIg0Qi6FctdsAtC2Nmf55Wjg=
-unikraft.com/cloud/sdk v0.4.1-staging.14 h1:bCy/7+NekMTflCTJgGnxm0fz1tfAjL1cbKFPqEVSOck=
-unikraft.com/cloud/sdk v0.4.1-staging.14/go.mod h1:fqJuz5qVQraUc+7+o35ejswZc1hRDZlmBGWLdU4pkPQ=
-unikraft.com/cloud/sdk/build v0.0.0-20261112083743-f904b5bfc966 h1:hJ3PzigJbcAwnD51e8+sNMHULSgosSC62Mm8SraGx4w=
-unikraft.com/cloud/sdk/build v0.0.0-20261112083743-f904b5bfc966/go.mod h1:donDzooDSHxIveRqivrltY/k2BYf8P1usqxJsR9MlVA=
-unikraft.com/cloud/sdk/plugins/sandbox v0.0.0-20261113085313-a2a9f94fc300 h1:Kd2UFcrIAzOBb6kHrfSpcKT/7I7eaKyjfkMidlbw/ls=
-unikraft.com/cloud/sdk/plugins/sandbox v0.0.0-20261113085313-a2a9f94fc300/go.mod h1:IcBVuNwBfN5aZYT0tl17J/T0jwDUqhPQsuF5o8RMNzo=
-unikraft.com/x/build v0.0.0-20261111120215-5177d0f4c7b6 h1:v6faME7Yc5iVNtPmNTCaO7UxNQA+x7Dtv0kQmMz/GdU=
-unikraft.com/x/build v0.0.0-20261111120215-5177d0f4c7b6/go.mod h1:MzRYfAFG0ID5dRVJVKykdEDYCIbygQO0FiUQ4ryYD3M=
+unikraft.com/cloud/plugins/sandbox v0.0.0-20261125131623-d66f7dd900a2 h1:6+KBOBG2QnqxBvi6ArHn+Lo7pTQW1GbozRiNN2un9to=
+unikraft.com/cloud/plugins/sandbox v0.0.0-20261125131623-d66f7dd900a2/go.mod h1:FEt8GD8sVIPGfh4taRsjIg0Qi6FctdsAtC2Nmf55Wjg=
+unikraft.com/cloud/sdk v0.4.6-staging.9 h1:wVzAbp1FFx2Z07RsYuEF1uwZZPLpbGSHdnPjYFURqCM=
+unikraft.com/cloud/sdk v0.4.6-staging.9/go.mod h1:TGgPvZueyiNCuuyuP7WBmyRdXNbxqq8Y5V4BTLqX7MI=
+unikraft.com/cloud/sdk/build v0.4.6-staging.6 h1:sl5lpnu8FASorQASlE+tXOf6AddsUlgkP5adlGqiEOY=
+unikraft.com/cloud/sdk/build v0.4.6-staging.6/go.mod h1:Hc6vOMp7HnJmUAazNXwiz3ym3AYVMqyjkU/r9TexGRM=
+unikraft.com/cloud/sdk/plugins/sandbox v0.4.6-staging.7 h1:0emZQzXuijIXCYirW2w06voptUCozXNbVd0MS6JM8+Y=
+unikraft.com/cloud/sdk/plugins/sandbox v0.4.6-staging.7/go.mod h1:6VzCR9HrTVD1gNzKWMv1UMLyFqcHUS6caXq0vGDMqiQ=
+unikraft.com/x/build v0.0.0-20261126162113-a81b5204c19b h1:zp4RrO4xx7RbU8iGN7YmgXKhueRa9Yg1v6YaOHvZH9Q=
+unikraft.com/x/build v0.0.0-20261126162113-a81b5204c19b/go.mod h1:aRRxLJqi1sUh/dFCJ1Kan/6hcGeq14hLs50X6RlUnuM=
unikraft.com/x/buildkit v0.0.0-20261111120215-5177d0f4c7b6 h1:/7BTbMIFXN81vbpO3oB2Vh/97BBCpYIAJXP/z3d4qao=
unikraft.com/x/buildkit v0.0.0-20261111120215-5177d0f4c7b6/go.mod h1:wOWsRBT0lyV3uWHiQX3Tbr3bzwtfQmZN9SUnyKQNi38=
unikraft.com/x/colors v0.0.0-20261111120215-5177d0f4c7b6 h1:HnCSAluQGFRfZ01FK6pjoK3sYWUjDYA9Rs9ZjTw7juM=
unikraft.com/x/colors v0.0.0-20261111120215-5177d0f4c7b6/go.mod h1:udM/yr1HbZbG9qs33/kqZZ/B9LVdTgcFy/TTS3szEMw=
+unikraft.com/x/dockerfile v0.0.0-20261118100745-28172ae5f28c h1:rAUIn2lBKfT2LawKOzXQFcRZArKnXmhCqD4lmZmz1U8=
+unikraft.com/x/dockerfile v0.0.0-20261118100745-28172ae5f28c/go.mod h1:v4ffngl0ivI3eCZcPlL0s25Fn7wYTo0Po7faaVx3IaA=
unikraft.com/x/filters v0.0.0-20261111120215-5177d0f4c7b6 h1:cbbVGw1wGf7AlkUgO8HEcJtR52miZTDW2nJb54D+fRg=
unikraft.com/x/filters v0.0.0-20261111120215-5177d0f4c7b6/go.mod h1:l01AijxdrSNT6W3tREzUbHZVMxfX+b2UK/B16FOII30=
unikraft.com/x/fingerprint v0.0.0-20261111120215-5177d0f4c7b6 h1:ZJ3Pzaej6zNGKQ61Z7EvVIMYzH0S+4Z6smP8ohVcLHg=
unikraft.com/x/fingerprint v0.0.0-20261111120215-5177d0f4c7b6/go.mod h1:A49h7MGEJpnhuqXONsNMI7OMHgz2HpD4o3UmJnrM8i4=
unikraft.com/x/guesstermwidth v0.0.0-20261111120215-5177d0f4c7b6 h1:9XUQLejScr6+iKixqZFMPg+NmGYQJCc8O8BFjzcfpns=
unikraft.com/x/guesstermwidth v0.0.0-20261111120215-5177d0f4c7b6/go.mod h1:Ottq5zN7Zuge2ySDoWllICAVudREPmCvv00d0FPx35w=
-unikraft.com/x/image-spec v0.0.0-20261111120215-5177d0f4c7b6 h1:t6u3lNymtj7tL1XledsXYv4mTfgyqRSdEhkll55hJE8=
-unikraft.com/x/image-spec v0.0.0-20261111120215-5177d0f4c7b6/go.mod h1:0WpdrxA0kZEzzkZiwjMpWJSo3/xbZwhnOIwnc0tDyBc=
+unikraft.com/x/image-spec v0.0.0-20261126162113-a81b5204c19b h1:uRIUKQSbm8bwO9pq/3X6dr/gCqp6wvtBNf5wUxZSXNA=
+unikraft.com/x/image-spec v0.0.0-20261126162113-a81b5204c19b/go.mod h1:YIkqwG7NBIMVwPKm2GUB0eMp5DGpk5cVBVD4AGuWAJA=
unikraft.com/x/integration v0.0.0-20261029083025-f2d161e6abc8 h1:R48wpvUv46CfArM0GdTKWxhDlkagFnRtAaFmRu45O7g=
unikraft.com/x/integration v0.0.0-20261029083025-f2d161e6abc8/go.mod h1:yUzpOnSm68CH1Ujou0bTEJimecGiAjyqfCPiRrFWQI4=
unikraft.com/x/io v0.0.0-20261111120215-5177d0f4c7b6 h1:PGFwRBtzJzxgyuLb4uNk0Ucs3i1U/bY9tZmp/kB+bqs=
@@ -617,14 +621,14 @@ unikraft.com/x/joinerrgroup v0.0.0-20261111120215-5177d0f4c7b6 h1:AnGpM5eeQfP834
unikraft.com/x/joinerrgroup v0.0.0-20261111120215-5177d0f4c7b6/go.mod h1:0qnGxrE3hao0DVREueSDclONRwth1sCBfZjdX4/2mpg=
unikraft.com/x/kingkong v0.0.0-20261111120215-5177d0f4c7b6 h1:sWT5GFDU1F7bu5XE7qyp8eaJ6ft7w3emhFvfJetw6a0=
unikraft.com/x/kingkong v0.0.0-20261111120215-5177d0f4c7b6/go.mod h1:zmUUwkpfQBJaz99ErDMpef0ABijcnwpOcW02plhJxOM=
-unikraft.com/x/kraftfile v0.0.0-20261111120215-5177d0f4c7b6 h1:8hLPDvncyC4bwhX8td+C2q/b5pjLKo9zqSism14rR08=
-unikraft.com/x/kraftfile v0.0.0-20261111120215-5177d0f4c7b6/go.mod h1:QK+7/geX7b/Dwiy3CVbsI/+9Ys5m/r+RRu/BG6qX5tk=
-unikraft.com/x/log v0.0.0-20261111120215-5177d0f4c7b6 h1:tTlHiTnp8FgfAV/UPv2ddaV7vH2IUsT1sbOzc2KgSm4=
-unikraft.com/x/log v0.0.0-20261111120215-5177d0f4c7b6/go.mod h1:XCwOFKbAMvfdyLfU/pRVtW5lqHu60urteiLHDmsj7tc=
+unikraft.com/x/kraftfile v0.0.0-20261120151658-ea11ec33af9a h1:OPibyR7tHkWqXhjDA06I78wy9mrAVyMoLoo+YQ1nQj4=
+unikraft.com/x/kraftfile v0.0.0-20261120151658-ea11ec33af9a/go.mod h1:dXz/eyg7hoRI0RMvaCzbR0GvFyGMJj9Em7VTdNZpFR4=
+unikraft.com/x/log v0.0.0-20261116145447-f4dbf6ae0056 h1:WCCv524/W8gBiBGxopg1mueM82SGtQuCrsPs955En5U=
+unikraft.com/x/log v0.0.0-20261116145447-f4dbf6ae0056/go.mod h1:uNZR+KiFX+1Pj2z1x5oJLH0GG2ufJyIiMFe8BJ5cZFI=
unikraft.com/x/ptr v0.0.0-20261111120215-5177d0f4c7b6 h1:MSng9itL6/GROsKNwiSBScXwjda16wdTegJphP5zjQw=
unikraft.com/x/ptr v0.0.0-20261111120215-5177d0f4c7b6/go.mod h1:IZpTTnftvOzfw7QT9SBZKBhPfPcbJ0VgXmDQIjuHUOM=
-unikraft.com/x/shell v0.0.0-20261113145058-65fc641f4af8 h1:WfoTFZuyXmEJMOwedM1pGxyvyMo5lHOlqLW8xZM940o=
-unikraft.com/x/shell v0.0.0-20261113145058-65fc641f4af8/go.mod h1:QpNFjczQ8PkEt/OwRz56gQFOjVsHUDCfViNq3fsiJD4=
+unikraft.com/x/shell v0.0.0-20261117090838-250b71577700 h1:yW57fQvpgpvmab7R+SkwRU+9Bz7SiG7m7xGfIYHiKJs=
+unikraft.com/x/shell v0.0.0-20261117090838-250b71577700/go.mod h1:kjMnnvZy9A0WAJUs6/Sjgi/TzKRyGZCq7h9Q2fncdu4=
unikraft.com/x/signal v0.0.0-20261111120215-5177d0f4c7b6 h1:dYBrChU3VwjOHXAbOsVT1BRFbTisP8pcOTP3VwlQVlw=
unikraft.com/x/signal v0.0.0-20261111120215-5177d0f4c7b6/go.mod h1:BemdputO8Po0JUUXCoOKVQ/Kbd2fPcz3AATOE2Uy3bU=
unikraft.com/x/stdio v0.0.0-20261111120215-5177d0f4c7b6 h1:rL7uxbhJeZrSFhg/TXLIn//cVoUMAIt7+Z0yIHks9Pw=
diff --git a/internal/cmd/build.go b/internal/cmd/build.go
index 896bd98cf..9e8cfc88f 100644
--- a/internal/cmd/build.go
+++ b/internal/cmd/build.go
@@ -13,8 +13,8 @@ import (
type ImageBuildCmd struct {
Input string `arg:"" default:"." help:"Path to the project directory, Kraftfile, or Dockerfile. A directory without a Kraftfile is built from its Dockerfile."`
- Output string `short:"o" help:"Output destination"`
- Arch []string `help:"Only build the Kraftfile targets of these architectures. Defaults to every declared target, or x86_64 when only a runtime is declared. Required when the project declares no targets and no runtime, such as a bare Dockerfile." example:"x86_64,arm64"`
+ Output string `short:"o" help:"Output destination. A remote build needs an image with a tag, such as my-org/my-app:latest."`
+ Arch []string `help:"Only build the Kraftfile targets of these architectures. Defaults to every declared target, or x86_64 when only a runtime is declared. A local build requires it when the project declares no targets and no runtime, such as a bare Dockerfile. A remote build of such a project defaults to x86_64." example:"x86_64,arm64"`
// similar to docker compose build
BuildArg []string `sep:"none" help:"Set build-time variables."`
@@ -24,7 +24,7 @@ type ImageBuildCmd struct {
Insecure []string `help:"Allow insecure (HTTP/unverified TLS) connections to registries. Specify hostnames to restrict, or omit to apply to all." type:"optional"`
- Remote *string `env:"UNIKRAFT_BUILD_URL" type:"optional" placeholder:"url" help:"Build on the build service at this URL and push the image from there, instead of building locally. Defaults to the build_url of the profile, or https://controlplane.unikraft.com. Creates a builder with the default sizes if you have none. To set the sizes, use 'unikraft builder create'."`
+ Remote *string `env:"UNIKRAFT_BUILD_URL" type:"optional" placeholder:"url" help:"Build on the build service at this URL and push the image from there, instead of building locally. Defaults to the build_url of the profile, or https://controlplane.unikraft.com. Write a URL as --remote=, because the flag does not take the next argument. Creates a builder with the default sizes if you have none. To set the sizes, use 'unikraft builder create'."`
Metro []string `placeholder:"metro" help:"Metros that a remote build may run in, by name or API URL. Defaults to the build service's choice."`
}
diff --git a/internal/cmd/build_native.go b/internal/cmd/build_native.go
index d94bca511..b04ca3493 100644
--- a/internal/cmd/build_native.go
+++ b/internal/cmd/build_native.go
@@ -138,9 +138,9 @@ func (c *ImageBuildCmd) Run(ctx context.Context, cfg *config.Config, partition *
buildOpts.SSH = ssh
}
- var imgs []*imagespec.Image
+ var built build.Built
err = buildWithProgress(ctx, func(b build.Builder) (err error) {
- imgs, err = b.Build(ctx, buildOpts)
+ built, err = b.Build(ctx, buildOpts)
return err
})
if errors.Is(err, build.ErrNoRuntimeTarget) {
@@ -148,6 +148,8 @@ func (c *ImageBuildCmd) Run(ctx context.Context, cfg *config.Config, partition *
} else if err != nil {
return err
}
+ // The packer pushes only to BuildOpts.Push, which is not set here.
+ imgs := built.Images
defer func() {
for _, img := range imgs {
img.Close()
diff --git a/internal/cmd/build_remote.go b/internal/cmd/build_remote.go
index 9ef4afc14..98120951e 100644
--- a/internal/cmd/build_remote.go
+++ b/internal/cmd/build_remote.go
@@ -14,10 +14,9 @@ import (
"encoding/hex"
"errors"
"fmt"
- "net/url"
+ "io/fs"
"os"
"path/filepath"
- "slices"
"strings"
"time"
@@ -26,6 +25,7 @@ import (
"github.com/moby/buildkit/util/progress/progressui"
"github.com/tonistiigi/fsutil"
buildapi "unikraft.com/cloud/sdk/build"
+ "unikraft.com/x/build"
"unikraft.com/x/build/buildflags"
"unikraft.com/x/build/progress"
imagespec "unikraft.com/x/image-spec"
@@ -47,7 +47,7 @@ func (c *ImageBuildCmd) runRemote(ctx context.Context, cfg *config.Config, parti
if err != nil {
return err
}
- c.Remote = new(cmp.Or(*c.Remote, profile.BuildURL, buildapi.DefaultServer))
+ c.Remote = new(cmp.Or(*c.Remote, os.Getenv("UNIKRAFT_BUILD_URL"), profile.BuildURL, buildapi.DefaultServer))
secrets, err := buildflags.ParseSecretSpecs(c.Secret)
if err != nil {
@@ -97,25 +97,29 @@ func followRemote(ctx context.Context, client *buildapi.Client, req buildapi.Cre
// A live display draws over a line logged after it starts.
disp, err := progress.NewDisplay(ctx, os.Stderr, progressui.AutoMode)
if err != nil {
- return errors.Join(err, cancelRemote(ctx, client, b.ID))
+ cancelRemote(ctx, client, b.ID)
+ return err
}
+ cancel := false
defer func() {
if cerr := disp.Close(); err == nil {
err = cerr
}
+ if cancel {
+ cancelRemote(ctx, client, b.ID)
+ }
}()
if b.Session != nil {
if err := client.Attach(ctx, b.ID, s); err != nil {
- return errors.Join(err, cancelRemote(ctx, client, b.ID))
+ cancel = true
+ return err
}
}
for ev, err := range client.Logs(ctx, b.ID) {
if err != nil {
- if ctx.Err() != nil {
- return errors.Join(err, cancelRemote(ctx, client, b.ID))
- }
+ cancel = true
return err
}
if ev.SolveStatus != nil {
@@ -134,11 +138,14 @@ func followRemote(ctx context.Context, client *buildapi.Client, req buildapi.Cre
}
// cancelRemote cancels the remote build id, also once ctx has ended, waiting at most 10 seconds.
-func cancelRemote(ctx context.Context, client *buildapi.Client, id string) error {
+func cancelRemote(ctx context.Context, client *buildapi.Client, id string) {
ctx, cancel := context.WithTimeout(context.WithoutCancel(ctx), 10*time.Second)
defer cancel()
- _, err := client.CancelBuild(ctx, id)
- return err
+ if _, err := client.CancelBuild(ctx, id); err != nil {
+ log.G(ctx).Warn().Err(err).Str("id", id).Msg("could not cancel build, it may still run")
+ return
+ }
+ log.G(ctx).Info().Str("id", id).Msg("cancelled build")
}
// remoteRequest returns the request for a remote build of c, and the directory its session serves.
@@ -148,13 +155,9 @@ func (c *ImageBuildCmd) remoteRequest(secrets []*buildflags.Secret, ssh []*build
}
// The service gets the profile's token, the project and its secrets.
if c.Remote != nil {
- u, err := url.Parse(*c.Remote)
- if err != nil {
+ if err := checkBuildURL(*c.Remote); err != nil {
return buildapi.CreateBuildRequest{}, "", err
}
- if u.Scheme == "http" {
- return buildapi.CreateBuildRequest{}, "", fmt.Errorf("the build service %s must be https", *c.Remote)
- }
}
if c.Output == "" {
return buildapi.CreateBuildRequest{}, "", errors.New("a remote build needs --output, the image to push")
@@ -172,6 +175,9 @@ func (c *ImageBuildCmd) remoteRequest(secrets []*buildflags.Secret, ssh []*build
}
fi, err := os.Stat(c.Input)
+ if errors.Is(err, fs.ErrNotExist) {
+ return buildapi.CreateBuildRequest{}, "", fmt.Errorf("build input %q does not exist", c.Input)
+ }
if err != nil {
return buildapi.CreateBuildRequest{}, "", err
}
@@ -200,8 +206,7 @@ func (c *ImageBuildCmd) remoteRequest(secrets []*buildflags.Secret, ssh []*build
}
switch {
case name == "": // a directory without a Kraftfile builds its Dockerfile
- case slices.Contains(strings.Split(name, "."), "Dockerfile"): // as x/build tells one
-
+ case build.IsDockerfile(name):
req.Contexts.Dockerfile = new(src.WithFilename(name))
default:
req.Kraftfile = buildapi.KraftfileFrom(src.WithFilename(name))
@@ -213,7 +218,9 @@ func (c *ImageBuildCmd) remoteRequest(secrets []*buildflags.Secret, ssh []*build
return buildapi.CreateBuildRequest{}, "", fmt.Errorf("invalid build-arg %q", arg)
}
if !ok {
- val, _ = os.LookupEnv(key)
+ if val, ok = os.LookupEnv(key); !ok {
+ continue
+ }
}
if req.BuildArgs == nil {
req.BuildArgs = map[string]string{}
diff --git a/internal/cmd/build_remote_test.go b/internal/cmd/build_remote_test.go
index 0a23c7d72..99b5464b6 100644
--- a/internal/cmd/build_remote_test.go
+++ b/internal/cmd/build_remote_test.go
@@ -23,6 +23,24 @@ import (
"unikraft.com/x/build/buildflags"
)
+func TestRunRemoteBuildURL(t *testing.T) {
+ path := filepath.Join(t.TempDir(), "config.yaml")
+ require.NoError(t, os.WriteFile(path, []byte("profile: a\nprofiles:\n a: {type: cloud, token: a, build_url: http://profile.invalid}\n"), 0o600))
+ cfg, err := loadConfig(path, "")
+ require.NoError(t, err)
+
+ run := func(remote string) error {
+ cmd := ImageBuildCmd{Remote: &remote, Output: "my-org/my-app:1"}
+ return cmd.runRemote(t.Context(), cfg, nil)
+ }
+
+ t.Setenv("UNIKRAFT_BUILD_URL", "")
+ require.ErrorContains(t, run(""), "http://profile.invalid")
+ t.Setenv("UNIKRAFT_BUILD_URL", "http://env.invalid")
+ require.ErrorContains(t, run(""), "http://env.invalid")
+ require.ErrorContains(t, run("http://flag.invalid"), "http://flag.invalid")
+}
+
func TestRemoteRequest(t *testing.T) {
t.Parallel()
@@ -45,7 +63,7 @@ func TestRemoteRequest(t *testing.T) {
cmd: ImageBuildCmd{
Output: "my-org/my-app:latest",
Arch: []string{"arm64"},
- BuildArg: []string{"VERSION=1.2.3"},
+ BuildArg: []string{"VERSION=1.2.3", "NOT_IN_THE_ENVIRONMENT"},
NoCache: true,
Secret: []string{"id=npm,src=/home/me/.npmrc"},
SSH: []string{"default"},
@@ -74,6 +92,20 @@ func TestRemoteRequest(t *testing.T) {
"output": [{"image": "ghcr.io/acme/app:1"}]
}`,
},
+ "a Containerfile is built as a Dockerfile": {
+ files: []string{"Containerfile"},
+ input: "Containerfile",
+ cmd: ImageBuildCmd{Output: "ghcr.io/acme/app:1"},
+ want: `{
+ "contexts": {
+ "context": {"session": "context"},
+ "dockerfile": {"session": "context", "filename": "Containerfile"}
+ },
+ "no_cache": false,
+ "registries": {"*": {"session": true}},
+ "output": [{"image": "ghcr.io/acme/app:1"}]
+ }`,
+ },
"a Dockerfile is built from its directory": {
files: []string{"app.Dockerfile"},
input: "app.Dockerfile",
@@ -122,6 +154,14 @@ func TestRemoteRequest(t *testing.T) {
require.Error(t, err)
})
}
+
+ t.Run("names a missing input", func(t *testing.T) {
+ t.Parallel()
+
+ cmd := ImageBuildCmd{Input: filepath.Join(t.TempDir(), "missing"), Output: "my-org/my-app:1"}
+ _, _, err := cmd.remoteRequest(nil, nil)
+ require.EqualError(t, err, fmt.Sprintf("build input %q does not exist", cmd.Input))
+ })
}
func TestFollowRemoteCancelsARefusedSession(t *testing.T) {
@@ -156,3 +196,36 @@ func TestFollowRemoteCancelsARefusedSession(t *testing.T) {
assert.Equal(t, buildapi.ErrorCodeInvalid, apiErr.Code)
assert.Len(t, cancelled, 1)
}
+
+func TestFollowRemoteCancelsALostProgressStream(t *testing.T) {
+ t.Parallel()
+
+ cancelled := make(chan struct{}, 1)
+ srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ w.Header().Set("Content-Type", "application/json")
+ switch r.URL.Path {
+ case "/v1/builds":
+ w.WriteHeader(http.StatusCreated)
+ fmt.Fprint(w, `{"id": "b1", "status": "waiting"}`)
+ case "/v1/builds/b1/logs":
+ w.WriteHeader(http.StatusForbidden)
+ fmt.Fprint(w, `{"error": {"code": "forbidden", "message": "no access"}}`)
+ case "/v1/builds/b1/cancel":
+ cancelled <- struct{}{}
+ w.WriteHeader(http.StatusAccepted)
+ fmt.Fprint(w, `{"id": "b1", "status": "waiting"}`)
+ }
+ }))
+ t.Cleanup(srv.Close)
+
+ client, err := buildapi.New(srv.URL)
+ require.NoError(t, err)
+ s, err := session.NewSession(t.Context(), "")
+ require.NoError(t, err)
+
+ err = followRemote(t.Context(), client, buildapi.CreateBuildRequest{}, s)
+ var apiErr *buildapi.APIError
+ require.ErrorAs(t, err, &apiErr)
+ assert.Equal(t, http.StatusForbidden, apiErr.StatusCode)
+ assert.Len(t, cancelled, 1)
+}
diff --git a/internal/cmd/builder.go b/internal/cmd/builder.go
index 9bc6c0fb6..5fb0cc662 100644
--- a/internal/cmd/builder.go
+++ b/internal/cmd/builder.go
@@ -10,7 +10,9 @@ import (
"context"
"errors"
"fmt"
+ "net/url"
+ "github.com/MakeNowJust/heredoc"
"github.com/docker/go-units"
buildapi "unikraft.com/cloud/sdk/build"
"unikraft.com/x/kingkong"
@@ -38,10 +40,11 @@ type BuilderCmd struct {
// Builder is a builder of the build service, and the builds the service runs on it.
type Builder struct {
Name string `mirror:"status.name" field:",short" help:"Name of the builder."`
+ Metro string `field:",short" help:"Metro the builder runs in."`
IsDefault bool `mirror:"status.default" field:"default,short" help:"Whether builds that name no builder run on it."`
Running int `mirror:"status.builds.#" field:",short" help:"Number of builds running on the builder."`
- Waiting int32 `mirror:"status.waiting_builds" field:",short" help:"Number of builds waiting for the builder, or for any builder of the pool for default."`
- MaxBuilds int32 `mirror:"status.max_builds" field:",short" help:"Number of builds that run on the builder at once."`
+ Waiting int32 `mirror:"status.waiting_builds" field:",short" help:"Number of builds that have not started: waiting for a build slot or for their client's session."`
+ MaxBuilds int32 `mirror:"status.max_builds" field:",short" help:"Number of builds that each replica of the build service runs on the builder at once."`
Images []string `field:",long" help:"Images that the running builds push."`
Instance Link[Instance] `mirror:"status.instance" field:",long" help:"Instance the builder runs as, for its image, sizes and state."`
@@ -72,11 +75,12 @@ func (Builder) Get(ctx context.Context, keys []string) ([]model.Model, error) {
if err != nil {
return nil, err
}
+ metro, _ := ctx.Value(builderMetroKey{}).(string)
var results []model.Model
for _, name := range keys {
- s, err := client.GetBuilder(ctx, name, buildapi.GetBuilderOptions{})
+ s, err := client.GetBuilder(ctx, name, buildapi.GetBuilderOptions{Metro: builderMetro(metro)})
if err != nil {
- return results, builderError(err, name)
+ return results, builderError(err, name, metro)
}
b, err := builderOf(profile, *s)
if err != nil {
@@ -120,9 +124,10 @@ func (Builder) Delete(ctx context.Context, keys []string) error {
if err != nil {
return err
}
+ metro, _ := ctx.Value(builderMetroKey{}).(string)
for _, name := range keys {
- if err := client.DeleteBuilder(ctx, name, buildapi.DeleteBuilderOptions{}); err != nil {
- return builderError(err, name)
+ if err := client.DeleteBuilder(ctx, name, buildapi.DeleteBuilderOptions{Metro: builderMetro(metro)}); err != nil {
+ return builderError(err, name, metro)
}
}
return nil
@@ -157,9 +162,11 @@ func builderOf(profile *config.Profile, s buildapi.BuilderStatus) (Builder, erro
if err := mirror.Mirror(b, &b); err != nil {
return Builder{}, fmt.Errorf("could not mirror builder data: %w", err)
}
+ b.Metro = s.Instance.Metro
for _, metro := range profile.Metros {
if metro.Endpoint == s.Instance.Metro {
b.Instance.Metro = metro.Name
+ b.Metro = metro.Name
}
}
for _, build := range s.Builds {
@@ -175,18 +182,40 @@ func builderOf(profile *config.Profile, s buildapi.BuilderStatus) (Builder, erro
// builderRemoteKey holds the URL of the build service for the methods of Builder.
type builderRemoteKey struct{}
+type builderMetroKey struct{}
+
+func builderMetro(metro string) *string {
+ if metro == "" {
+ return nil
+ }
+ return &metro
+}
+
type BuilderGetCmd struct {
cmd.ModelGetCmd[Builder]
- Remote string `env:"UNIKRAFT_BUILD_URL" placeholder:"url" help:"URL of the build service that manages the builder. Defaults to the build_url of the profile."`
+ Remote string `env:"UNIKRAFT_BUILD_URL" placeholder:"url" help:"URL of the build service that manages the builder. Defaults to the build_url of the profile, or https://controlplane.unikraft.com."`
+ Metro string `placeholder:"metro" help:"Metro of the builder, by name or API URL. Defaults to the first metro that your builds may run in."`
}
func (c *BuilderGetCmd) Run(ctx context.Context, stdio xstdio.Stdio) error {
- return c.ModelGetCmd.Run(context.WithValue(ctx, builderRemoteKey{}, c.Remote), stdio, nil)
+ ctx = context.WithValue(ctx, builderRemoteKey{}, c.Remote)
+ return c.ModelGetCmd.Run(context.WithValue(ctx, builderMetroKey{}, c.Metro), stdio, nil)
}
type BuilderListCmd struct {
cmd.ModelListCmd[Builder]
- Remote string `env:"UNIKRAFT_BUILD_URL" placeholder:"url" help:"URL of the build service that manages the builders. Defaults to the build_url of the profile."`
+ Remote string `env:"UNIKRAFT_BUILD_URL" placeholder:"url" help:"URL of the build service that manages the builders. Defaults to the build_url of the profile, or https://controlplane.unikraft.com."`
+}
+
+func (BuilderListCmd) Help() string {
+ return heredoc.Doc(`
+ List builders.
+
+ Each replica of the build service runs up to max-builds builds on a
+ builder at once, so running can be higher than max-builds. Waiting
+ counts the builds that have not started: those that wait for a build
+ slot and those that wait for their client's session.
+ `)
}
func (c *BuilderListCmd) Run(ctx context.Context, stdio xstdio.Stdio) error {
@@ -195,11 +224,13 @@ func (c *BuilderListCmd) Run(ctx context.Context, stdio xstdio.Stdio) error {
type BuilderDeleteCmd struct {
cmd.ModelRemoveCmd[Builder]
- Remote string `env:"UNIKRAFT_BUILD_URL" placeholder:"url" help:"URL of the build service that manages the builder. Defaults to the build_url of the profile."`
+ Remote string `env:"UNIKRAFT_BUILD_URL" placeholder:"url" help:"URL of the build service that manages the builder. Defaults to the build_url of the profile, or https://controlplane.unikraft.com."`
+ Metro string `placeholder:"metro" help:"Metro of the builder, by name or API URL. Defaults to the first metro that your builds may run in."`
}
func (c *BuilderDeleteCmd) Run(ctx context.Context, stdio xstdio.Stdio) error {
- return c.ModelRemoveCmd.Run(context.WithValue(ctx, builderRemoteKey{}, c.Remote), stdio, nil)
+ ctx = context.WithValue(ctx, builderRemoteKey{}, c.Remote)
+ return c.ModelRemoveCmd.Run(context.WithValue(ctx, builderMetroKey{}, c.Metro), stdio, nil)
}
type BuilderCreateCmd struct {
@@ -207,7 +238,8 @@ type BuilderCreateCmd struct {
VCPUs int32 `name:"vcpus" placeholder:"n" help:"Number of vCPUs of the builder, within the range the plan allows. Defaults to the build service's."`
Memory types.SizeMebibytes `placeholder:"size" help:"Memory of the builder, within the range the plan allows. Defaults to the build service's."`
Cache types.SizeMebibytes `placeholder:"size" help:"Size of the builder's cache volume. Defaults to the build service's."`
- Remote string `env:"UNIKRAFT_BUILD_URL" placeholder:"url" help:"URL of the build service that manages the builder. Defaults to the build_url of the profile."`
+ Remote string `env:"UNIKRAFT_BUILD_URL" placeholder:"url" help:"URL of the build service that manages the builder. Defaults to the build_url of the profile, or https://controlplane.unikraft.com."`
+ Metro string `placeholder:"metro" help:"Metro of the builder, by name or API URL. Defaults to the first metro that your builds may run in."`
}
func (BuilderCreateCmd) Examples() []kingkong.Example {
@@ -221,7 +253,8 @@ func (BuilderCreateCmd) Examples() []kingkong.Example {
type BuilderDuCmd struct {
Name string `arg:"" optional:"" default:"default" help:"Name of the builder."`
- Remote string `env:"UNIKRAFT_BUILD_URL" placeholder:"url" help:"URL of the build service that manages the builder. Defaults to the build_url of the profile."`
+ Remote string `env:"UNIKRAFT_BUILD_URL" placeholder:"url" help:"URL of the build service that manages the builder. Defaults to the build_url of the profile, or https://controlplane.unikraft.com."`
+ Metro string `placeholder:"metro" help:"Metro of the builder, by name or API URL. Defaults to the first metro that your builds may run in."`
}
func (BuilderDuCmd) Examples() []kingkong.Example {
@@ -235,7 +268,8 @@ func (BuilderDuCmd) Examples() []kingkong.Example {
type BuilderPruneCmd struct {
Name string `arg:"" optional:"" default:"default" help:"Name of the builder."`
- Remote string `env:"UNIKRAFT_BUILD_URL" placeholder:"url" help:"URL of the build service that manages the builder. Defaults to the build_url of the profile."`
+ Remote string `env:"UNIKRAFT_BUILD_URL" placeholder:"url" help:"URL of the build service that manages the builder. Defaults to the build_url of the profile, or https://controlplane.unikraft.com."`
+ Metro string `placeholder:"metro" help:"Metro of the builder, by name or API URL. Defaults to the first metro that your builds may run in."`
}
func (BuilderPruneCmd) Examples() []kingkong.Example {
@@ -262,7 +296,7 @@ func (c *BuilderCreateCmd) Run(ctx context.Context, cfg *config.Config) error {
if c.Cache != 0 {
b.CacheMb = new(int64(c.Cache))
}
- if _, err := client.CreateBuilder(ctx, b, buildapi.CreateBuilderOptions{}); err != nil {
+ if _, err := client.CreateBuilder(ctx, b, buildapi.CreateBuilderOptions{Metro: builderMetro(c.Metro)}); err != nil {
return err
}
log.G(ctx).Info().Str("name", c.Name).Msg("builder ready")
@@ -274,9 +308,9 @@ func (c *BuilderDuCmd) Run(ctx context.Context, cfg *config.Config, stdio xstdio
if err != nil {
return err
}
- u, err := client.GetBuilderUsage(ctx, c.Name, buildapi.GetBuilderUsageOptions{})
+ u, err := client.GetBuilderUsage(ctx, c.Name, buildapi.GetBuilderUsageOptions{Metro: builderMetro(c.Metro)})
if err != nil {
- return builderError(err, c.Name)
+ return builderError(err, c.Name, c.Metro)
}
_, err = fmt.Fprintf(stdio.Stdout, "Reclaimable: %s\nTotal: %s\n", units.BytesSize(float64(u.ReclaimableBytes)), units.BytesSize(float64(u.TotalBytes)))
return err
@@ -287,9 +321,9 @@ func (c *BuilderPruneCmd) Run(ctx context.Context, cfg *config.Config) error {
if err != nil {
return err
}
- resp, err := client.PruneBuilder(ctx, c.Name, buildapi.PruneBuilderOptions{})
+ resp, err := client.PruneBuilder(ctx, c.Name, buildapi.PruneBuilderOptions{Metro: builderMetro(c.Metro)})
if err != nil {
- return builderError(err, c.Name)
+ return builderError(err, c.Name, c.Metro)
}
log.G(ctx).Info().Str("freed", units.BytesSize(float64(resp.FreedBytes))).Msg("pruned the builder's cache")
return nil
@@ -301,13 +335,24 @@ func builderClient(cfg *config.Config, url string) (*buildapi.Client, error) {
if err != nil {
return nil, err
}
- url = cmp.Or(url, profile.BuildURL)
- if url == "" {
- return nil, fmt.Errorf("no build service: set build_url in profile %s, or pass --remote", profile.Name)
+ url = cmp.Or(url, profile.BuildURL, buildapi.DefaultServer)
+ if err := checkBuildURL(url); err != nil {
+ return nil, err
}
return buildapi.New(url, buildapi.WithToken(profile.Token))
}
+func checkBuildURL(remote string) error {
+ u, err := url.Parse(remote)
+ if err != nil {
+ return err
+ }
+ if u.Scheme == "http" {
+ return fmt.Errorf("the build service %s must be https", remote)
+ }
+ return nil
+}
+
// builderClientOf returns the client of the build service in ctx, and the current profile.
func builderClientOf(ctx context.Context) (*buildapi.Client, *config.Profile, error) {
cfg := config.G(ctx)
@@ -321,8 +366,11 @@ func builderClientOf(ctx context.Context) (*buildapi.Client, *config.Profile, er
}
// builderError tells how to create the named builder when the service has none.
-func builderError(err error, name string) error {
+func builderError(err error, name, metro string) error {
if apiErr, ok := errors.AsType[*buildapi.APIError](err); ok && apiErr.Code == buildapi.ErrorCodeNotFound {
+ if metro != "" {
+ return fmt.Errorf("there is no builder %s in metro %s: create it with unikraft builder create %s --metro %s", name, metro, name, metro)
+ }
return fmt.Errorf("there is no builder %s: create it with unikraft builder create %s", name, name)
}
return err
diff --git a/internal/cmd/builder_test.go b/internal/cmd/builder_test.go
index 5d0aa6963..63b1f28be 100644
--- a/internal/cmd/builder_test.go
+++ b/internal/cmd/builder_test.go
@@ -7,14 +7,10 @@ package cmd
import (
"context"
- "fmt"
- "net/http"
- "net/http/httptest"
"os"
"path/filepath"
"testing"
- "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"unikraft.com/cli/internal/config"
@@ -23,19 +19,9 @@ import (
func TestBuilderBuildURL(t *testing.T) {
t.Parallel()
- srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- w.Header().Set("Content-Type", "application/json")
- fmt.Fprint(w, `{"builders": [{"name": "default", "default": true}]}`)
- }))
- t.Cleanup(srv.Close)
-
list := func(buildURL, remote string) error {
- profile := "{type: cloud, token: a}"
- if buildURL != "" {
- profile = "{type: cloud, token: a, build_url: " + buildURL + "}"
- }
path := filepath.Join(t.TempDir(), "config.yaml")
- require.NoError(t, os.WriteFile(path, []byte("profile: a\nprofiles:\n a: "+profile+"\n"), 0o600))
+ require.NoError(t, os.WriteFile(path, []byte("profile: a\nprofiles:\n a: {type: cloud, token: a, build_url: "+buildURL+"}\n"), 0o600))
cfg, err := loadConfig(path, "")
require.NoError(t, err)
ctx := context.WithValue(config.WithConfig(t.Context(), cfg), builderRemoteKey{}, remote)
@@ -43,7 +29,6 @@ func TestBuilderBuildURL(t *testing.T) {
return err
}
- assert.NoError(t, list(srv.URL, ""))
- assert.NoError(t, list("http://127.0.0.1:1", srv.URL))
- assert.ErrorContains(t, list("", ""), "set build_url in profile a, or pass --remote")
+ require.ErrorContains(t, list("http://profile.invalid", ""), "the build service http://profile.invalid must be https")
+ require.ErrorContains(t, list("http://profile.invalid", "http://flag.invalid"), "the build service http://flag.invalid must be https")
}
diff --git a/internal/cmd/images.go b/internal/cmd/images.go
index 2762620e7..cc3ed0c24 100644
--- a/internal/cmd/images.go
+++ b/internal/cmd/images.go
@@ -143,7 +143,7 @@ func (Image) Get(ctx context.Context, keys []string) ([]model.Model, error) {
eg := joinerrgroup.Group{}
for i, key := range keys {
eg.Go(func() error {
- src, err := imagespec.GuessLocation(key)
+ src, err := imageLocation(ctx, key)
if err != nil {
return fmt.Errorf("parsing image reference %q: %w", key, err)
}
@@ -212,7 +212,7 @@ func (Image) Delete(ctx context.Context, keys []string) error {
eg := joinerrgroup.Group{}
for i, key := range keys {
eg.Go(func() error {
- uri, err := imagespec.GuessLocation(key)
+ uri, err := imageLocation(ctx, key)
if err != nil {
return fmt.Errorf("parsing image reference %q: %w", key, err)
}
@@ -230,6 +230,20 @@ func (Image) Delete(ctx context.Context, keys []string) error {
return errors.Join(eg.Wait(), imagesNotFound(keys, missing))
}
+// imageLocation parses key as GuessLocation does. A hosted server takes only
+// registry references: the other locations are its own files, or addresses
+// that the caller picks. It does not look at its files to tell them apart.
+func imageLocation(ctx context.Context, key string) (*imagespec.Location, error) {
+ if !hosted(ctx) {
+ return imagespec.GuessLocation(key)
+ }
+ src, err := imagespec.ParseLocationDefault(key)
+ if err == nil && src.Scheme != schemes.OCI {
+ err = fmt.Errorf("the server takes only registry references, not %s", src.Scheme)
+ }
+ return src, err
+}
+
// imagesNotFound returns one not-found error for every missing key, so that
// errors.As sees all of them rather than only the first.
func imagesNotFound(keys []string, missing []bool) error {
diff --git a/internal/cmd/images_internal_test.go b/internal/cmd/images_internal_test.go
index 7a5284d33..9a1dcf5ad 100644
--- a/internal/cmd/images_internal_test.go
+++ b/internal/cmd/images_internal_test.go
@@ -27,3 +27,12 @@ func TestImagesNotFound(t *testing.T) {
}
assert.Equal(t, []string{"a", "c"}, keys)
}
+
+func TestImageDeleteOfAHostedServerKeepsItsFiles(t *testing.T) {
+ dir := t.TempDir()
+
+ err := Image{}.Delete(WithHosted(t.Context()), []string{"oci-layout://" + dir})
+
+ require.ErrorContains(t, err, "only registry references")
+ assert.DirExists(t, dir)
+}
diff --git a/internal/cmd/instance_checkpoints.go b/internal/cmd/instance_checkpoints.go
index 1c26f4e06..580ea49cc 100644
--- a/internal/cmd/instance_checkpoints.go
+++ b/internal/cmd/instance_checkpoints.go
@@ -10,7 +10,6 @@ import (
"context"
"errors"
"fmt"
- "io"
"unikraft.com/cloud/sdk/platform"
"unikraft.com/cloud/sdk/platform/group"
@@ -37,7 +36,7 @@ type InstanceCheckpointsCmd struct {
Create cmd.ModelCreateCmd[InstanceCheckpoint] `cmd:"" help:"Create a checkpoint from an instance."`
Edit cmd.ModelEditCmd[InstanceCheckpoint] `cmd:"" help:"Edit an instance checkpoint."`
- History InstanceCheckpointHistoryCmd `cmd:"" help:"Show the history of a checkpoint."`
+ History InstanceCheckpointHistoryCmd `cmd:"" help:"Show the lineage of a checkpoint."`
}
type InstanceCheckpoint struct {
@@ -478,117 +477,31 @@ func (InstanceCheckpoint) Examples() map[cmd.CmdType][]kingkong.Example {
}
}
-// InstanceHistoryEntry represents a single checkpoint in the history of an
-// instance or checkpoint. It models one row of history output as a resource so
-// that it can be rendered through the standard printer framework.
-type InstanceHistoryEntry struct {
- Metro LinkName[Metro] `field:"metro,short" json:"metro" help:"Metro the checkpoint is in."`
- Target string `field:",short" json:"target" help:"Instance or checkpoint the history was requested for."`
- Name string `field:",short" json:"name" help:"Checkpoint name."`
- UUID string `field:",long" json:"uuid" help:"Unique identifier assigned at creation."`
- Created types.RelativeTime `field:"created,short" json:"created" help:"Creation time."`
-
- key multimetro.Key
-}
-
-func (InstanceHistoryEntry) Type() model.Type {
- return model.Type{
- Name: "instance-history-entry",
- Names: "instance-history-entries",
- }
-}
-
-func (i InstanceHistoryEntry) Key() model.Key {
- return i.key
-}
-
-func (i InstanceHistoryEntry) Raw() any {
- return i
-}
-
-func (i InstanceHistoryEntry) Fields(ctx context.Context) ([]model.Field, error) {
- return model.FieldsFromStruct(i)
-}
-
-// getInstanceHistory fetches checkpoint history entries for the given targets
-// using the provided fetch function (either the instance or checkpoint history
-// endpoint) and flattens them into InstanceHistoryEntry rows.
-func getInstanceHistory(ctx context.Context, targets []string, fetch func(ctx context.Context, c multimetro.MetroClient, ids []platform.NameOrUUID) (*platform.Response[platform.GetCheckpointHistoryResponseData], error)) ([]model.Model, error) {
- keys := multimetro.ParseKeys(targets)
-
- g, err := multimetro.NewClient(ctx)
- if err != nil {
- return nil, err
- }
-
- return group.CollectRefsSlices(ctx, g, keys.Refs(), func(ctx context.Context, c multimetro.MetroClient, refs group.Refs) ([]model.Model, group.Refs, error) {
- log.G(ctx).Trace().Msg("getting checkpoint history")
- resp, err := fetch(ctx, c, refs.NameOrUUIDs())
- if err != nil && !platform.ErrorContainsOnly(err, platform.APIHTTPErrorNotFound) {
- return nil, nil, err
- }
- var found []group.Ref
- var results []model.Model
- if resp == nil || resp.Data == nil {
- return nil, nil, nil
- }
- for _, inst := range resp.Data.Instances {
- if inst.Status == nil || *inst.Status != platform.ResponseStatusSuccess {
- continue
- }
- found = append(found, group.Ref{
- Metro: c.Metro.Name,
- Name: inst.Name,
- UUID: inst.Uuid,
- })
- target := multimetro.Key{Metro: c.Metro.Name, Name: inst.Name, UUID: inst.Uuid}
- for _, entry := range inst.History {
- results = append(results, InstanceHistoryEntry{
- Metro: LinkName[Metro](c.Metro.Name),
- Target: target.String(),
- Name: entry.Name,
- UUID: entry.Uuid,
- Created: types.RelativeTime(entry.CreatedAt),
- key: multimetro.Key{Metro: c.Metro.Name, Name: entry.Name, UUID: entry.Uuid},
- })
- }
- }
- return results, found, nil
- })
-}
+// InstanceCheckpointHistoryCmd shows the lineage of a checkpoint.
+type InstanceCheckpointHistoryCmd struct {
+ Targets []string `arg:"" name:"target" completion-predictor:"resource-key-instance-checkpoint" help:"Target checkpoints to show the lineage of."`
-// renderInstanceHistory prints history entries through the printer framework.
-func renderInstanceHistory(ctx context.Context, out io.Writer, opts cmd.FormatOpts, entries []model.Model) error {
- return opts.Output.
- WithDefault(cmd.PrinterTypeTable).
- Print(ctx, out, opts.Field, InstanceHistoryEntry{}, entries...)
+ InstanceHistoryOpts
}
-// InstanceCheckpointHistoryCmd shows the checkpoint history for a checkpoint.
-type InstanceCheckpointHistoryCmd struct {
- Targets []string `arg:"" name:"target" completion-predictor:"resource-key-instance-checkpoint" help:"Target checkpoints to show history for."`
-
- cmd.FormatOpts
+func (cmd InstanceCheckpointHistoryCmd) Help() string {
+ return "Show the whole lineage tree of a checkpoint: every instance, template and checkpoint in it." + lineageHelp
}
func (cmd InstanceCheckpointHistoryCmd) Examples() []kingkong.Example {
return []kingkong.Example{
{
- Description: "Show the history of a checkpoint",
+ Description: "Show the lineage of a checkpoint",
Commands: []string{"unikraft instance checkpoint history my-checkpoint"},
},
+ {
+ Description: "Show the lineage with the UUID of each node",
+ Commands: []string{"unikraft instance checkpoint history my-checkpoint -f +uuid"},
+ },
}
}
func (c *InstanceCheckpointHistoryCmd) Run(ctx context.Context, stdio xstdio.Stdio) error {
- entries, err := getInstanceHistory(ctx, c.Targets, func(ctx context.Context, mc multimetro.MetroClient, ids []platform.NameOrUUID) (*platform.Response[platform.GetCheckpointHistoryResponseData], error) {
- return mc.GetCheckpointHistory(ctx, ids, platform.GetCheckpointHistoryOpts{})
- })
- if err != nil && len(entries) == 0 {
- return err
- }
- if printErr := renderInstanceHistory(ctx, stdio.Stdout, c.FormatOpts, entries); printErr != nil {
- return errors.Join(err, printErr)
- }
- return err
+ found, err := InstanceCheckpoint{}.Get(ctx, c.Targets)
+ return runInstanceHistory(ctx, stdio, c.InstanceHistoryOpts, c.Targets, found, err)
}
diff --git a/internal/cmd/instance_templates.go b/internal/cmd/instance_templates.go
index d980bbe54..e7a811d0e 100644
--- a/internal/cmd/instance_templates.go
+++ b/internal/cmd/instance_templates.go
@@ -24,6 +24,7 @@ import (
"unikraft.com/cli/internal/types"
"unikraft.com/cli/pkg/model"
"unikraft.com/cli/pkg/model/cmd"
+ xstdio "unikraft.com/x/stdio"
)
type InstanceTemplatesCmd struct {
@@ -32,8 +33,9 @@ type InstanceTemplatesCmd struct {
cmd.ListableModelCmd[InstanceTemplate]
cmd.BulkDeletableModelCmd[InstanceTemplate]
- Create cmd.ModelCreateCmd[InstanceTemplate] `cmd:"" help:"Create an instance template."`
- Edit cmd.ModelEditCmd[InstanceTemplate] `cmd:"" help:"Edit an instance template."`
+ Create cmd.ModelCreateCmd[InstanceTemplate] `cmd:"" help:"Create an instance template."`
+ Edit cmd.ModelEditCmd[InstanceTemplate] `cmd:"" help:"Edit an instance template."`
+ History InstanceTemplateHistoryCmd `cmd:"" help:"Show the lineage of an instance template."`
}
type InstanceTemplate struct {
@@ -48,9 +50,11 @@ type InstanceTemplate struct {
Autokill Autokill `field:",embed" mirror:"instance.template_autokill" create:"set" edit:"set" flag:"autokill" help:"Autokill options.\n time: time since the template was last cloned before it is deleted, such as 24h, 0 disables" placeholder:"=" example:"time=24h"`
- State types.InstanceState `mirror:"instance.state" field:",short" help:"Lifecycle state: stopped, starting, running, draining (finishing requests before a stop), stopping, standby (scaled to zero, woken by traffic), template, checkpoint or deleted."`
- Image types.ImageRef `mirror:"instance.image" field:",short" help:"Image of the template, as an OCI reference or a full registry URL."`
- Type_ *platform.InstanceType `mirror:"instance.type" field:"type,long" help:"Virtual machine type.\n micro: Firecracker microVM (default)\n full: QEMU virtual machine with GPU support, needs a plan with full VM support and has no branching, checkpoints, vertical scaling, annotations or virtiofs volumes"`
+ State types.InstanceState `mirror:"instance.state" field:",short" help:"Lifecycle state: stopped, starting, running, draining (finishing requests before a stop), stopping, standby (scaled to zero, woken by traffic), template, checkpoint or deleted."`
+ Image types.ImageRef `mirror:"instance.image" field:",short" edit:"set" flag:"image" help:"Image of the template, as an OCI reference or a full registry URL." placeholder:":" example:"nginx:latest,my-app:v1.2.3"`
+ PullPolicy *platform.PullPolicy `mirror:"-" field:"pull-policy,invisible,valueless" edit:"set" flag:"pull-policy" help:"When to pull the image relative to the node's cache: always, if_not_present or never. Needs image in the same edit. Each image edit replaces the pull policy and headers, so set both again." placeholder:"policy" example:"always,if_not_present,never"`
+ ImageHeaders map[string]string `mirror:"-" field:"image-headers,invisible,valueless" edit:"set" flag:"image-header" sep:"none" mapsep:"none" help:"HTTP header sent when fetching the image, as KEY=value, up to 16. Needs image in the same edit. Each image edit replaces the pull policy and headers, so set both again." placeholder:"=" example:"Authorization=Bearer "`
+ Type_ *platform.InstanceType `mirror:"instance.type" field:"type,long" help:"Virtual machine type.\n micro: Firecracker microVM (default)\n full: QEMU virtual machine with GPU support, needs a plan with full VM support and has no branching, checkpoints, vertical scaling, annotations or virtiofs volumes"`
Runtime struct {
Args InstanceArgs `mirror:"instance.args" field:",short" help:"Command-line arguments passed to the instance at start."`
@@ -251,6 +255,10 @@ func (InstanceTemplate) Edit(ctx context.Context, key string, fields []model.Fie
if err != nil {
return err
}
+ patches, err = setImageOptions(fields, platform.MutableTemplateInstancePropertyImage, patches)
+ if err != nil {
+ return err
+ }
g, err := multimetro.NewClient(ctx)
if err != nil {
@@ -290,6 +298,12 @@ func instanceTemplatePatchSpec(path string, op patchOp, value any) (platform.Mut
switch path {
case "tags":
return platform.MutableTemplateInstancePropertyTags, value.([]string), nil
+ case "image":
+ ref := value.(types.ImageRef)
+ if ref.Reference().IsZero() {
+ return zero, nil, fmt.Errorf("image cannot be empty")
+ }
+ return platform.MutableTemplateInstancePropertyImage, ref.String(), nil
case "autokill":
autokill := value.(Autokill)
req := map[string]any{}
@@ -468,6 +482,12 @@ func (InstanceTemplate) Examples() map[cmd.CmdType][]kingkong.Example {
"unikraft instance template edit demo-template --set tags=env-dev",
},
},
+ {
+ Description: "Change the template image and always pull it",
+ Commands: []string{
+ "unikraft instance template edit demo-template --image my-app:v2 --pull-policy always",
+ },
+ },
},
cmd.CmdTypeDelete: {
{
@@ -477,3 +497,32 @@ func (InstanceTemplate) Examples() map[cmd.CmdType][]kingkong.Example {
},
}
}
+
+// InstanceTemplateHistoryCmd shows the lineage of an instance template.
+type InstanceTemplateHistoryCmd struct {
+ Targets []string `arg:"" name:"target" completion-predictor:"resource-key-instance-template" help:"Target templates to show the lineage of."`
+
+ InstanceHistoryOpts
+}
+
+func (cmd InstanceTemplateHistoryCmd) Help() string {
+ return "Show the whole lineage tree of an instance template: every instance, template and checkpoint in it." + lineageHelp
+}
+
+func (cmd InstanceTemplateHistoryCmd) Examples() []kingkong.Example {
+ return []kingkong.Example{
+ {
+ Description: "Show the lineage of a template",
+ Commands: []string{"unikraft instance template history my-template"},
+ },
+ {
+ Description: "Show the lineage with the UUID of each node",
+ Commands: []string{"unikraft instance template history my-template -f +uuid"},
+ },
+ }
+}
+
+func (c *InstanceTemplateHistoryCmd) Run(ctx context.Context, stdio xstdio.Stdio) error {
+ found, err := InstanceTemplate{}.Get(ctx, c.Targets)
+ return runInstanceHistory(ctx, stdio, c.InstanceHistoryOpts, c.Targets, found, err)
+}
diff --git a/internal/cmd/instances.go b/internal/cmd/instances.go
index 2da4b35bb..f6ab25ae9 100644
--- a/internal/cmd/instances.go
+++ b/internal/cmd/instances.go
@@ -60,7 +60,7 @@ type InstancesCmd struct {
Suspend InstancesSuspendCmd `cmd:"" help:"Suspend one or more instances."`
Restart InstancesRestartCmd `cmd:"" help:"Restart one or more instances."`
Tunnel InstancesTunnelCmd `cmd:"" aliases:"port-forward" help:"Forward a local port to an unexposed instance."`
- History InstanceHistoryCmd `cmd:"" help:"Show checkpoint history for an instance."`
+ History InstanceHistoryCmd `cmd:"" help:"Show the lineage of an instance."`
Shell ShellSandboxInstanceCmd `cmd:"" aliases:"sh" help:"Open an interactive shell on a sandbox instance."`
Exec ExecSandboxInstanceCmd `cmd:"" help:"Execute a command on a sandbox instance."`
@@ -116,9 +116,10 @@ type Instance struct {
State types.InstanceState `mirror:"instance.state" field:",short" edit:"set" help:"Lifecycle state: stopped, starting, running, draining (finishing requests before a stop), stopping, standby (scaled to zero, woken by traffic), template, checkpoint or deleted. Setting stopped on edit stops a running instance." example:"stopped"`
- Image types.ImageRef `mirror:"instance.image" field:",short" create:"set" edit:"set" flag:"image" help:"Image to deploy, as an OCI reference or a full registry URL. On create, required unless template, branch or checkpoint is given, and cannot be combined with them." placeholder:":]