Bake mise into default VM images
New VMs should have mise available without a per-VM bootstrap step, and the activation needs to work in the default root bash workflow. Install a pinned mise binary during both the Go-native image build path and the customize.sh rootfs rebuild path, then enable bash activation through /etc/profile.d for login shells and /etc/bash.bashrc for interactive shells. Add a regression around the generated provisioning script and validate with bash -n customize.sh, go test ./..., and make build. Rebuilding the default rootfs is still required before future default-image VMs pick up the change.
This commit is contained in:
parent
7b7f7e676c
commit
ff8482b841
3 changed files with 64 additions and 0 deletions
23
internal/daemon/imagebuild_test.go
Normal file
23
internal/daemon/imagebuild_test.go
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
package daemon
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestBuildProvisionScriptInstallsAndActivatesMise(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
script := buildProvisionScript("devbox", "1.1.1.1", []string{"git", "curl"}, false)
|
||||
for _, snippet := range []string{
|
||||
"curl -fsSL https://mise.run | MISE_INSTALL_PATH='/usr/local/bin/mise' MISE_VERSION='v2025.12.0' sh",
|
||||
"cat > /etc/profile.d/mise.sh <<'EOF'",
|
||||
"if [ -n \"${BASH_VERSION:-}\" ] && [ -x '/usr/local/bin/mise' ]; then",
|
||||
`eval "$(/usr/local/bin/mise activate bash)"`,
|
||||
`if ! grep -Fqx 'eval "$(/usr/local/bin/mise activate bash)"' '/etc/bash.bashrc'; then`,
|
||||
} {
|
||||
if !strings.Contains(script, snippet) {
|
||||
t.Fatalf("buildProvisionScript missing snippet %q\nscript:\n%s", snippet, script)
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue