github.com/GoogleCloudPlatform/testgrid@v0.0.174/cluster/prod/knative/setup-testgrid-pubsub.sh (about) 1 #!/usr/bin/env bash 2 # Copyright 2022 The TestGrid Authors. 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 ############# 17 # Sets up the internal queues that TestGrid uses to speak to other parts of itself 18 ############# 19 set -o nounset 20 set -o errexit 21 22 23 dir=$(dirname "$0")/../.. 24 create_topic=$dir/create-topic.sh 25 create_sub=$dir/create-subscription.sh 26 27 log() { 28 ( 29 set -o xtrace 30 "$@" 31 ) 32 } 33 34 35 apply() { 36 log "$create_topic" -t "${topic_prefix}-grid" -p 'grid/' "$bucket" 37 log "$create_topic" -t "${topic_prefix}-tabs" -p 'tabs/' "$bucket" 38 39 log "$create_sub" -t "${topic_prefix}-grid" -b "$bot" -p "${project}" "$group_sub" 40 log "$create_sub" -t "${topic_prefix}-tabs" -b "$bot" -p "${project}" "$tab_sub" 41 } 42 43 project=knative-tests 44 bucket=gs://knative-own-testgrid 45 topic_prefix="projects/$project/topics/knative-own-testgrid" 46 group_sub=test-group-updates 47 tab_sub=tab-updates 48 bot=serviceAccount:testgrid-updater@knative-tests.iam.gserviceaccount.com 49 apply