Skip to content

Instantly share code, notes, and snippets.

@petomalina
Created August 9, 2018 20:44
Show Gist options
  • Save petomalina/bf893269a7223dd95e4a2e92aeba4aa2 to your computer and use it in GitHub Desktop.
Save petomalina/bf893269a7223dd95e4a2e92aeba4aa2 to your computer and use it in GitHub Desktop.
Accelerating golang CI builds with GOCACHE and Cloud Storage
steps:
- name: gcr.io/cloud-builders/gsutil
args: ['-m', '-q', 'cp', 'gs://your-caching-bucket/cache.tar.gz', '/workspace']
- name: ubuntu
entrypoint: '/bin/bash'
args: ['-c', 'tar -xf cache.tar.gz']
- name: ubuntu
entrypoint: '/bin/bash'
args: ['-c', 'mkdir bin']
- name: golang:rc
entrypoint: 'go'
args: ['install', '-installsuffix', 'cgo', './...']
env:
- 'GOCACHE=/workspace/.cache'
- 'CGO_ENABLED=0'
- 'GOOS=linux'
- name: ubuntu
entrypoint: '/bin/bash'
args: ['-c', 'tar -cf cache.tar.gz .cache']
- name: gcr.io/cloud-builders/gsutil
args: ['-m', '-q', 'cp', '/workspace/cache.tar.gz', 'gs://your-caching-bucket']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment