Skip to content

Commit

Permalink
Fix go build and include ssh commands
Browse files Browse the repository at this point in the history
  • Loading branch information
tlbdk committed Nov 14, 2019
1 parent 760702d commit 7debf5d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ RUN go version

ENV GO111MODULE=on

RUN CGO_ENABLED=0 GOOS=linux go build -ldflags "-X 'main.versionString=$VERSION'" ./cmd
RUN CGO_ENABLED=0 GOOS=linux go build -o auth-wrapper -ldflags "-X 'main.versionString=$VERSION'" ./cmd

# Production image
FROM gcr.io/cloud-builders/docker as production
Expand All @@ -23,7 +23,7 @@ ARG SSH_KEY_PATH=/build.pem

WORKDIR /app

COPY --from=builder /app/cmd /opt/auth-wrapper
COPY --from=builder /app/auth-wrapper /opt/auth-wrapper

COPY build.pem /
RUN chmod 600 /build.pem
Expand Down
4 changes: 2 additions & 2 deletions cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ steps:
args: ['-c', 'docker build --tag="gcr.io/$PROJECT_ID/$REPO_NAME.$BRANCH_NAME:$COMMIT_SHA" --tag="gcr.io/$PROJECT_ID/$REPO_NAME.$BRANCH_NAME:latest" --file=Dockerfile .']
# Test cloud build wrapper using ssh key embedded in the container
- name: 'gcr.io/$PROJECT_ID/$REPO_NAME.$BRANCH_NAME:$COMMIT_SHA'
args: ['build', '.']
args: ['build', '--progress=plain', '--ssh=default=$SSH_AUTH_SOCK', '.']
dir: 'testdata'
secretEnv:
- 'SSH_KEY_PASSWORD'
Expand All @@ -32,7 +32,7 @@ steps:
- "DOCKER_BUILDKIT=1"
# Test cloud build wrapper using KSM key
- name: 'gcr.io/$PROJECT_ID/$REPO_NAME.$BRANCH_NAME:$COMMIT_SHA'
args: ['build', '.']
args: ['build', '--progress=plain', '--ssh=default=$SSH_AUTH_SOCK', '.']
dir: 'testdata'
env:
- "SSH_KEY_PATH=kms://projects/connectedcars-staging/locations/global/keyRings/cloudbuilder/cryptoKeys/ssh-key/cryptoKeyVersions/3"
Expand Down

0 comments on commit 7debf5d

Please sign in to comment.