| # Copyright 2017 The Bazel Authors. All rights reserved. |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); |
| # you may not use this file except in compliance with the License. |
| # You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| |
| # ==================================================================== |
| # This yaml file should be kept synced with cloudbuild_no_bucket.yaml. |
| # ==================================================================== |
| |
| timeout: 21600s |
| |
| steps: |
| # Step: print the bazel version for confirmation |
| - name: 'gcr.io/asci-toolchain/nosla-ubuntu16_04-bazel-docker-gcloud:${_BAZEL_VERSION}' |
| args: |
| - 'bazel' |
| - 'version' |
| id: 'version' |
| waitFor: |
| - "-" # wait for nothing - start immediately |
| |
| # Step: build the fully loaded container using rules_docker |
| - name: 'gcr.io/asci-toolchain/nosla-ubuntu16_04-bazel-docker-gcloud:${_BAZEL_VERSION}' |
| # Set Bazel output_base to /workspace, which is a mounted directory on Google Cloud Builder. |
| # This is to make sure Bazel generated files can be accessed by multiple containers. |
| args: [ |
| 'bazel', |
| '--output_base=/workspace', |
| 'run' , |
| '--verbose_failures', |
| '--spawn_strategy=standalone', |
| '--genrule_strategy=standalone', |
| '//${_PACKAGE}:${_TARGET}' |
| ] |
| id: 'container-build' |
| waitFor: |
| - 'version' |
| |
| # Step: re-tag the image |
| - name: 'gcr.io/asci-toolchain/nosla-ubuntu16_04-bazel-docker-gcloud:${_BAZEL_VERSION}' |
| args: ['docker', 'tag', 'bazel/${_PACKAGE}:${_TARGET}', 'gcr.io/${_PROJECT}/${_CONTAINER}:${_TAG}'] |
| id: 'container-tag' |
| waitFor: # wait for all artifacts to be ready |
| - 'container-build' |
| |
| # Step: test the image |
| # We use container_test rule, which is a Bazel wrapper of container_structure_test. |
| # https://github.com/bazelbuild/rules_docker/blob/master/contrib/test.bzl |
| - name: 'gcr.io/asci-toolchain/nosla-ubuntu16_04-bazel-docker-gcloud:${_BAZEL_VERSION}' |
| args: [ |
| 'bazel', |
| '--output_base=/workspace', |
| 'test', |
| '--test_output=all', |
| '--verbose_failures', |
| '--spawn_strategy=standalone', |
| '--genrule_strategy=standalone', |
| '//${_PACKAGE}:${_TARGET}-test' |
| ] |
| id: 'image-test' |
| waitFor: |
| - 'container-build' |
| |
| # Step: store the tarball of debian packages in GCS |
| - name: 'gcr.io/asci-toolchain/nosla-ubuntu16_04-bazel-docker-gcloud:${_BAZEL_VERSION}' |
| args: ['gsutil', |
| 'cp', |
| '/workspace/bazel-out/k8-fastbuild/bin/${_PACKAGE}/${_TARBALL}', |
| 'gs://${_BUCKET}/${_CONTAINER}-${_TAG}-${BUILD_ID}.tar' |
| ] |
| id: 'upload-debs' |
| waitFor: |
| - 'image-test' |
| |
| # Build the release-container |
| images: |
| - 'gcr.io/${_PROJECT}/${_CONTAINER}:${_TAG}' |