github.com/mook-as/cf-cli@v7.0.0-beta.28.0.20200120190804-b91c115fae48+incompatible/ci/bin/reconfigure-pipelines (about)

     1  #!/usr/bin/env bash
     2  
     3  set -e
     4  set -o pipefail
     5  
     6  check_installed() {
     7    if ! command -v $1 > /dev/null 2>&1; then
     8      printf "$1 must be installed before running this script!"
     9      exit 1
    10    fi
    11  }
    12  
    13  configure_pipeline() {
    14    local name=$1
    15    local pipeline=$2
    16  
    17    printf "configuring the $name pipeline...\n"
    18  
    19    fly -t ci set-pipeline \
    20      -p $name \
    21      -c $pipeline \
    22      -l <(lpass show "Concourse Credentials" --notes)
    23  }
    24  
    25  # configure_infrastructure_pipeline sets a pipeline for deploying an integration CF environment. The first three parameters, which are required, are the environment's name, the name of its env-specific Lastpass note, and the name of the environment pool it belongs to. The optional fourth parameter is the pipeline configuration to use, which defaults to the base infrastruction pipeline configuration.
    26  configure_infrastructure_pipeline() {
    27    local name=$1
    28    local creds=$2
    29    local potato=$3
    30    local pipeline=$4
    31  
    32    if [[ -z $pipeline ]]; then
    33      pipeline=$pipelines_path/infrastructure/pipeline.yml
    34    fi
    35  
    36    printf "configuring the $name pipeline...\n"
    37  
    38    fly -t ci set-pipeline \
    39      -p $name \
    40      -c $pipeline \
    41      -l <(lpass show "Concourse Credentials" --notes) \
    42      -l <(lpass show "$creds" --notes) \
    43      -v pool-name=$potato
    44  }
    45  
    46  configure_bosh_lite_pool_pipeline() {
    47    local name=$1
    48  
    49    printf "configuring the $name pipeline...\n"
    50  
    51    fly -t ci set-pipeline \
    52      -p $name \
    53      -c $pipelines_path/cli-dev-bosh-lite/pipeline.yml \
    54      -v bosh-lite-dns-zone-name=bosh-lite-pool \
    55      -v bosh-lite-gcp-json-key="$(lpass show Shared-CLI/bosh-service-account-gcp-creds --notes | jq -c . )" \
    56      -v bosh-lite-pools-github-private-key="$(lpass show Shared-CLI/bosh-lite-pool-github-key --notes)" \
    57      -v bosh-lite-project-id=cf-cli \
    58      -v bosh-lite-region=us-west1 \
    59      -v bosh-lite-storage-bucket=bosh-lites \
    60      -v bosh-lite-system-domain-suffix=lite.cli.fun \
    61      -v git-email=cf-cli-eng@pivotal.io \
    62      -v git-username=cf-cli-eng \
    63      -v env-pool-repo=git@github.com:cloudfoundry/cli-pools.git \
    64      -v slack-webhook-url="$(lpass show Shared-CLI/Concourse/Concourse\ Credentials --notes | grep -F slack-webhook-url: | cut -d '"' -f2)"
    65  }
    66  
    67  check_installed lpass
    68  check_installed fly
    69  
    70  # Make sure we're up to date and that we're logged in.
    71  lpass sync
    72  
    73  pipelines_path=$(cd $(dirname $0)/.. && pwd)
    74  
    75  configure_pipeline cli $pipelines_path/cli/pipeline.yml
    76  
    77  configure_infrastructure_pipeline inf-beque beque-pipeline baked-potato
    78  configure_infrastructure_pipeline inf-burmaclub burmaclub-pipeline baked-potato
    79  configure_infrastructure_pipeline inf-hardknox hardknox-pipeline baked-potato
    80  configure_infrastructure_pipeline inf-kinkhao kinkhao-pipeline baked-potato
    81  configure_infrastructure_pipeline inf-lovingcup lovingcup-pipeline baked-potato
    82  configure_infrastructure_pipeline inf-starbelly starbelly-pipeline baked-potato
    83  configure_infrastructure_pipeline inf-tartine tartine-pipeline baked-potato
    84  configure_infrastructure_pipeline inf-tropisueno tropisueno-pipeline baked-potato
    85  
    86  # Arsicault has additional configuration to alert the PM before it rolls.
    87  arsicault_pipeline="bosh int $pipelines_path/infrastructure/pipeline.yml -o $pipelines_path/infrastructure/add-pm-alert-and-wait.yml"
    88  configure_infrastructure_pipeline inf-arsicault arsicault-pipeline deep-fried-potato <(eval $arsicault_pipeline)
    89  
    90  # Lola (legacy pipeline) uses a different base pipeline configuration than the other infrastructures.
    91  lola_pipeline=$pipelines_path/infrastructure/lola-pipeline.yml
    92  configure_infrastructure_pipeline inf-lola lola-pipeline kloesse $lola_pipeline
    93  configure_infrastructure_pipeline inf-chipotle chipotle-pipeline kloesse $lola_pipeline
    94  
    95  legacy_pipeline=$pipelines_path/infrastructure/legacy-pipeline.yml
    96  configure_infrastructure_pipeline inf-aster aster-pipeline kloesse $legacy_pipeline
    97  configure_infrastructure_pipeline inf-solstice solstice-pipeline kloesse $legacy_pipeline
    98  
    99  configure_bosh_lite_pool_pipeline bosh-lites