github.com/GoogleCloudPlatform/testgrid@v0.0.174/cluster/setup-testgrid-pubsub.sh (about)

     1  #!/usr/bin/env bash
     2  # Copyright 2021 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  set -o nounset
    18  set -o errexit
    19  
    20  
    21  dir=$(dirname "$0")
    22  create_topic=$dir/create-topic.sh
    23  create_sub=$dir/create-subscription.sh
    24  
    25  log() {
    26      (
    27          set -o xtrace
    28          "$@"
    29      )
    30  }
    31  
    32  
    33  apply() {
    34      log "$create_topic" -t "$topic" -p '' "$bucket"
    35  
    36      log "$create_sub" -t "$topic" -b "$bot" -p "$project" -f "$group_prefix" "$group_sub"
    37      log "$create_sub" -t "$topic" -b "$bot" -p "$project" -f "$tab_prefix" "$tab_sub"
    38  }
    39  
    40  project=k8s-testgrid
    41  
    42  bucket=gs://k8s-testgrid
    43  topic="projects/$project/topics/testgrid"
    44  group_sub=test-group-updates
    45  tab_sub=tab-updates
    46  group_prefix=""
    47  tab_prefix=""
    48  bot=serviceAccount:updater@k8s-testgrid.iam.gserviceaccount.com
    49  apply
    50  
    51  
    52  bucket=gs://k8s-testgrid-canary
    53  topic="projects/$project/topics/canary-testgrid"
    54  group_sub=canary-test-group-updates
    55  tab_sub=canary-tab-updates
    56  group_prefix="grid/"
    57  tab_prefix="tabs/"
    58  bot=serviceAccount:testgrid-canary@k8s-testgrid.iam.gserviceaccount.com
    59  apply