forked from aws/amazon-ecs-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpublish-staged
More file actions
executable file
·117 lines (108 loc) · 3.77 KB
/
publish-staged
File metadata and controls
executable file
·117 lines (108 loc) · 3.77 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#!/bin/bash
# Copyright 2015-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the
# "License"). You may not use this file except in compliance
# with the License. A copy of the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanying this file. This file is
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
# CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and
# limitations under the License.
set -e
DRYRUN=true
PGP_PUBLISH=true
AWS_PROFILE=""
STAGE_S3_BUCKET=""
PUBLISH_S3_BUCKET="amazon-ecs-cli"
S3_ACL_OVERRIDE=""
source $(dirname "${0}")/publish-functions.sh
usage() {
echo "Usage: ${0} -s BUCKET [OPTIONS]"
echo
echo "This script is responsible for publishing new versions of the Amazon ECS CLI"
echo "It copies staged artifacts in a given bucket into the known release bucket"
echo
echo "Options"
echo " -d true|false Dryrun (default is true)"
echo " -p PROFILE AWS CLI Profile (default is none)"
echo " -o PROFILE AWS CLI Profile for the bucket to push to (defaults to the profile specified with -p)"
echo " -s BUCKET AWS S3 Bucket for staging"
echo " -b BUCKET AWS S3 Bucket for publishing (default is ${PUBLISH_S3_BUCKET})"
echo " -a ACL AWS S3 Object Canned ACL (default is public-read)"
echo " -c true|false Publish PGP Signatures (default is true)"
echo " -h Display this help message"
}
publish_s3() {
for tag in ${ARTIFACT_TAG_VERSION} ${ARTIFACT_TAG_SHA} ${ARTIFACT_TAG_LATEST}; do
echo "Publishing as ecs-cli-linux-amd64-${tag}"
dexec s3_pull_push "s3://${STAGE_S3_BUCKET}/ecs-cli-linux-amd64-${tag}" "s3://${PUBLISH_S3_BUCKET}/ecs-cli-linux-amd64-${tag}"
dexec s3_pull_push "s3://${STAGE_S3_BUCKET}/ecs-cli-linux-amd64-${tag}.md5" "s3://${PUBLISH_S3_BUCKET}/ecs-cli-linux-amd64-${tag}.md5"
if ${PGP_PUBLISH}; then
dexec s3_pull_push "s3://${STAGE_S3_BUCKET}/ecs-cli-linux-amd64-${tag}.asc" "s3://${PUBLISH_S3_BUCKET}/ecs-cli-linux-amd64-${tag}.asc"
fi
echo "Publishing as ecs-cli-darwin-amd64-${tag}"
dexec s3_pull_push "s3://${STAGE_S3_BUCKET}/ecs-cli-darwin-amd64-${tag}" "s3://${PUBLISH_S3_BUCKET}/ecs-cli-darwin-amd64-${tag}"
dexec s3_pull_push "s3://${STAGE_S3_BUCKET}/ecs-cli-darwin-amd64-${tag}.md5" "s3://${PUBLISH_S3_BUCKET}/ecs-cli-darwin-amd64-${tag}.md5"
if ${PGP_PUBLISH}; then
dexec s3_pull_push "s3://${STAGE_S3_BUCKET}/ecs-cli-darwin-amd64-${tag}.asc" "s3://${PUBLISH_S3_BUCKET}/ecs-cli-darwin-amd64-${tag}.asc"
fi
echo "Publishing as ecs-cli-windows-amd64-${tag}.exe"
dexec s3_pull_push "s3://${STAGE_S3_BUCKET}/ecs-cli-windows-amd64-${tag}.exe" "s3://${PUBLISH_S3_BUCKET}/ecs-cli-windows-amd64-${tag}.exe"
dexec s3_pull_push "s3://${STAGE_S3_BUCKET}/ecs-cli-windows-amd64-${tag}.md5" "s3://${PUBLISH_S3_BUCKET}/ecs-cli-windows-amd64-${tag}.md5"
if ${PGP_PUBLISH}; then
dexec s3_pull_push "s3://${STAGE_S3_BUCKET}/ecs-cli-windows-amd64-${tag}.exe.asc" "s3://${PUBLISH_S3_BUCKET}/ecs-cli-windows-amd64-${tag}.exe.asc"
fi
done
}
while getopts ":d:p:o:s:b:i:a:h:c:" opt; do
case ${opt} in
d)
if [[ "${OPTARG}" = "false" ]]; then
DRYRUN=false
fi
;;
c)
if [[ "${OPTARG}" = "false" ]]; then
PGP_PUBLISH=false
fi
;;
p)
AWS_PROFILE="${OPTARG}"
;;
o)
AWS_PROFILE_PUSH="${OPTARG}"
;;
s)
STAGE_S3_BUCKET="${OPTARG}"
;;
b)
PUBLISH_S3_BUCKET="${OPTARG}"
;;
a)
S3_ACL_OVERRIDE="${OPTARG}"
;;
\?)
echo "Invalid option -${OPTARG}" >&2
usage
exit 1
;;
:)
echo "Option -${OPTARG} requires an argument." >&2
usage
exit 1
;;
h)
usage
exit 0
;;
esac
done
if [ -z "${STAGE_S3_BUCKET}" ]; then
usage
exit 1
fi
publish_s3