(t *testing.T)
| 144 | } |
| 145 | |
| 146 | func TestBuildSSH(t *testing.T) { |
| 147 | if runtime.GOOS == "windows" { |
| 148 | t.Skip("Running on Windows. Skipping...") |
| 149 | } |
| 150 | c := NewParallelCLI(t) |
| 151 | |
| 152 | t.Run("build failed with ssh default value", func(t *testing.T) { |
| 153 | res := c.RunDockerComposeCmdNoCheck(t, "--project-directory", "fixtures/build-test", "build", "--ssh", "") |
| 154 | res.Assert(t, icmd.Expected{ |
| 155 | ExitCode: 1, |
| 156 | Err: "invalid empty ssh agent socket: make sure SSH_AUTH_SOCK is set", |
| 157 | }) |
| 158 | }) |
| 159 | |
| 160 | t.Run("build succeed with ssh from Compose file", func(t *testing.T) { |
| 161 | c.RunDockerOrExitError(t, "rmi", "build-test-ssh") |
| 162 | |
| 163 | c.RunDockerComposeCmd(t, "--project-directory", "fixtures/build-test/ssh", "build") |
| 164 | c.RunDockerCmd(t, "image", "inspect", "build-test-ssh") |
| 165 | }) |
| 166 | |
| 167 | t.Run("build succeed with ssh from CLI", func(t *testing.T) { |
| 168 | c.RunDockerOrExitError(t, "rmi", "build-test-ssh") |
| 169 | |
| 170 | c.RunDockerComposeCmd(t, "-f", "fixtures/build-test/ssh/compose-without-ssh.yaml", "--project-directory", |
| 171 | "fixtures/build-test/ssh", "build", "--no-cache", "--ssh", "fake-ssh=./fixtures/build-test/ssh/fake_rsa") |
| 172 | c.RunDockerCmd(t, "image", "inspect", "build-test-ssh") |
| 173 | }) |
| 174 | |
| 175 | /* |
| 176 | FIXME disabled waiting for https://github.com/moby/buildkit/issues/5558 |
| 177 | t.Run("build failed with wrong ssh key id from CLI", func(t *testing.T) { |
| 178 | c.RunDockerOrExitError(t, "rmi", "build-test-ssh") |
| 179 | |
| 180 | res := c.RunDockerComposeCmdNoCheck(t, "-f", "fixtures/build-test/ssh/compose-without-ssh.yaml", |
| 181 | "--project-directory", "fixtures/build-test/ssh", "build", "--no-cache", "--ssh", |
| 182 | "wrong-ssh=./fixtures/build-test/ssh/fake_rsa") |
| 183 | res.Assert(t, icmd.Expected{ |
| 184 | ExitCode: 1, |
| 185 | Err: "unset ssh forward key fake-ssh", |
| 186 | }) |
| 187 | }) |
| 188 | */ |
| 189 | |
| 190 | t.Run("build succeed as part of up with ssh from Compose file", func(t *testing.T) { |
| 191 | c.RunDockerOrExitError(t, "rmi", "build-test-ssh") |
| 192 | |
| 193 | c.RunDockerComposeCmd(t, "--project-directory", "fixtures/build-test/ssh", "up", "-d", "--build") |
| 194 | t.Cleanup(func() { |
| 195 | c.RunDockerComposeCmd(t, "--project-directory", "fixtures/build-test/ssh", "down") |
| 196 | }) |
| 197 | c.RunDockerCmd(t, "image", "inspect", "build-test-ssh") |
| 198 | }) |
| 199 | } |
| 200 | |
| 201 | func TestBuildSecrets(t *testing.T) { |
| 202 | if runtime.GOOS == "windows" { |
nothing calls this directly
no test coverage detected