From 216da0b733dbed9aad9b2ab92ac75bcb906fd7ee Mon Sep 17 00:00:00 2001 From: Adin Scannell Date: Sat, 1 Jun 2019 23:09:26 -0700 Subject: Add tooling for Go-compatible branch. The WORKSPACE go_repositories can be generated from a standard go.mod file. Add the necessary gazelle hooks to do so, and include a test that sanity checks there are no changes. This go.mod file will be used in a subsequent commit to generate a go gettable branch of the repository. This commit also adds a tools/go_branch.sh script, which given an existing go branch in the repository, will add an additional synthetic change to the branch bringing it up-to-date with HEAD. As a final step, a cloudbuild script is included, which can be used to automate the process for every change pushed to the repository. This may be used after an initial go branch is pushed, but this is manual process. PiperOrigin-RevId: 251095016 --- cloudbuild/go.Dockerfile | 2 ++ cloudbuild/go.yaml | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 cloudbuild/go.Dockerfile create mode 100644 cloudbuild/go.yaml (limited to 'cloudbuild') diff --git a/cloudbuild/go.Dockerfile b/cloudbuild/go.Dockerfile new file mode 100644 index 000000000..226442fd2 --- /dev/null +++ b/cloudbuild/go.Dockerfile @@ -0,0 +1,2 @@ +FROM ubuntu +RUN apt-get -q update && apt-get install -qqy git rsync diff --git a/cloudbuild/go.yaml b/cloudbuild/go.yaml new file mode 100644 index 000000000..23dbf524e --- /dev/null +++ b/cloudbuild/go.yaml @@ -0,0 +1,20 @@ +steps: +- name: 'gcr.io/cloud-builders/git' + args: ['fetch', '--all', '--unshallow'] +- name: 'gcr.io/cloud-builders/bazel' + args: ['build', ':gopath'] +- name: 'gcr.io/cloud-builders/docker' + args: ['build', '-t', 'gcr.io/$PROJECT_ID/go-branch', '-f', 'cloudbuild/go.Dockerfile', '.'] +- name: 'gcr.io/$PROJECT_ID/go-branch' + args: ['tools/go_branch.sh'] +- name: 'gcr.io/cloud-builders/git' + args: ['checkout', 'go'] +- name: 'gcr.io/cloud-builders/git' + args: ['clean', '-f'] +- name: 'golang' + args: ['go', 'build', './...'] +- name: 'gcr.io/cloud-builders/git' + entrypoint: 'bash' + args: + - '-c' + - 'if [[ "$BRANCH_NAME" == "master" ]]; then git push origin go:go; fi' -- cgit v1.2.3