Skip to content

Commit 0ebcf58

Browse files
authored
feat: Support govcloud releases locally (#438)
* feat: Support govcloud releases locally * feat: remove extra early return
1 parent 5370111 commit 0ebcf58

File tree

1 file changed

+52
-27
lines changed

1 file changed

+52
-27
lines changed

scripts/publish_prod.sh

+52-27
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,6 @@ else
3131
NEW_VERSION=$1
3232
fi
3333

34-
# Ensure AWS access before proceeding
35-
ddsaml2aws login -a govcloud-us1-fed-human-engineering
36-
AWS_PROFILE=govcloud-us1-fed-human-engineering aws sts get-caller-identity
37-
aws-vault exec sso-prod-engineering -- aws sts get-caller-identity
38-
3934
# Ensure pypi registry access
4035
read -p "Do you have access to PyPI (y/n)?" CONT
4136
if [ "$CONT" != "y" ]; then
@@ -52,11 +47,17 @@ if [ "$CONT" != "y" ]; then
5247
exit 1
5348
fi
5449

55-
echo
56-
echo "Replacing version in pyproject.toml"
57-
echo
50+
echo "Answer 'n' if already done in a PR"
51+
read -p "Update pyproject.toml version? (y/n)?" CONT
52+
if [ "$CONT" != "y" ]; then
53+
echo "Skipping updating package.json version"
54+
else
55+
echo
56+
echo "Replacing version in pyproject.toml"
57+
echo
5858

59-
poetry version ${NEW_VERSION}
59+
poetry version ${NEW_VERSION}
60+
fi
6061

6162
echo
6263
echo "Building layers..."
@@ -66,33 +67,57 @@ echo
6667
echo "Signing layers for commercial AWS regions"
6768
aws-vault exec sso-prod-engineering -- ./scripts/sign_layers.sh prod
6869

69-
echo
70-
echo "Publishing layers to commercial AWS regions"
71-
VERSION=$LAYER_VERSION aws-vault exec sso-prod-engineering -- ./scripts/publish_layers.sh
70+
echo "Answer 'n' if GitLab already did this"
71+
read -p "Deploy layers to commercial AWS (y/n)?" CONT
72+
if [ "$CONT" != "y" ]; then
73+
echo "Skipping deployment to commercial AWS"
74+
else
75+
echo "Ensuring you have access to the production AWS account"
76+
aws-vault exec sso-prod-engineering -- aws sts get-caller-identity
77+
78+
echo
79+
echo "Publishing layers to commercial AWS regions"
80+
VERSION=$LAYER_VERSION aws-vault exec sso-prod-engineering --no-session -- ./scripts/publish_layers.sh
81+
fi
82+
read -p "Deploy layers to GovCloud AWS (y/n)?" CONT
83+
if [ "$CONT" != "y" ]; then
84+
echo "Skipping deployment to GovCloud AWS"
85+
else
86+
echo "Ensuring you have access to the AWS GovCloud account"
87+
ddsaml2aws login -a govcloud-us1-fed-human-engineering
88+
AWS_PROFILE=govcloud-us1-fed-human-engineering aws sts get-caller-identity
7289

73-
echo "Publishing layers to GovCloud AWS regions"
74-
ddsaml2aws login -a govcloud-us1-fed-human-engineering
75-
VERSION=$LAYER_VERSION AWS_PROFILE=govcloud-us1-fed-human-engineering ./scripts/publish_layers.sh
90+
echo "Publishing layers to GovCloud AWS regions"
91+
ddsaml2aws login -a govcloud-us1-fed-human-engineering
92+
VERSION=$LAYER_VERSION AWS_PROFILE=govcloud-us1-fed-human-engineering ./scripts/publish_layers.sh
93+
fi
7694

95+
echo "Answer 'n' if GitLab already did this"
7796
read -p "Ready to publish $NEW_VERSION to PyPI (y/n)?" CONT
7897
if [ "$CONT" != "y" ]; then
79-
echo "Exiting"
80-
exit 1
98+
echo "Skipping publishing to PyPI"
99+
else
100+
echo
101+
echo "Publishing to https://pypi.org/project/datadog-lambda/"
102+
./scripts/pypi.sh
81103
fi
82104

83-
echo
84-
echo "Publishing to https://pypi.org/project/datadog-lambda/"
85-
./scripts/pypi.sh
86105

87-
echo
88-
echo 'Publishing updates to github'
89-
git commit pyproject.toml -m "Bump version to ${NEW_VERSION}"
90-
git push origin main
91-
git tag "v$LAYER_VERSION"
92-
git push origin "refs/tags/v$LAYER_VERSION"
106+
echo "Answer 'n' if you already released in GitHub"
107+
read -p "Do you want to bump the version in GitHub? (y/n)" CONT
108+
if [ "$CONT" != "y" ]; then
109+
echo "Skipping publishing updates to GitHub"
110+
else
111+
echo
112+
echo 'Publishing updates to github'
113+
git commit pyproject.toml -m "Bump version to ${NEW_VERSION}"
114+
git push origin main
115+
git tag "v$LAYER_VERSION"
116+
git push origin "refs/tags/v$LAYER_VERSION"
117+
fi
93118

94119
echo
95-
echo "Now create a new release with the tag v${LAYER_VERSION} created"
120+
echo "Now create a new release with the tag v${LAYER_VERSION} created unless you have done this already"
96121
echo "https://github.com/DataDog/datadog-lambda-python/releases/new?tag=v$LAYER_VERSION&title=v$LAYER_VERSION"
97122
# Open a PR to the documentation repo to automatically bump layer version
98123
VERSION=$LAYER_VERSION LAYER=datadog-lambda-python ./scripts/create_documentation_pr.sh

0 commit comments

Comments
 (0)