github.com/jenspinney/cli@v6.42.1-0.20190207184520-7450c600020e+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 fly -t ci set-pipeline \ 50 -p $name \ 51 -c $pipelines_path/cli-dev-bosh-lite/pipeline.yml \ 52 -v bosh-lite-dns-zone-name=bosh-lite-pool \ 53 -v bosh-lite-gcp-json-key="$(lpass show Shared-CLI/bosh-service-account-gcp-creds --notes | jq -c . )" \ 54 -v bosh-lite-pools-github-private-key="$(lpass show Shared-CLI/bosh-lite-pool-github-key --notes)" \ 55 -v bosh-lite-project-id=cf-cli \ 56 -v bosh-lite-region=us-west1 \ 57 -v bosh-lite-storage-bucket=bosh-lites \ 58 -v bosh-lite-system-domain-suffix=lite.cli.fun \ 59 -v git-email=cf-cli-eng@pivotal.io \ 60 -v git-username=cf-cli-eng \ 61 -v env-pool-repo=git@github.com:cloudfoundry/cli-pools.git \ 62 -v slack-webhook-url="$(lpass show Shared-CLI/Concourse/Concourse\ Credentials --notes | grep -F slack-webhook-url: | cut -d '"' -f2)" 63 } 64 65 check_installed lpass 66 check_installed fly 67 68 # Make sure we're up to date and that we're logged in. 69 lpass sync 70 71 pipelines_path=$(cd $(dirname $0)/.. && pwd) 72 73 configure_pipeline cli $pipelines_path/cli/pipeline.yml 74 75 configure_infrastructure_pipeline inf-beque beque-pipeline baked-potato 76 configure_infrastructure_pipeline inf-hardknox hardknox-pipeline baked-potato 77 configure_infrastructure_pipeline inf-lovingcup lovingcup-pipeline baked-potato 78 configure_infrastructure_pipeline inf-tartine tartine-pipeline baked-potato 79 80 # Arsicault has additional configuration to alert the PM before it rolls. 81 arsicault_pipeline="bosh int $pipelines_path/infrastructure/pipeline.yml -o $pipelines_path/infrastructure/add-pm-alert-and-wait.yml" 82 configure_infrastructure_pipeline inf-arsicault arsicault-pipeline deep-fried-potato <(eval $arsicault_pipeline) 83 84 # Lola (legacy pipeline) uses a different base pipeline configuration than the other infrastructures. 85 lola_pipeline=$pipelines_path/infrastructure/lola-pipeline.yml 86 configure_infrastructure_pipeline inf-lola lola-pipeline kloesse $lola_pipeline 87 88 configure_bosh_lite_pool_pipeline bosh-lites