github.com/ablease/cli@v6.37.1-0.20180613014814-3adbb7d7fb19+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() {
    26    local name=$1
    27    local creds=$2
    28    local potato=$3
    29  
    30    printf "configuring the $name pipeline...\n"
    31  
    32    fly -t ci set-pipeline \
    33      -p $name \
    34      -c $pipelines_path/infrastructure/pipeline.yml \
    35      -l <(lpass show "Concourse Credentials" --notes) \
    36      -l <(lpass show "$creds" --notes) \
    37      -v pool-name=$potato
    38  }
    39  
    40  configure_legacy_infrastructure_pipeline() {
    41    local name=$1
    42    local creds=$2
    43    local potato=$3
    44  
    45    printf "configuring the $name pipeline...\n"
    46  
    47    fly -t ci set-pipeline \
    48      -p $name \
    49      -c $pipelines_path/infrastructure/legacy-pipeline.yml \
    50      -l <(lpass show "Concourse Credentials" --notes) \
    51      -l <(lpass show "$creds" --notes) \
    52      -v pool-name=$potato
    53  }
    54  
    55  check_installed lpass
    56  check_installed fly
    57  
    58  # Make sure we're up to date and that we're logged in.
    59  lpass sync
    60  
    61  pipelines_path=$(cd $(dirname $0)/.. && pwd)
    62  
    63  configure_pipeline cli $pipelines_path/cli/pipeline.yml
    64  
    65  configure_infrastructure_pipeline inf-beque beque-pipeline baked-potato
    66  configure_infrastructure_pipeline inf-hardknox hardknox-pipeline baked-potato
    67  configure_infrastructure_pipeline inf-lovingcup lovingcup-pipeline baked-potato
    68  configure_infrastructure_pipeline inf-tartine tartine-pipeline baked-potato
    69  configure_infrastructure_pipeline inf-arsicault arsicault-pipeline deep-fried-potato
    70  
    71  configure_legacy_infrastructure_pipeline inf-homeroom homeroom-pipeline moldy-gnocchi