k8s.io/test-infra@v0.0.0-20240520184403-27c6b4c223d8/config/jobs/kubernetes/sig-k8s-infra/trusted/releng/sync-ar.sh (about)

     1  #!/usr/bin/env bash
     2  # Copyright 2024 The Kubernetes 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  # generates prowjobs for AR sync
    17  
    18  set -o errexit
    19  set -o nounset
    20  set -o pipefail
    21  
    22  SCRIPT_DIR=$(dirname "${BASH_SOURCE[0]}")
    23  
    24  readonly OUTPUT="${SCRIPT_DIR}/sync-ar-repos.yaml"
    25  
    26  readonly AR_REGIONS=(
    27  	asia-east2
    28  	europe-west3
    29  	europe-west10
    30  	europe-west12
    31  	us-west3
    32  	us-west4
    33  	southamerica-east1
    34  )
    35  
    36  cat >"${OUTPUT}" <<EOF
    37  periodics:
    38  EOF
    39  
    40  for ar_region in "${AR_REGIONS[@]}"; do
    41  	cat >>"${OUTPUT}" <<EOF
    42    - name: sync-to-ar-${ar_region}
    43      cluster: k8s-infra-prow-build-trusted
    44      interval: 2h
    45      decorate: true
    46      decoration_config:
    47        timeout: 100m
    48      annotations:
    49        testgrid-dashboards: sig-k8s-infra-registry
    50        testgrid-tab-name: sync-to-ar-repo-${ar_region}
    51        testgrid-description: 'Sync AR repo from us-central1 to ${ar_region}'
    52        testgrid-num-failures-to-alert: '3'
    53      rerun_auth_config:
    54        github_team_slugs:
    55        - org: kubernetes
    56          slug: sig-k8s-infra-leads
    57        - org: kubernetes
    58          slug: release-managers
    59      spec:
    60        serviceAccountName: k8s-infra-gcr-promoter
    61        containers:
    62        - image: gcr.io/go-containerregistry/gcrane:latest
    63          imagePullPolicy: Always
    64          command:
    65          - gcrane
    66          args:
    67          - copy
    68          - --recursive
    69          - --allow-nondistributable-artifacts
    70          - us-central1-docker.pkg.dev/k8s-artifacts-prod/images
    71          - ${ar_region}-docker.pkg.dev/k8s-artifacts-prod/images
    72  EOF
    73  done