Hello,
I am unable to do go get with private repo
steps:
- name: 'gcr.io/cloud-builders/gcloud'
args:
- kms
- decrypt
- --ciphertext-file=/workspace/cloudbuilder/git-credentials.enc
- --plaintext-file=/root/git/credentials
- --location=global
- --keyring=git-credential-keyring
- --key=git-credential-key
volumes:
- name: 'git'
path: /root/git
- name: 'gcr.io/cloud-builders/git'
args:
- 'config'
- '--global'
- 'credential.helper'
- 'store --file /root/git/credentials'
volumes:
- name: 'git'
path: /root/git
- name: 'gcr.io/cloud-builders/git'
args: ['config', '--global', '--list']
volumes:
- name: 'git'
path: /root/git
- name: 'golang:1.11.1-stretch'
entrypoint: 'go'
args: ['get', 'github.com/magefile/mage']
env: ['GO111MODULE=on','PROJECT_ROOT=currency-converter-srv']
volumes:
- name: 'git'
path: /root/git
Step #3: go: github.com/[email protected]: git fetch -f origin refs/heads/:refs/heads/ refs/tags/:refs/tags/ in /go/pkg/mod/cache/vcs/569e3ea2561086116509b66c09f85c91df49e46ec5a937e4a7fc3a8186594a54: exit status 128:Step #3: fatal: could not read Username for 'https://github.com': terminal prompts disabled
Please add openssh-client to go images so we can do a workaround like this
steps:
# Decrypt the github ssh key
- name: 'gcr.io/cloud-builders/gcloud'
args:
- kms
- decrypt
- --ciphertext-file=encrypted/github.enc
- --plaintext-file=/root/.ssh/id_rsa
- --location=global
- --keyring=github-keyring
- --key=github-key
volumes:
- name: 'ssh'
path: /root/.ssh
# Configure the ssh key
- name: 'gcr.io/cloud-builders/gcloud'
entrypoint: 'bash'
args:
- '-c'
- |
chmod 600 /root/.ssh/id_rsa
cat <<EOF >/root/.ssh/config
Hostname github.com
IdentityFile /root/.ssh/id_rsa
EOF
mv ssh/known_hosts /root/.ssh/known_hosts
volumes:
- name: 'ssh'
path: /root/.ssh
- name: 'gcr.io/cloud-builders/git'
entrypoint: 'bash'
args:
- '-c'
- |
git config --global url."ssh://[email protected]/xxxx/".insteadOf "https://github.com/xxxxx/"
volumes:
- name: 'ssh'
path: /root/.ssh
- name: 'gcr.io/cryptovalue-206001/go-builder'
entrypoint: 'ash' # because this is alpine
args:
- -c
- |
# following commands are executed by the real go step, so
# we replicate it here
. /builder/prepare_workspace.inc
prepare_workspace || exit
# Hey, let's print out the environment variables to
# see what's going on
env | sort
git config --global url."ssh://[email protected]/xxxxx/".insteadOf "https://github.com/xxxx/"
go get github.com/magefile/mage
env: ['HOME=/workspace', 'GIT_TRACE_SETUP=true', 'GO111MODULE=on', 'PROJECT_ROOT=github.com/xxxxx']
volumes:
- name: 'ssh'
path: /root/.ssh
closing as obsolete; see https://github.com/GoogleCloudPlatform/cloud-builders/issues/677
Most helpful comment
Please add openssh-client to go images so we can do a workaround like this