-
Notifications
You must be signed in to change notification settings - Fork 57
/
Copy pathupdate-taskcat.sh
executable file
·40 lines (30 loc) · 1.49 KB
/
update-taskcat.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env bash
# sudo chmod +x *.sh
# ./update-taskcat.sh my-pipeline-name-bucket
set -euo pipefail
IFS=$'\n\t'
#/ Usage: update-taskcat.sh [PIPELINE_BUCKET]
#/ Description: Change all S3_BUCKET_TOKEN references in the TaskCat configuration file to the autogenerated S3 Bucket name used as the ArtifactStore for CodePipeline in the pipeline-taskcat.yml template.
#/ Examples:
#/ launch-stack.sh (launches a stack using the the env var PIPELINE_BUCKET, or shows you these docs if it is unset)
#/ update-taskcat.sh my-pipeline-bucket-name
#/ Options:
#/ --help: Display this help message
usage() { grep '^#/' "$0" | cut -c4- ; exit 1 ; }
expr "$*" : ".*--help" > /dev/null && usage
readonly LOG_FILE="/tmp/$(basename "$0").log"
info() { echo "[INFO] $@" | tee -a "$LOG_FILE" >&2 ; }
warning() { echo "[WARNING] $@" | tee -a "$LOG_FILE" >&2 ; }
error() { echo "[ERROR] $@" | tee -a "$LOG_FILE" >&2 ; }
fatal() { echo "[FATAL] $@" | tee -a "$LOG_FILE" >&2 ; exit 1 ; }
PIPELINE_BUCKET=${1:-${PIPELINE_BUCKET:-}}
if [ -z "$PIPELINE_BUCKET" ]; then
usage
fi
echo "Running update-taskcat.sh"
PIPELINE_BUCKET=${1:-PIPELINE_BUCKETisrequired}
echo "$PIPELINE_BUCKET is $PIPELINE_BUCKET"
echo "Change all S3_BUCKET_TOKEN references in the TaskCat configuration file to the autogenerated S3 Bucket name used as the ArtifactStore for CodePipeline in the pipeline-taskcat.yml template"
sed -i "s/S3_BUCKET_TOKEN/$PIPELINE_BUCKET/g" .taskcat.yml
echo "Updated update-taskcat.sh"
cat .taskcat.yml