blob: 35fb716e29c7418f7b8cd33645918590311aabe6 [file] [log] [blame]
# 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.yaml.
# ==========================================================
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',
'//${_PACKAGE}:${_TARGET}'
]
id: 'container-build'
waitFor:
- "-" # wait for nothing - start immediately
# Step: re-tag the image
- name: gcr.io/cloud-builders/docker
args: ['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/cloud-builders/bazel'
args: [
'--output_base=/workspace',
'test',
'--test_output=all',
'--verbose_failures',
'--spawn_strategy=standalone',
'--genrule_strategy=standalone',
'//${_PACKAGE}:${_TARGET}-test'
]
# Build the release-container
images:
- 'gcr.io/${_PROJECT}/${_CONTAINER}:${_TAG}'