Skip to content

Conversation

@johnkraczek
Copy link
Contributor

@johnkraczek johnkraczek commented Jul 18, 2023

Fixes #402

Setting the ssh: forwardAgent: true in the lima config allows the agent to be forwarded.
If you are good with that being the default then that's all that is needed.

@swalkinshaw
Copy link
Member

I'm good with this being the default. I can't see why we'd want it be disabled but we can always make it configurable in the future 👍

@johnkraczek there's a test that needs to be updated as well:

func TestCreateConfig(t *testing.T) {
defer trellis.LoadFixtureProject(t)()
trellis := trellis.NewTrellis()
if err := trellis.LoadProject(); err != nil {
t.Fatal(err)
}
dir := t.TempDir()
configFile := filepath.Join(dir, "lima.yaml")
instance := &Instance{
Dir: dir,
ConfigFile: configFile,
Config: Config{
Images: []Image{
{
Location: "http://ubuntu.com/focal",
Arch: "aarch64",
},
},
PortForwards: []PortForward{
{
HostPort: 1234,
GuestPort: 80,
},
},
},
Sites: trellis.Environments["development"].WordPressSites,
}
err := instance.CreateConfig()
if err != nil {
t.Fatal(err)
}
content, err := os.ReadFile(configFile)
if err != nil {
t.Fatal(err)
}
absSitePath := filepath.Join(trellis.Path, "../site")
expected := fmt.Sprintf(`vmType: "vz"
rosetta:
enabled: false
images:
- location: http://ubuntu.com/focal
arch: aarch64
mounts:
- location: %s
mountPoint: /srv/www/example.com/current
writable: true
mountType: "virtiofs"
networks:
- vzNAT: true
portForwards:
- guestPort: 80
hostPort: 1234
containerd:
user: false
provision:
- mode: system
script: |
#!/bin/bash
echo "127.0.0.1 $(hostname)" >> /etc/hosts
`, absSitePath)
if string(content) != expected {
t.Errorf("expected %s\ngot %s", expected, string(content))
}
}

The expected output needs to have the new ssh entry

@swalkinshaw swalkinshaw merged commit 8086450 into roots:master Jul 18, 2023
@swalkinshaw
Copy link
Member

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

trellis vm shell doesn't forward ssh agent

2 participants