diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index c8df9123..5782f704 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -72,7 +72,7 @@ jobs: OS=Linux ARCH=aarch64 make - name: upload artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: artifacts-linux path: _output/binaries/ @@ -95,7 +95,7 @@ jobs: CGO_ENABLED=1 OS=Darwin ARCH=arm64 make - name: upload artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: artifacts-macos path: _output/binaries/ @@ -107,11 +107,11 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: artifacts-linux path: _output/binaries/ - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: artifacts-macos path: _output/binaries/ diff --git a/environment/vm/lima/lima.go b/environment/vm/lima/lima.go index abd5488c..815b9235 100644 --- a/environment/vm/lima/lima.go +++ b/environment/vm/lima/lima.go @@ -32,7 +32,7 @@ func New(host environment.HostActions) environment.VM { var envs []string envHome := limautil.EnvLimaHome + "=" + limaHome envLimaInstance := envLimaInstance + "=" + config.CurrentProfile().ID - envSSHForward := "LIMA_SSH_PORT_FORWARDER=true" + envSSHForward := envLimaSSHForwarder + "=" + osutil.EnvVar(envLimaSSHForwarder).ValOr("true") envBinary := osutil.EnvColimaBinary + "=" + osutil.Executable() envs = append(envs, envHome, envLimaInstance, envSSHForward, envBinary) @@ -46,9 +46,10 @@ func New(host environment.HostActions) environment.VM { } const ( - envLimaInstance = "LIMA_INSTANCE" - lima = "lima" - limactl = limautil.LimactlCommand + envLimaInstance = "LIMA_INSTANCE" + envLimaSSHForwarder = "LIMA_SSH_PORT_FORWARDER" + lima = "lima" + limactl = limautil.LimactlCommand ) var _ environment.VM = (*limaVM)(nil) diff --git a/util/osutil/os.go b/util/osutil/os.go index 220f7480..f16a5bd3 100644 --- a/util/osutil/os.go +++ b/util/osutil/os.go @@ -31,6 +31,14 @@ func (e EnvVar) Val() string { return os.Getenv(string(e)) } +// Or returns the environment variable value if set, otherwise returns val. +func (e EnvVar) ValOr(val string) string { + if v := os.Getenv(string(e)); v != "" { + return v + } + return val +} + const EnvColimaBinary = "COLIMA_BINARY" // Executable returns the path name for the executable that started