Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: lima-vm/lima
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: e5a135d9261143866902f819fc48fedb6ec7a595
Choose a base ref
..
head repository: lima-vm/lima
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: cdb77320ea86c896c52bbbd69393a192331364b3
Choose a head ref
Showing with 29 additions and 2 deletions.
  1. +1 −0 examples/default.yaml
  2. +1 −1 examples/docker-rootful.yaml
  3. +1 −1 examples/docker.yaml
  4. +26 −0 pkg/limayaml/validate_test.go
1 change: 1 addition & 0 deletions examples/default.yaml
Original file line number Diff line number Diff line change
@@ -235,6 +235,7 @@ containerd:
# playbook: playbook.yaml

# Probe scripts to check readiness.
# The scripts can use the following template variables: {{.Home}}, {{.UID}}, {{.User}}, and {{.Param.Key}}
# 🟢 Builtin default: null
# probes:
# # Only `readiness` probes are supported right now.
2 changes: 1 addition & 1 deletion examples/docker-rootful.yaml
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@
# $ export DOCKER_HOST=$(limactl list docker-rootful --format 'unix://{{.Dir}}/sock/docker.sock')
# $ docker ...

# This template requires Lima v1.0.0 or later
# This template requires Lima v0.23.0 or later
images:
# Try to use release-yyyyMMdd image if available. Note that release-yyyyMMdd will be removed after several months.
- location: "https://cloud-images.ubuntu.com/releases/24.04/release-20240423/ubuntu-24.04-server-cloudimg-amd64.img"
2 changes: 1 addition & 1 deletion examples/docker.yaml
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@
# $ export DOCKER_HOST=$(limactl list docker --format 'unix://{{.Dir}}/sock/docker.sock')
# $ docker ...

# This template requires Lima v1.0.0 or later
# This template requires Lima v0.23.0 or later
images:
# Try to use release-yyyyMMdd image if available. Note that release-yyyyMMdd will be removed after several months.
- location: "https://cloud-images.ubuntu.com/releases/24.04/release-20240423/ubuntu-24.04-server-cloudimg-amd64.img"
26 changes: 26 additions & 0 deletions pkg/limayaml/validate_test.go
Original file line number Diff line number Diff line change
@@ -50,4 +50,30 @@ func TestValidateParamIsUsed(t *testing.T) {
//
assert.NilError(t, err)
}

// use "{{if .Param.rootful \"true\"}}{{else}}{{end}}"" in provision, probe, copyToHost, and portForward
rootfulYaml := `param:
rootful: true`
fieldsUsingIfParamRootfulTrue := []string{
`provision: [{"script": "echo {{if eq .Param.rootful \"true\"}}rootful{{else}}rootless{{end}}"}]`,
`probes: [{"script": "echo {{if eq .Param.rootful \"true\"}}rootful{{else}}rootless{{end}}"}]`,
`copyToHost: [{"guest": "/tmp/{{if eq .Param.rootful \"true\"}}rootful{{else}}rootless{{end}}", "host": "/tmp"}]`,
`copyToHost: [{"guest": "/tmp", "host": "/tmp/{{if eq .Param.rootful \"true\"}}rootful{{else}}rootless{{end}}"}]`,
`portForwards: [{"guestSocket": "{{if eq .Param.rootful \"true\"}}/var/run{{else}}/run/user/{{.UID}}{{end}}/docker.sock", "hostSocket": "{{.Dir}}/sock/docker.sock"}]`,
`portForwards: [{"guestSocket": "/var/run/docker.sock", "hostSocket": "{{.Dir}}/sock/docker-{{if eq .Param.rootful \"true\"}}rootfule{{else}}rootless{{end}}.sock"}]`,
}
for _, fieldUsingIfParamRootfulTrue := range fieldsUsingIfParamRootfulTrue {
_, err = Load([]byte(fieldUsingIfParamRootfulTrue+"\n"+rootfulYaml), "paramIsUsed.yaml")
//
assert.NilError(t, err)
}

// use rootFul instead of rootful
rootFulYaml := `param:
rootFul: true`
for _, fieldUsingIfParamRootfulTrue := range fieldsUsingIfParamRootfulTrue {
_, err = Load([]byte(fieldUsingIfParamRootfulTrue+"\n"+rootFulYaml), "paramIsUsed.yaml")
//
assert.Error(t, err, "field `param` key \"rootFul\" is not used in any provision, probe, copyToHost, or portForward")
}
}