Skip to content
This repository was archived by the owner on Mar 27, 2024. It is now read-only.

Add a cloudbuild.yaml trigger for container-diff releases. #125

Merged
merged 1 commit into from
Oct 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Dockerfile.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Dockerfile used to build a build step that builds container-diff in CI.
FROM golang:1.9
RUN apt-get update && apt-get install make
RUN mkdir -p /go/src/github.com/GoogleCloudPlatform/
RUN ln -s /workspace /go/src/github.com/GoogleCloudPlatform/container-diff
WORKDIR /go/src/github.com/GoogleCloudPlatform/container-diff
10 changes: 10 additions & 0 deletions cloudbuild.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
steps:
# Build the container that will do the go build.
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '-t', 'builder', '-f', 'Dockerfile.build', '.']
# Do the go build.
- name: 'builder'
args: ['make', 'cross']
# Upload to GCS.
- name: 'gcr.io/cloud-builders/gsutil'
args: ['cp', '-r', 'out/*', 'gs://container-diff/builds/$COMMIT_SHA/']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worthwhile to have a tag-watcher cloudbuild too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, what's a tag-watcher?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lol sorry - "trigger" was the word I was looking for. Not sure where I got "tag-watcher"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still not following... :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My plan was to submit this then setup a trigger in the UI to run this for every commit to master. Is that what you're asking for?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was just suggesting that you add another cloudbuild.yaml using the same dockerfile, but triggered only when new tags are pushed (instead of every commit), with the step being slightly different:

args: ['cp', '-r', 'out/*', 'gs://container-diff/releases/$TAG_NAME/']

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think thats what @nkubala was planning to do eventually?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I think we had originally talked about adding that. that way we can have the actual releases automated for us as well, as soon as the Github release gets published we get the binaries uploaded to the correct directories. we might also consider adding a

args: ['cp', '-r', 'out/*', 'gs://container-diff/releases/latest/']

to that cloudbuild (to release the newest tag as latest), though we might want to have that in a different job so we can do rollbacks easily.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yeah. I was thinking we'd have a separate release job to tag "latest" here.