Skip to content

Commit

Permalink
fix buildkit-ssh test
Browse files Browse the repository at this point in the history
Signed-off-by: Rui Yang <[email protected]>
  • Loading branch information
Rui Yang committed Jun 21, 2021
1 parent 35fd63a commit b5c639e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions task_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"reflect"
"testing"

task "github.com/concourse/oci-build-task"
"github.com/google/go-containerregistry/pkg/name"
"github.com/google/go-containerregistry/pkg/registry"
v1 "github.com/google/go-containerregistry/pkg/v1"
Expand All @@ -19,7 +20,6 @@ import (
"github.com/google/go-containerregistry/pkg/v1/tarball"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
task "github.com/concourse/oci-build-task"
)

type TaskSuite struct {
Expand Down Expand Up @@ -116,7 +116,7 @@ func (s *TaskSuite) TestTarget() {

func (s *TaskSuite) TestBuildkitSSH() {
s.req.Config.ContextDir = "testdata/buildkit-ssh"
s.req.Config.BuildkitSSH = "my_ssh_key=./id_rsa_test"
s.req.Config.BuildkitSSH = "my_ssh_key=testdata/buildkit-ssh/id_rsa_test"

_, err := s.build()
s.NoError(err)
Expand Down
6 changes: 4 additions & 2 deletions testdata/buildkit-ssh/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# syntax = docker/dockerfile:1.0-experimental
FROM alpine

# shows secret from custom secret location:
RUN --mount=type=secret,id=my_ssh_key cat ./id_rsa_test
RUN apk add --no-cache openssh-client

# shows private key available in ssh agent
RUN --mount=type=ssh,id=my_ssh_key ssh-add -l | grep "SHA256:DFxHFuit9VQtxkBrZWzJhf5OTL5/RwzCJuZjTAPC1DI"

0 comments on commit b5c639e

Please sign in to comment.