-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(containers): container builds use GCS for cache storage (#14)
* refactor(containers): container builds use GCS for cache storage This makes a few changes: 1. Before the compilation, we pull down a $repo-$branch.tgz file and uncompress it (e.g. igor-master.tgz or rosco-release-1.17.x.tgz) to the /workspace volume 2. The Dockerfile.compile image is now expected to be a build step. This means we can run the container and it will compile files on the /workspace volume. Currently, we copy all the files into the container, compile them there, and then have to copy them back out. This new method is more along the lines with how GCB is supposed to work, but it does mean every Dockerfile.compile has to be changed to use CMD instead of RUN. 3. After the compile, we tar up .gradle/caches and .gradle/wrapper to $repo-$branch.tgz and send it to gs://spinnaker-build-cache. This storage bucket is set to auto-delete files that haven't been modified in 14 days. Removing our dependence on the `gradle_cache` image means that the various microservices can define their own compile image with different build tool configurations. I'd really like to have this for the Java 11 migration. It also means we could move the Debian builds into Cloud Build, since we aren't depending on them to produce that `gradle_cache` artifact. * refactor(containers): make the cache bucket configurable * fix(containers): use {save,restore}_cache from the build project
- Loading branch information
Showing
6 changed files
with
83 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
## Google Cloud Build files | ||
|
||
The `containers-build-java8` and `containers-tag-java8` files are | ||
[Google Cloud Build build configurations](https://cloud.google.com/cloud-build/docs/build-config) | ||
for building the Spinnaker microservices. | ||
|
||
In order to use them, there must be a `save_cache` and `restore_cache` image in | ||
the Google Container Registry of the project in which the configurations are | ||
executed. You can create those images with the `build-steps.yml` file: | ||
|
||
``` | ||
gcloud builds submit --config=build-steps.yml --project=spinnaker-community . | ||
``` | ||
|
||
The source for these images is the | ||
[cloud-builders-community repository](https://github.com/GoogleCloudPlatform/cloud-builders-community/tree/master/cache). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# This file publishes the images that are used by containers-*.yml. It should be | ||
# run manually to create these images. | ||
steps: | ||
- id: fetchCachingRepo | ||
waitFor: ["-"] | ||
name: gcr.io/cloud-builders/git | ||
args: ["clone", "https://github.com/GoogleCloudPlatform/cloud-builders-community"] | ||
# The caching repo contains its own cloud build file which will publish 'save_cache' and 'restore_cache' images. | ||
- id: buildCachingRepo | ||
waitFor: ["fetchCachingRepo"] | ||
name: gcr.io/cloud-builders/gcloud | ||
args: ["builds", "submit", "--config", "cloud-builders-community/cache/cloudbuild.yaml", "cloud-builders-community/cache"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters