| # 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. |
| |
| timeout: 21600s |
| |
| steps: |
| # Step: build the fully loaded container using rules_docker |
| - name: 'gcr.io/cloud-builders/bazel' |
| # 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: ['--output_base=/workspace', 'run' , '--verbose_failures', '--spawn_strategy=standalone', '--genrule_strategy=standalone', '//${_DIR}:toolchain'] |
| id: 'container-build' |
| waitFor: |
| - "-" # wait for nothing - start immediately |
| |
| # Step: re-tag the image |
| - name: gcr.io/cloud-builders/docker |
| args: ['tag', 'bazel/${_DIR}:toolchain', 'gcr.io/${_PROJECT}/${_CONTAINER}:${_TAG}'] |
| id: 'container-tag' |
| waitFor: # wait for all artifacts to be ready |
| - 'container-build' |
| |
| # Step: test the image |
| - name: gcr.io/gcp-runtimes/structure_test |
| args: [ |
| '--image', 'gcr.io/${_PROJECT}/${_CONTAINER}:${_TAG}', |
| '--config', '/workspace/container/test/rbe-${_DISTRO}.yaml'] |
| |
| # Step: store the tarball of debian packages in GCS |
| - name: gcr.io/cloud-builders/gsutil |
| args: ['cp', |
| '/workspace/bazel-out/k8-fastbuild/bin/${_DIR}/toolchain-packages.tar', |
| 'gs://${_BUCKET}/${_CONTAINER}-${_TAG}-${BUILD_ID}.tar' |
| ] |
| |
| # Build the release-container |
| images: |
| - 'gcr.io/${_PROJECT}/${_CONTAINER}:${_TAG}' |