github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+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  
    29    printf "configuring the $name pipeline...\n"
    30  
    31    fly -t ci set-pipeline \
    32      -p $name \
    33      -c $pipelines_path/infrastructure/pipeline.yml \
    34      -l <(lpass show "Concourse Credentials" --notes) \
    35      -l <(lpass show "$creds" --notes)
    36  }
    37  
    38  check_installed lpass
    39  check_installed fly
    40  
    41  # Make sure we're up to date and that we're logged in.
    42  lpass sync
    43  
    44  pipelines_path=$(cd $(dirname $0)/.. && pwd)
    45  
    46  configure_pipeline cli \
    47    $pipelines_path/cli/pipeline.yml
    48  
    49  configure_infrastructure_pipeline inf-beque beque-pipeline
    50  configure_infrastructure_pipeline inf-hardknox hardknox-pipeline
    51  configure_infrastructure_pipeline inf-lovingcup lovingcup-pipeline
    52  configure_infrastructure_pipeline inf-tartine tartine-pipeline