Fix authorization for continuous integration.

The credentials must be explicitly refreshed for pushing to
the repository on the Go branch.

PiperOrigin-RevId: 268589817
This commit is contained in:
Adin Scannell
2019-09-11 18:48:26 -07:00
committed by gVisor bot
parent f52dd451ed
commit c06ef5131f
2 changed files with 23 additions and 0 deletions
+14
View File
@@ -1,5 +1,19 @@
build_file: "repo/scripts/go.sh"
before_action {
fetch_keystore {
keystore_resource {
keystore_config_id: 73898
keyname: "kokoro-github-access-token"
}
}
}
env_vars {
key: "KOKORO_GITHUB_ACCESS_TOKEN"
value: "$KOKORO_ROOT/src/keystore/73898_kokoro-github-access-token"
}
env_vars {
key: "KOKORO_GO_PUSH"
value: "true"
+9
View File
@@ -30,5 +30,14 @@ go build ./...
# Push, if required.
if [[ "${KOKORO_GO_PUSH}" == "true" ]]; then
if [[ -v KOKORO_GITHUB_ACCESS_TOKEN ]]; then
git config --global credential.helper cache
git credential approve <<EOF
protocol=https
host=github.com
username=$(cat "${KOKORO_GITHUB_ACCESS_TOKEN}")
password=x-oauth-basic
EOF
fi
git push origin go:go
fi