Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
- name: Test the container project
run: |
launchctl setenv HTTP_PROXY $HTTP_PROXY
make test integration
make test cleancontent install-kernel integration
env:
CONTAINER_REGISTRY_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CONTAINER_REGISTRY_USER: ${{ github.actor }}
Expand Down
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,18 @@ dsym:
test:
@$(SWIFT) test -c $(BUILD_CONFIGURATION) $(CURRENT_SDK_ARGS) --skip TestCLI

.PHONY: install-kernel
install-kernel:
@bin/container system stop || true
@bin/container system start --enable-kernel-install

.PHONY: integration
integration: cleancontent init-block
integration: init-block
@echo Ensuring apiserver stopped before the CLI integration tests...
@bin/container system stop
@scripts/ensure-container-stopped.sh
@echo Running the integration tests...
@bin/container system start --install-dependencies
@bin/container system start
@echo "Removing any existing containers"
@bin/container rm --all
@echo "Starting CLI integration tests"
Expand Down
17 changes: 12 additions & 5 deletions Sources/CLI/System/SystemStart.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ extension Application {
@Flag(name: .long, help: "Enable debug logging for the runtime daemon.")
var debug = false

@Flag(name: .long, help: "Do not prompt for confirmation before installing runtime dependencies")
var installDependencies: Bool = false
@Flag(name: .long, inversion: .prefixedEnableDisable, help: "Specify if the default kernel should be installed or not.")
var kernelInstall: Bool?

func run() async throws {
// Without the true path to the binary in the plist, `container-apiserver` won't launch properly.
Expand Down Expand Up @@ -110,16 +110,23 @@ extension Application {
let defaultKernelURL = kernelDependency.source
let defaultKernelBinaryPath = ClientDefaults.get(key: .defaultKernelBinaryPath)

print("No default kernel configured.")
print("Install the recommended default kernel from [\(kernelDependency.source)]? [Y/n]: ", terminator: "")
if !installDependencies {
var shouldInstallKernel = false
Copy link
Contributor

@jglogan jglogan Jun 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a discussion for a follow-up maybe:

Better to assume --enable-kernel-install or --disable-kernel-install if system start isn't run from an interactive terminal?

My feeling is that that is too magical. It's simpler to have it just as it is now, with yes/no/default to interactive, and that the following sort of usage is accepted (though flags would be the recommended approach):

echo y | container system start

if kernelInstall == nil {
print("No default kernel configured.")
print("Install the recommended default kernel from [\(kernelDependency.source)]? [Y/n]: ", terminator: "")
guard let read = readLine(strippingNewline: true) else {
throw ContainerizationError(.internalError, message: "Failed to read user input")
}
guard read.lowercased() == "y" || read.count == 0 else {
print("Please use the `container system kernel set --recommended` command to configure the default kernel")
return
}
shouldInstallKernel = true
} else {
shouldInstallKernel = kernelInstall ?? false
}
guard shouldInstallKernel else {
return
}
print("Installing kernel...")
try await KernelSet.downloadAndInstallWithProgressBar(tarRemoteURL: defaultKernelURL, kernelFilePath: defaultKernelBinaryPath)
Expand Down