mirror of
https://github.com/googleforgames/open-match.git
synced 2025-03-15 10:16:07 +00:00
199 lines
7.8 KiB
YAML
199 lines
7.8 KiB
YAML
# Copyright 2019 Google LLC
|
|
#
|
|
# 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.
|
|
|
|
################################################################################
|
|
# Open Match Script for Google Cloud Build #
|
|
################################################################################
|
|
|
|
# example command-line invocation:
|
|
# gcloud builds submit --config=cloudbuild.yaml --substitutions=_OM_VERSION=DEV .
|
|
|
|
# This YAML contains all the build steps for building Open Match.
|
|
# All PRs are verified against this script to prevent build breakages and regressions.
|
|
|
|
# Conventions
|
|
# Each build step is ID'ed with "Prefix: Description".
|
|
# The prefix portion determines what kind of step it is and it's impact.
|
|
# Docker Image: Read-Only, outputs a docker image.
|
|
# Lint: Read-Only, verifies correctness and formatting of a file.
|
|
# Build: Read-Write, outputs a build artifact. Ok to run in parallel if the artifact will not collide with another one.
|
|
# Generate: Read-Write, outputs files within /workspace that are used in other build step. Do not run these in parallel.
|
|
# Setup: Read-Write, similar to generate but steps that run before any other step.
|
|
|
|
# Some useful things to know about Cloud Build.
|
|
# When your build executes, Cloud Build copies the contents of your repository to /workspace, the default working directory for Cloud Build.
|
|
# Learn more about working directories on the Build configuration overview page https://cloud.google.com/build/docs/build-config-file-schema
|
|
# - Modifications that occur within /workspace are persisted between build steps.
|
|
# - If you want to replicate the build process from this file locally, you'll need to
|
|
# clone the open match github repo and set HEAD to the commit you're trying to build.
|
|
# If a build step has intermediate files that need to be persisted for a future step then use volumes.
|
|
# An example of this is the go-vol which is where the pkg/ data for go mod is stored.
|
|
# More information here: https://cloud.google.com/cloud-build/docs/build-config#build_steps
|
|
# A build step is basically a docker image that is tuned for Cloud Build,
|
|
# https://github.com/GoogleCloudPlatform/cloud-builders/tree/master/go
|
|
|
|
steps:
|
|
- id: 'Docker Image: open-match-build'
|
|
name: gcr.io/kaniko-project/executor:latest
|
|
args: [
|
|
"--destination=gcr.io/$PROJECT_ID/open-match-build",
|
|
"--dockerfile=Dockerfile.ci",
|
|
"--cache=true",
|
|
"--cache-ttl=3600h",
|
|
]
|
|
waitFor: ['-']
|
|
#name: gcr.io/cloud-builders/docker
|
|
#args: ['build', '-t', 'gcr.io/$PROJECT_ID/open-match-build', '-f', 'Dockerfile.ci', '.']
|
|
#waitFor: ['-']
|
|
|
|
- id: 'Build: Clean'
|
|
name: 'gcr.io/$PROJECT_ID/open-match-build'
|
|
args: ['make', 'clean-third-party', 'clean-protos', 'clean-swagger-docs']
|
|
waitFor: ['Docker Image: open-match-build']
|
|
|
|
- id: 'Test: Markdown'
|
|
name: 'gcr.io/$PROJECT_ID/open-match-build'
|
|
args: ['make', 'md-test']
|
|
waitFor: ['Build: Clean']
|
|
|
|
- id: 'Setup: Clean Go Dependencies'
|
|
name: 'gcr.io/$PROJECT_ID/open-match-build'
|
|
args: ['make', 'clean-deps']
|
|
volumes:
|
|
- name: 'go-vol'
|
|
path: '/go'
|
|
waitFor: ['Build: Clean']
|
|
|
|
- id: 'Build: Initialize Toolchain'
|
|
name: 'gcr.io/$PROJECT_ID/open-match-build'
|
|
args: ['make', 'install-toolchain']
|
|
volumes:
|
|
- name: 'go-vol'
|
|
path: '/go'
|
|
waitFor: ['Setup: Clean Go Dependencies']
|
|
|
|
- id: 'Build: Compile Protos'
|
|
name: 'gcr.io/$PROJECT_ID/open-match-build'
|
|
args: ['make', 'golang-protos']
|
|
volumes:
|
|
- name: 'go-vol'
|
|
path: '/go'
|
|
waitFor: ['Build: Initialize Toolchain']
|
|
|
|
- id: 'Setup: Download Go Dependencies'
|
|
name: 'gcr.io/$PROJECT_ID/open-match-build'
|
|
args: ['make', 'sync-deps']
|
|
volumes:
|
|
- name: 'go-vol'
|
|
path: '/go'
|
|
waitFor: ['Build: Compile Protos']
|
|
|
|
- id: 'Build: Deployment Configs'
|
|
name: 'gcr.io/$PROJECT_ID/open-match-build'
|
|
args: ['make', 'SHORT_SHA=${SHORT_SHA}', 'update-chart-deps', 'install/yaml/']
|
|
waitFor: ['Setup: Download Go Dependencies']
|
|
|
|
- id: 'Test: Terraform Configuration'
|
|
name: 'gcr.io/$PROJECT_ID/open-match-build'
|
|
args: ['make', 'terraform-test']
|
|
waitFor: ['Setup: Download Go Dependencies']
|
|
|
|
- id: 'Build: Assets'
|
|
name: 'gcr.io/$PROJECT_ID/open-match-build'
|
|
args: ['make', '_CHARTS_BUCKET=${_CHARTS_BUCKET}', 'assets', '-j12']
|
|
volumes:
|
|
- name: 'go-vol'
|
|
path: '/go'
|
|
waitFor: ['Build: Deployment Configs']
|
|
|
|
- id: 'Build: Binaries'
|
|
name: 'gcr.io/$PROJECT_ID/open-match-build'
|
|
args: ['make', '_CHARTS_BUCKET=${_CHARTS_BUCKET}', 'build', 'all', '-j12']
|
|
volumes:
|
|
- name: 'go-vol'
|
|
path: '/go'
|
|
waitFor: ['Build: Assets']
|
|
|
|
- id: 'Test: Services'
|
|
name: 'gcr.io/$PROJECT_ID/open-match-build'
|
|
args: ['make', 'GOLANG_TEST_COUNT=3', 'test']
|
|
# When debugging failing tests, enable verbose 'go test' output, run additional passes
|
|
#args: ['make', 'GOLANG_EXTRA_TEST_FLAGS=-v', 'GOLANG_TEST_COUNT=10', 'test']
|
|
volumes:
|
|
- name: 'go-vol'
|
|
path: '/go'
|
|
waitFor: ['Build: Assets']
|
|
|
|
- id: 'Build: Docker Images'
|
|
name: 'gcr.io/$PROJECT_ID/open-match-build'
|
|
args: ['make', '_GCB_POST_SUBMIT=${_GCB_POST_SUBMIT}', '_GCB_LATEST_VERSION=${_GCB_LATEST_VERSION}', 'SHORT_SHA=${SHORT_SHA}', 'BRANCH_NAME=${BRANCH_NAME}', 'push-images', '-j8']
|
|
waitFor: ['Build: Assets']
|
|
|
|
- id: 'Lint: Format, Vet, Charts'
|
|
name: 'gcr.io/$PROJECT_ID/open-match-build'
|
|
args: ['make', 'lint']
|
|
volumes:
|
|
- name: 'go-vol'
|
|
path: '/go'
|
|
waitFor: ['Build: Assets']
|
|
|
|
- id: 'Test: Deploy Open Match'
|
|
name: 'gcr.io/$PROJECT_ID/open-match-build'
|
|
args: ['make', 'SHORT_SHA=${SHORT_SHA}', 'OPEN_MATCH_KUBERNETES_NAMESPACE=open-match-${BUILD_ID}', 'OPEN_MATCH_RELEASE_NAME=open-match-${BUILD_ID}', 'auth-gke-cluster', 'delete-chart', 'ci-reap-namespaces', 'install-ci-chart']
|
|
waitFor: ['Build: Docker Images']
|
|
|
|
- id: 'Deploy: Deployment Configs'
|
|
name: 'gcr.io/$PROJECT_ID/open-match-build'
|
|
args: ['make', '_GCB_POST_SUBMIT=${_GCB_POST_SUBMIT}', '_GCB_LATEST_VERSION=${_GCB_LATEST_VERSION}', 'SHORT_SHA=${SHORT_SHA}', 'BRANCH_NAME=${BRANCH_NAME}', '_CHARTS_BUCKET=${_CHARTS_BUCKET}', 'ci-deploy-artifacts']
|
|
waitFor: ['Lint: Format, Vet, Charts', 'Test: Deploy Open Match']
|
|
volumes:
|
|
- name: 'go-vol'
|
|
path: '/go'
|
|
|
|
- id: 'Test: End-to-End Cluster'
|
|
name: 'gcr.io/$PROJECT_ID/open-match-build'
|
|
args: ['make', 'GOPROXY=off', 'SHORT_SHA=${SHORT_SHA}', 'OPEN_MATCH_KUBERNETES_NAMESPACE=open-match-${BUILD_ID}', 'test-e2e-cluster']
|
|
waitFor: ['Test: Deploy Open Match', 'Build: Assets']
|
|
volumes:
|
|
- name: 'go-vol'
|
|
path: '/go'
|
|
|
|
- id: 'Test: Delete Open Match'
|
|
name: 'gcr.io/$PROJECT_ID/open-match-build'
|
|
args: ['make', 'GCLOUD_EXTRA_FLAGS=--async', 'SHORT_SHA=${SHORT_SHA}', 'OPEN_MATCH_KUBERNETES_NAMESPACE=open-match-${BUILD_ID}', 'OPEN_MATCH_RELEASE_NAME=open-match-${BUILD_ID}', 'GCP_PROJECT_ID=${PROJECT_ID}', 'delete-chart']
|
|
waitFor: ['Test: End-to-End Cluster']
|
|
|
|
artifacts:
|
|
objects:
|
|
location: '${_ARTIFACTS_BUCKET}${_OM_VERSION}'
|
|
paths:
|
|
- install/yaml/*.yaml
|
|
- pkg/pb/*.pb.go
|
|
- pkg/pb/*.pb.gw.go
|
|
- internal/ipb/*.pb.go
|
|
- api/*.swagger.json
|
|
|
|
substitutions:
|
|
_OM_VERSION: "1.8.1"
|
|
_GCB_POST_SUBMIT: "0"
|
|
_GCB_LATEST_VERSION: "undefined"
|
|
_ARTIFACTS_BUCKET: "gs://open-match-build-artifacts/"
|
|
_LOGS_BUCKET: "gs://open-match-build-logs/"
|
|
_CHARTS_BUCKET: "gs://open-match-chart"
|
|
logsBucket: '${_LOGS_BUCKET}'
|
|
options:
|
|
sourceProvenanceHash: ['SHA256']
|
|
machineType: 'N1_HIGHCPU_32'
|
|
timeout: 2500s
|