provider: Grok and Devin install in the Docker image again: a vendor's shell one-liner needs curl, which the image (bash and busybox wget since 7bfe3137) doesn't have, so the native installer runs there
ghcr.io/yetone/magpie:latest has /bin/bash and /bin/wget but no curl, so shellInstallerRuns said yes and `curl … | bash` failed. TestShellInstallerNeedsCurl fails on the old check.
This commit is contained in:
@@ -145,19 +145,18 @@ func runUntilInstalled(ctx context.Context, cmd *exec.Cmd, c agentCLI) ([]byte,
|
||||
}
|
||||
|
||||
// shellInstallerRuns is whether a vendor's `curl … | bash` can run here:
|
||||
// bash, and curl or wget for it to download with. magpie's Docker image
|
||||
// (distroless) has none of them, and the install failed there with "exec:
|
||||
// bash: not found". A var so tests can say there is none.
|
||||
// bash, and curl, which every one-liner (and the scripts behind them)
|
||||
// downloads with. magpie's Docker image had none of them, and the install
|
||||
// failed there with "exec: bash: not found". Since 7bfe3137 it has bash and
|
||||
// busybox's wget but still no curl, and the one-liner failed there too. A
|
||||
// var so tests can say there is none.
|
||||
var shellInstallerRuns = func() bool {
|
||||
if _, err := exec.LookPath("bash"); err != nil {
|
||||
return false
|
||||
}
|
||||
for _, d := range []string{"curl", "wget"} {
|
||||
if _, err := exec.LookPath(d); err == nil {
|
||||
return true
|
||||
for _, p := range []string{"bash", "curl"} {
|
||||
if _, err := exec.LookPath(p); err != nil {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return false
|
||||
return true
|
||||
}
|
||||
|
||||
// installCLI installs c with its vendor's installer and makes sure magpie
|
||||
|
||||
@@ -186,3 +186,23 @@ func waitPast(t *testing.T, id, state string) SignInState {
|
||||
t.Fatalf("still %s", state)
|
||||
return SignInState{}
|
||||
}
|
||||
|
||||
// magpie's Docker image has bash and busybox's wget but no curl, which every
|
||||
// vendor's one-liner downloads with: there the native installer is used
|
||||
func TestShellInstallerNeedsCurl(t *testing.T) {
|
||||
if runtime.GOOS == "windows" {
|
||||
t.Skip("the shell installer is for macOS and Linux")
|
||||
}
|
||||
bin := t.TempDir()
|
||||
for _, p := range []string{"bash", "wget"} {
|
||||
testenv.Program(t, filepath.Join(bin, p), "#!/bin/sh\n")
|
||||
}
|
||||
t.Setenv("PATH", bin)
|
||||
if shellInstallerRuns() {
|
||||
t.Fatal("the shell installer runs with bash and wget, without curl")
|
||||
}
|
||||
testenv.Program(t, filepath.Join(bin, "curl"), "#!/bin/sh\n")
|
||||
if !shellInstallerRuns() {
|
||||
t.Fatal("the shell installer doesn't run with bash and curl")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user