Skip to content

Commit 94f4aa4

Browse files
chore: remove the govcloud bits from the publish_prod.sh script
1 parent 0e22507 commit 94f4aa4

File tree

1 file changed

+62
-82
lines changed

1 file changed

+62
-82
lines changed

scripts/publish_prod.sh

Lines changed: 62 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ set -e
66

77
read -p "Are we only doing the simplified GovCloud release? ONLY IF THE NORMAL RELEASE IS DONE AND YOU HAVE DOWNLOADED THE LAYERS (y/n)? " GOVCLOUD_ONLY
88

9+
if [ $GOVCLOUD_ONLY != "n" ]; then
10+
echo "GovCloud publishing is now supported only in publich_govcloud.sh"
11+
exit 1
12+
fi
13+
914
# Ensure on main, and pull the latest
1015
BRANCH=$(git rev-parse --abbrev-ref HEAD)
1116
if [ $BRANCH != "main" ]; then
@@ -34,107 +39,82 @@ else
3439
fi
3540

3641
# Ensure pypi registry access
37-
if [ $GOVCLOUD_ONLY == "y" ]; then
38-
echo "Skipping PyPI check since this is a GovCloud-only release"
39-
40-
else
41-
read -p "Do you have access to PyPI (y/n)?" CONT
42-
if [ "$CONT" != "y" ]; then
43-
echo "Exiting"
44-
exit 1
45-
fi
42+
read -p "Do you have access to PyPI (y/n)?" CONT
43+
if [ "$CONT" != "y" ]; then
44+
echo "Exiting"
45+
exit 1
4646
fi
4747

4848
CURRENT_VERSION=$(poetry version --short)
4949
LAYER_VERSION=$(echo $NEW_VERSION | cut -d '.' -f 2)
5050

51-
if [ $GOVCLOUD_ONLY == "y" ]; then
52-
echo "Skipping Libary Updates, code changes, layer builds and signing for GovCloud-only release"
51+
read -p "Ready to update the library version from $CURRENT_VERSION to $NEW_VERSION and publish layer version $LAYER_VERSION (y/n)?" CONT
52+
if [ "$CONT" != "y" ]; then
53+
echo "Exiting"
54+
exit 1
55+
fi
5356

57+
echo "Answer 'n' if already done in a PR"
58+
read -p "Update pyproject.toml version? (y/n)?" CONT
59+
if [ "$CONT" != "y" ]; then
60+
echo "Skipping updating package.json version"
5461
else
55-
read -p "Ready to update the library version from $CURRENT_VERSION to $NEW_VERSION and publish layer version $LAYER_VERSION (y/n)?" CONT
56-
if [ "$CONT" != "y" ]; then
57-
echo "Exiting"
58-
exit 1
59-
fi
60-
61-
echo "Answer 'n' if already done in a PR"
62-
read -p "Update pyproject.toml version? (y/n)?" CONT
63-
if [ "$CONT" != "y" ]; then
64-
echo "Skipping updating package.json version"
65-
else
66-
echo
67-
echo "Replacing version in pyproject.toml and datadog_lambda/version.py"
68-
echo
69-
70-
poetry version ${NEW_VERSION}
71-
echo "__version__ = \"${NEW_VERSION}\"" > datadog_lambda/version.py
72-
fi
73-
7462
echo
75-
echo "Building layers..."
76-
./scripts/build_layers.sh
77-
63+
echo "Replacing version in pyproject.toml and datadog_lambda/version.py"
7864
echo
79-
echo "Signing layers for commercial AWS regions"
80-
aws-vault exec sso-prod-engineering -- ./scripts/sign_layers.sh prod
81-
82-
echo "Answer 'n' if GitLab already did this"
83-
read -p "Deploy layers to commercial AWS (y/n)?" CONT
84-
if [ "$CONT" != "y" ]; then
85-
echo "Skipping deployment to commercial AWS"
86-
else
87-
echo "Ensuring you have access to the production AWS account"
88-
aws-vault exec sso-prod-engineering -- aws sts get-caller-identity
89-
90-
echo
91-
echo "Publishing layers to commercial AWS regions"
92-
VERSION=$LAYER_VERSION aws-vault exec sso-prod-engineering --no-session -- ./scripts/publish_layers.sh
93-
fi
65+
66+
poetry version ${NEW_VERSION}
67+
echo "__version__ = \"${NEW_VERSION}\"" > datadog_lambda/version.py
9468
fi
9569

96-
read -p "Deploy layers to GovCloud AWS (y/n)?" CONT
70+
echo
71+
echo "Building layers..."
72+
./scripts/build_layers.sh
73+
74+
echo
75+
echo "Signing layers for commercial AWS regions"
76+
aws-vault exec sso-prod-engineering -- ./scripts/sign_layers.sh prod
77+
78+
echo "Answer 'n' if GitLab already did this"
79+
read -p "Deploy layers to commercial AWS (y/n)?" CONT
9780
if [ "$CONT" != "y" ]; then
98-
echo "Skipping deployment to GovCloud AWS"
81+
echo "Skipping deployment to commercial AWS"
9982
else
100-
echo "Ensuring you have access to the AWS GovCloud account"
101-
aws-vault exec sso-govcloud-us1-fed-engineering -- aws sts get-caller-identity
83+
echo "Ensuring you have access to the production AWS account"
84+
aws-vault exec sso-prod-engineering -- aws sts get-caller-identity
10285

103-
echo "Publishing layers to GovCloud AWS regions"
104-
VERSION=$LAYER_VERSION aws-vault exec sso-govcloud-us1-fed-engineering -- ./scripts/publish_layers.sh
86+
echo
87+
echo "Publishing layers to commercial AWS regions"
88+
VERSION=$LAYER_VERSION aws-vault exec sso-prod-engineering --no-session -- ./scripts/publish_layers.sh
10589
fi
10690

107-
if [ $GOVCLOUD_ONLY == "y" ]; then
108-
echo "Skipping PyPI check and Github Release since this is a GovCloud-only release"
109-
91+
echo "Answer 'n' if GitLab already did this"
92+
read -p "Ready to publish $NEW_VERSION to PyPI (y/n)?" CONT
93+
if [ "$CONT" != "y" ]; then
94+
echo "Skipping publishing to PyPI"
11095
else
111-
echo "Answer 'n' if GitLab already did this"
112-
read -p "Ready to publish $NEW_VERSION to PyPI (y/n)?" CONT
113-
if [ "$CONT" != "y" ]; then
114-
echo "Skipping publishing to PyPI"
115-
else
116-
echo
117-
echo "Publishing to https://pypi.org/project/datadog-lambda/"
118-
./scripts/pypi.sh
119-
fi
120-
121-
122-
echo "Answer 'n' if you already released in GitHub"
123-
read -p "Do you want to bump the version in GitHub? (y/n)" CONT
124-
if [ "$CONT" != "y" ]; then
125-
echo "Skipping publishing updates to GitHub"
126-
else
127-
echo
128-
echo 'Publishing updates to github'
129-
git commit pyproject.toml datadog_lambda/version.py -m "Bump version to ${NEW_VERSION}"
130-
git push origin main
131-
git tag "v$LAYER_VERSION"
132-
git push origin "refs/tags/v$LAYER_VERSION"
133-
fi
96+
echo
97+
echo "Publishing to https://pypi.org/project/datadog-lambda/"
98+
./scripts/pypi.sh
99+
fi
100+
134101

102+
echo "Answer 'n' if you already released in GitHub"
103+
read -p "Do you want to bump the version in GitHub? (y/n)" CONT
104+
if [ "$CONT" != "y" ]; then
105+
echo "Skipping publishing updates to GitHub"
106+
else
135107
echo
136-
echo "Now create a new release with the tag v${LAYER_VERSION} created unless you have done this already"
137-
echo "https://github.com/DataDog/datadog-lambda-python/releases/new?tag=v$LAYER_VERSION&title=v$LAYER_VERSION"
108+
echo 'Publishing updates to github'
109+
git commit pyproject.toml datadog_lambda/version.py -m "Bump version to ${NEW_VERSION}"
110+
git push origin main
111+
git tag "v$LAYER_VERSION"
112+
git push origin "refs/tags/v$LAYER_VERSION"
138113
fi
114+
115+
echo
116+
echo "Now create a new release with the tag v${LAYER_VERSION} created unless you have done this already"
117+
echo "https://github.com/DataDog/datadog-lambda-python/releases/new?tag=v$LAYER_VERSION&title=v$LAYER_VERSION"
118+
139119
# Open a PR to the documentation repo to automatically bump layer version
140120
VERSION=$LAYER_VERSION LAYER=datadog-lambda-python ./scripts/create_documentation_pr.sh

0 commit comments

Comments
 (0)