github.com/randomtask1155/cli@v6.41.1-0.20181227003417-a98eed78cbde+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      -v honeycomb-writer-key="$(lpass show Shared-CLI/Honeycomb --notes)"
    24  }
    25  
    26  configure_infrastructure_pipeline() {
    27    local name=$1
    28    local creds=$2
    29    local potato=$3
    30  
    31    printf "configuring the $name pipeline...\n"
    32  
    33    fly -t ci set-pipeline \
    34      -p $name \
    35      -c $pipelines_path/infrastructure/pipeline.yml \
    36      -l <(lpass show "Concourse Credentials" --notes) \
    37      -l <(lpass show "$creds" --notes) \
    38      -v pool-name=$potato
    39  }
    40  
    41  configure_lola_pipeline() {
    42    local name=$1
    43    local creds=$2
    44    local potato=$3
    45  
    46    printf "configuring the $name pipeline...\n"
    47  
    48    fly -t ci set-pipeline \
    49      -p $name \
    50      -c $pipelines_path/infrastructure/lola-pipeline.yml \
    51      -l <(lpass show "Concourse Credentials" --notes) \
    52      -l <(lpass show "$creds" --notes) \
    53      -v pool-name=$potato
    54  }
    55  
    56  configure_legacy_infrastructure_pipeline() {
    57    local name=$1
    58    local creds=$2
    59    local potato=$3
    60  
    61    printf "configuring the $name pipeline...\n"
    62  
    63    fly -t ci set-pipeline \
    64      -p $name \
    65      -c $pipelines_path/infrastructure/legacy-pipeline.yml \
    66      -l <(lpass show "Concourse Credentials" --notes) \
    67      -l <(lpass show "$creds" --notes) \
    68      -v pool-name=$potato
    69  }
    70  
    71  configure_bosh_lite_pool_pipeline() {
    72    local name=$1
    73  
    74    fly -t ci set-pipeline \
    75      -p $name \
    76      -c $pipelines_path/cli-dev-bosh-lite/pipeline.yml \
    77      -v bosh-lite-dns-zone-name=bosh-lite-pool \
    78      -v bosh-lite-gcp-json-key="$(lpass show Shared-CLI/bosh-service-account-gcp-creds --notes | jq -c . )" \
    79      -v bosh-lite-pools-github-private-key="$(lpass show Shared-CLI/bosh-lite-pool-github-key --notes)" \
    80      -v bosh-lite-project-id=cf-cli \
    81      -v bosh-lite-region=us-west1 \
    82      -v bosh-lite-storage-bucket=bosh-lites \
    83      -v bosh-lite-system-domain-suffix=lite.cli.fun \
    84      -v git-email=cf-cli-eng@pivotal.io \
    85      -v git-username=cf-cli-eng \
    86      -v env-pool-repo=git@github.com:cloudfoundry/cli-pools.git \
    87      -v slack-webhook-url="$(lpass show Shared-CLI/Concourse/Concourse\ Credentials --notes | grep -F slack-webhook-url: | cut -d '"' -f2)"
    88  }
    89  
    90  check_installed lpass
    91  check_installed fly
    92  
    93  # Make sure we're up to date and that we're logged in.
    94  lpass sync
    95  
    96  pipelines_path=$(cd $(dirname $0)/.. && pwd)
    97  
    98  configure_pipeline cli $pipelines_path/cli/pipeline.yml
    99  
   100  configure_infrastructure_pipeline inf-beque beque-pipeline baked-potato
   101  configure_infrastructure_pipeline inf-hardknox hardknox-pipeline baked-potato
   102  configure_infrastructure_pipeline inf-lovingcup lovingcup-pipeline baked-potato
   103  configure_infrastructure_pipeline inf-tartine tartine-pipeline baked-potato
   104  configure_infrastructure_pipeline inf-arsicault arsicault-pipeline deep-fried-potato
   105  
   106  configure_lola_pipeline inf-lola lola-pipeline kloesse
   107  
   108  configure_legacy_infrastructure_pipeline inf-homeroom homeroom-pipeline moldy-gnocchi
   109  
   110  configure_bosh_lite_pool_pipeline bosh-lites