4
4
5
5
set -e
6
6
7
+ # Ensure on main, and pull the latest
7
8
BRANCH=$( git rev-parse --abbrev-ref HEAD)
8
- echo $BRANCH
9
-
10
9
if [ $BRANCH != " main" ]; then
11
10
echo " Not on main, aborting"
12
11
exit 1
12
+ else
13
+ echo " Updating main"
14
+ git pull origin main
13
15
fi
14
16
15
- if [ -z " $AWS_ACCESS_KEY_ID " ]; then
16
- echo ' AWS_ACCESS_KEY_ID not set. Are you using aws-vault?'
17
- exit 1
18
- fi
19
-
20
- if [ -z " $AWS_SECRET_ACCESS_KEY " ]; then
21
- echo ' AWS_SECRET_ACCESS_KEY not set. Are you using aws-vault?'
22
- exit 1
23
- fi
24
-
25
- if [ -z " $AWS_SESSION_TOKEN " ]; then
26
- echo ' AWS_SESSION_TOKEN not set. Are you using aws-vault?'
17
+ # # Ensure no uncommitted changes
18
+ if [ -n " $( git status --porcelain) " ]; then
19
+ echo " Detected uncommitted changes, aborting"
27
20
exit 1
28
21
fi
29
22
23
+ # Read the new version
30
24
if [ -z " $1 " ]; then
31
25
echo " Must specify a desired version number"
32
26
exit 1
37
31
NEW_VERSION=$1
38
32
fi
39
33
40
- echo ' Checking AWS Regions'
41
- ./scripts/list_layers.sh
34
+ # Ensure AWS access before proceeding
35
+ saml2aws login -a govcloud-us1-fed-human-engineering
36
+ AWS_PROFILE=govcloud-us1-fed-human-engineering aws sts get-caller-identity
37
+ aws-vault exec prod-engineering -- aws sts get-caller-identity
42
38
43
- read -p " Do the list look good? (y/n) " -n 1 -r
39
+ # Ensure pypi registry access
40
+ read -p " Do you have the PyPi login credentials for datadog account (y/n)? " -n 1 -r
41
+ echo
42
+ if [[ ! $REPLY =~ ^[Yy]$ ]]
43
+ then
44
+ [[ " $0 " = " $BASH_SOURCE " ]] && exit 1 || return 1
45
+ fi
46
+
47
+ echo ' Checking existing layers in commercial AWS regions'
48
+ aws-vault exec prod-engineering -- ./scripts/list_layers.sh
49
+
50
+ echo ' Checking existing layers in GovCloud AWS regions'
51
+ saml2aws login -a govcloud-us1-fed-human-engineering
52
+ AWS_PROFILE=govcloud-us1-fed-human-engineering ./scripts/list_layers.sh
53
+
54
+ read -p " Do the layer lists look good? Proceed publishing the new version (y/n)? " -n 1 -r
44
55
echo
45
56
if [[ ! $REPLY =~ ^[Yy]$ ]]
46
57
then
@@ -69,39 +80,43 @@ echo "Building layers..."
69
80
./scripts/build_layers.sh
70
81
71
82
echo
72
- echo " Signing layers... "
73
- ./scripts/sign_layers.sh prod
83
+ echo " Signing layers for commercial AWS regions "
84
+ aws-vault exec prod-engineering -- ./scripts/sign_layers.sh prod
74
85
75
86
echo
76
- echo " Publishing layers to AWS regions... "
77
- ./scripts/publish_layers.sh
87
+ echo " Publishing layers to commercial AWS regions"
88
+ aws-vault exec prod-engineering -- ./scripts/publish_layers.sh
78
89
79
- echo
80
- echo ' Pushing updates to github'
81
- MINOR_VERSION=$( echo $NEW_VERSION | cut -d ' .' -f 2)
82
- git push origin main
83
- git tag " v$MINOR_VERSION "
84
- git push origin " refs/tags/v$MINOR_VERSION "
90
+ echo " Publishing layers to GovCloud AWS regions"
91
+ saml2aws login -a govcloud-us1-fed-human-engineering
92
+ AWS_PROFILE=govcloud-us1-fed-human-engineering ./scripts/publish_layers.sh
85
93
94
+ echo ' Checking published layers in commercial AWS regions'
95
+ aws-vault exec prod-engineering -- ./scripts/list_layers.sh
86
96
87
- echo ' Checking AWS Regions Again...'
88
- ./scripts/list_layers.sh
97
+ echo ' Checking published layers in GovCloud AWS regions'
98
+ saml2aws login -a govcloud-us1-fed-human-engineering
99
+ AWS_PROFILE=govcloud-us1-fed-human-engineering ./scripts/list_layers.sh
89
100
90
101
91
- read -p " Do regions look good? Ready to publish $NEW_VERSION to Pypi? (y/n)" -n 1 -r
102
+ read -p " Do the layer lists look good? Ready to publish $NEW_VERSION to Pypi? (y/n)" -n 1 -r
92
103
echo
93
104
if [[ ! $REPLY =~ ^[Yy]$ ]]
94
105
then
95
106
[[ " $0 " = " $BASH_SOURCE " ]] && exit 1 || return 1
96
107
fi
108
+
97
109
echo
98
110
echo " Publishing to https://pypi.org/project/datadog-lambda/"
99
111
./scripts/pypi.sh
100
112
101
113
echo
102
- echo " Now create a new release with the tag v ${MINOR_VERSION} created "
103
- echo " https://github.com/DataDog/datadog-lambda-python/releases/new "
104
- echo
105
- echo " Then publish a new serverless-plugin-datadog version with the new layer versions! "
106
- echo
114
+ echo ' Publishing updates to github '
115
+ MINOR_VERSION= $( echo $NEW_VERSION | cut -d ' . ' -f 2 )
116
+ git push origin main
117
+ git tag " v $MINOR_VERSION "
118
+ git push origin " refs/tags/v $MINOR_VERSION "
107
119
120
+ echo
121
+ echo " Now create a new release with the tag v${MINOR_VERSION} created"
122
+ echo " https://github.com/DataDog/datadog-lambda-python/releases/new?tag=v$MINOR_VERSION &title=v$MINOR_VERSION "
0 commit comments