Skip to content

Commit 9f8e224

Browse files
authored
chore: update script to increment govcloud layer in docs (#3889)
1 parent 02b3cda commit 9f8e224

File tree

3 files changed

+60
-18
lines changed

3 files changed

+60
-18
lines changed

.github/scripts/update_layer_arn.sh

+31-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#!/bin/bash
22

3-
# This script is run during the reusable_update_v2_layer_arn_docs CI job,
3+
# This script is run during the publish_layer workflow,
44
# and it is responsible for replacing the layer ARN in our documentation,
5-
# based on the output files generated by CDK when deploying to each pseudo_region.
5+
# based on the output files generated by CDK.
66
#
7-
# see .github/workflows/reusable_deploy_v2_layer_stack.yml
7+
# see .github/workflows/publish_layer.yml
88

99
set -eo pipefail
1010

@@ -18,6 +18,7 @@ EOM
1818
fi
1919

2020
CDK_OUTPUT_DIR=$1
21+
DOCS_FILE="docs/getting-started/lambda-layers.md"
2122

2223
# Check if CDK output dir is a directory
2324
if [ ! -d "$CDK_OUTPUT_DIR" ]; then
@@ -44,7 +45,7 @@ for file in $files; do
4445
# Now replace the all "prefix"s in the file with the full new Layer ARN (line)
4546
# prefix:\d+ ==> line
4647
# sed doesn't support \d+ in a portable way, so we cheat with (:digit: :digit: *)
47-
sed -i -e "s/$prefix:[[:digit:]][[:digit:]]*/$line/g" docs/index.md
48+
sed -i -e "s/$prefix:[[:digit:]][[:digit:]]*/$line/g" $DOCS_FILE
4849

4950
# We use the eu-central-1 layer as the version for all the frameworks (SAM, CDK, SLS, etc)
5051
# We could have used any other region. What's important is the version at the end.
@@ -65,8 +66,33 @@ for file in $files; do
6566

6667
# Replace all the "prefix_pseudo_region"'s in the file
6768
# prefix_pseudo_region:\d+ ==> line_pseudo_region
68-
sed -i -e "s/$prefix_pseudo_region:[[:digit:]][[:digit:]]*/$line_pseudo_region/g" docs/index.md
69+
sed -i -e "s/$prefix_pseudo_region:[[:digit:]][[:digit:]]*/$line_pseudo_region/g" $DOCS_FILE
6970
done
7071
fi
7172
done
7273
done
74+
75+
echo "[+] Finished processing all commercial regions"
76+
77+
# Now we need to process GovCloud regions
78+
#
79+
# GovCloud layers are not available in the CDK output files, but we know the ARN format and that the version is the same
80+
# as the one in eu-central-1. So we can optimistically update the version of the GovCloud layers in the documentation.
81+
#
82+
# The GovCloud ARNs are (note that the account IDs are different in both):
83+
# arn:aws-us-gov:lambda:us-gov-west-1:165093116878:layer:AWSLambdaPowertoolsTypeScriptV2:25
84+
# arn:aws-us-gov:lambda:us-gov-east-1:165087284144:layer:AWSLambdaPowertoolsTypeScriptV2:25
85+
86+
version=$(echo "$line" | cut -d ':' -f 8) # version = 25
87+
arn_us_gov_west_1="arn:aws-us-gov:lambda:us-gov-west-1:165093116878:layer:AWSLambdaPowertoolsTypeScriptV2:$version"
88+
prefix_us_gov_west_1=$(echo "$arn_us_gov_west_1" | cut -d ':' -f 1-7)
89+
arn_us_gov_east_1="arn:aws-us-gov:lambda:us-gov-east-1:165087284144:layer:AWSLambdaPowertoolsTypeScriptV2:$version"
90+
prefix_us_gov_east_1=$(echo "$arn_us_gov_east_1" | cut -d ':' -f 1-7)
91+
echo -e "\t[*] ARN GovCloud US West 1: $arn_us_gov_west_1"
92+
echo -e "\t[*] ARN GovCloud US East 1: $arn_us_gov_east_1"
93+
# Replace all the "arn_us_gov_west_1"'s in the file
94+
sed -i -e "s/$prefix_us_gov_west_1:[[:digit:]][[:digit:]]*/$arn_us_gov_west_1/g" $DOCS_FILE
95+
# Replace all the "arn_us_gov_east_1"'s in the file
96+
sed -i -e "s/$prefix_us_gov_east_1:[[:digit:]][[:digit:]]*/$arn_us_gov_east_1/g" $DOCS_FILE
97+
echo "[+] Finished processing all GovCloud regions"
98+
echo "[+] Finished processing all regions"

.github/workflows/publish_layer.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ jobs:
110110
id: create-pr
111111
uses: ./.github/actions/create-pr
112112
with:
113-
files: 'docs/index.md'
113+
files: 'docs/getting-started/lambda-layers.md'
114114
temp_branch_prefix: 'ci-layer-docs'
115115
pull_request_title: 'chore(ci): update layer ARN on documentation'
116116
github_token: ${{ secrets.GITHUB_TOKEN }}

docs/maintainers.md

+28-12
Original file line numberDiff line numberDiff line change
@@ -163,18 +163,22 @@ Some examples using our initial and new RFC templates: [#447](https://github.com
163163

164164
### Releasing a new version
165165

166-
Firstly, make sure all the PRs that you want to include in the release are merged into the `main` branch.
167-
168-
Next, run the integration tests one last time to make sure everything is working as expected. See [Run end to end tests](#run-end-to-end-tests) for more details.
169-
170-
**Looks good, what's next?**
171-
172-
Kickoff the `Make Release` workflow with the intended version - this might take around 20m-25m to complete.
166+
Releasing a new version is a multi-step process that requires up to 3 hours to complete. Below a checklist of the main steps to follow:
167+
168+
1. **End to end tests**: Run the [e2e tests](#run-end-to-end-tests) and make sure they pass.
169+
2. **Version bump**: Run the `Make Version` workflow to bump the version. This will create a PR with the new version and a changelog. Visually inspect the diff and make sure the changelog and version are correct, then merge the PR.
170+
3. **Make Release**: Run the `Make Release` workflow. This will: 1/ run the unit tests again, 2/ build and publish to npmjs.com, 3/ build and deploy the Lambda layers to beta and prod, 4/ run canary tests, 5/ update the documentation with the new version.
171+
4. **Review and approve docs PR**: Once the `Make Release` workflow is complete, a PR will be created to update the documentation with the new version. Review and approve this PR **but do not merge it yet**. Take note of the Lambda layer version that was deployed, as this will be used in the next step.
172+
5. **Publish GovCloud Layers (Gamma)**: Run the `Layer Deployment (GovCloud)` workflow with the `main` branch, targeting the `gamma` account, and using the Lambda layer version from the previous step. This will publish the Lambda layers to GovCloud. Visually inspect the output JSON files and make sure the Lambda layer version and package version are correct.
173+
6. **Publish GovCloud Layers (Prod)**: Run the `Layer Deployment (GovCloud)` workflow with the `main` branch, targeting the `prod` account, and using the Lambda layer version from the previous step. This will publish the Lambda layers to GovCloud. Visually inspect the output JSON files and make sure the Lambda layer version and package version are correct.
174+
7. **Merge docs PR**: Once the `Layer Deployment (GovCloud)` workflow is complete, merge the PR to update the documentation with the new version.
175+
8. **Update SSM Parameters (Beta)**: Run the `SSM Parameters` workflow with the `main` branch, targeting the `beta` account, and using the package version from npm (i.e. `2.20.0`) and Lambda layer version from the previous steps. This will update the SSM parameters with the new version.
176+
9. **Verify SSM Parameters (Beta)**: Use the AWS CLI to verify that the SSM parameters were updated correctly. Run the following command: `aws ssm get-parameter --name=/aws/service/powertools/typescript/generic/all/latest` and `aws ssm get-parameter --name=/aws/service/powertools/typescript/generic/all/<version>` to verify that the SSM parameters were updated correctly.
177+
10. **Update SSM Parameters (Prod)**: Run the `SSM Parameters` workflow with the `main` branch, targeting the `prod` account, and using the package version from npm (i.e. `2.20.0`) and Lambda layer version from the previous steps. This will update the SSM parameters with the new version.
178+
11. **Update Docs**: Run the `Rebuild latest docs` workflow with the `main` branch using the package version from npm (i.e. `2.20.0`). This will update the documentation with the new version.
173179

174180
Once complete, you can start drafting the release notes to let customers know **what changed and what's in it for them (a.k.a why they should care)**. We have guidelines in the release notes section so you know what good looks like.
175181

176-
> **NOTE**: Documentation might take a few minutes to reflect the latest version due to caching and CDN invalidations.
177-
178182
#### Release process visualized
179183

180184
Every release makes dozens of checks, linting, canaries and deployments - all of these are automated through a number of distinct workflows that together make up the release process.
@@ -228,13 +232,25 @@ section Docs
228232
Create commit (Layer ARN) : active, 10:18, 8s
229233
Open docs PR : active, 8s
230234
231-
Review andmerge docs PR : milestone, m5
235+
Review and merge docs PR : milestone, m5
232236
233237
Publish updated docs : active, 2m
234238
235-
Documentation release : milestone, m6
239+
section GovCloud
240+
Publish GovCloud layers (Beta) : active, 8s
241+
Publish GovCloud layers (Prod) : active, 8s
242+
GovCloud layers published : milestone, m6
243+
244+
245+
section Documentation
246+
Update SSM parameters (Beta) : active, 8s
247+
Update SSM parameters (Prod) : active, 8s
248+
249+
SSM Parameters updated: milestone, m7
250+
251+
Documentation release : milestone, m8
236252
237-
Release complete : milestone, m7
253+
Release complete : milestone, m9
238254
```
239255

240256
#### Drafting release notes

0 commit comments

Comments
 (0)