This repository was archived by the owner on Dec 11, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change 2626 - name : DIRECTORY
2727 description : The subdirectory of the workspace/repo
2828 default : " "
29+ - name : SSH_KEY
30+ description : Name of ssh key file to authenticate in private git repository
31+ default : git-ssh-key
2932 steps :
3033 - name : dockerfile
3134 image : gcr.io/kaniko-project/executor@sha256:30ba460a034a8051b3222a32e20cb6049741e58384e3adf8c8987c004e2f2ab9
@@ -36,16 +39,23 @@ spec:
3639 - |
3740 cd /workspace/${DIRECTORY}
3841 cat <<EOF > Dockerfile
39- FROM golang:alpine
40- RUN apk --no-cache add git ca-certificates \
42+ FROM golang:alpine
43+ # Skip known public key check to be able to pull from private repositories
44+ ENV GIT_SSH_COMMAND "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
45+ RUN apk --no-cache add git ca-certificates openssh \
4146 && go get github.com/triggermesh/aws-custom-runtime \
4247 && go get github.com/triggermesh/knative-lambda-runtime/go-1.x \
4348 && go get github.com/golang/dep/...
4449
4550 WORKDIR /go/src/handler
4651 COPY . .
47- RUN if [ -f "Gopkg.toml" ]; then dep ensure; fi
48- RUN go get -v && go install
52+ RUN if [ -f "$HOME/.ssh/id_$SSH_KEY" ]; then \
53+ eval "\$(ssh-agent -s)"; \
54+ ssh-add $HOME/.ssh/id_$SSH_KEY; \
55+ fi \
56+ && if [ -f "Gopkg.toml" ]; then dep ensure; fi \
57+ && go get -v \
58+ && go install
4959
5060 FROM alpine
5161 WORKDIR /opt
You can’t perform that action at this time.
0 commit comments