1#!/bin/bash 2# Copyright (C) 2021 The Android Open Source Project 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15 16# See go/perfetto-ui-autopush for docs on how this works end-to-end. 17 18set -exu 19 20env 21pwd 22mount 23 24# This script will be run in /workspace after the Cloud Build environment has 25# pulled the GitHub repo in shallow mode. We want to build off the official 26# AOSP repo, not the GitHub mirror though, hence why the clone below. 27# GitHub is used only as a trigger. This is because Google Cloud Build doesn't 28# support yet triggering from Gerrit. 29 30cd /workspace/ 31mkdir /workspace/tmp 32 33ls -A1 | xargs rm -rf 34UPSTREAM="https://android.googlesource.com/platform/external/perfetto.git" 35git clone $UPSTREAM upstream 36 37cd upstream/ 38 39# infra/ui.perfetto.dev/cloudbuild_release.yaml sets $1 to the branch 40# name when triggering from a release branch. Otherwise $1 is "" when triggering 41# from main. 42EXTRA_ARGS="" 43if [[ ! -z $1 ]]; then 44 git checkout $1 45 EXTRA_ARGS="--branch_only=$1" 46fi 47 48git rev-parse HEAD 49python3 -u "ui/release/build_all_channels.py" \ 50 --upload --tmp=/workspace/tmp $EXTRA_ARGS 51