Skip to content

Commit 2200b15

Browse files
tomcat323tomzu
andauthored
feat(release): check for marketplace update (aws#6426)
## Problem Our release MCM currently has a step for each extension (Toolkit and Q) that requires the human operator to wait and check for the marketplace publish and then try to install from the marketplace. This uses human time and can easily be automated. ## Solution Added a final stage in release pipeline: https://code.amazon.com/reviews/CR-173945904/revisions/1#/commits that runs this YML build script that automatically installs and uninstalls the extension from marketplace on a two minute interval. When the version matches the new release version, the code-build succeeds: <img width="768" alt="Screenshot 2025-01-23 at 2 44 45 PM" src="https://github.com/user-attachments/assets/93f80a6d-573c-4524-995c-6491ecf1fb6f" /> When it doesn't, it keeps retrying until the timeout limit is reached (1 hour): <img width="694" alt="Screenshot 2025-01-23 at 4 52 07 PM" src="https://github.com/user-attachments/assets/c5433383-1194-4ec4-845a-4e63d8959cf7" /> --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license. --------- Co-authored-by: tomzu <[email protected]>
1 parent 0d8c8fc commit 2200b15

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
version: 0.2
2+
3+
phases:
4+
install:
5+
runtime-versions:
6+
nodejs: 16
7+
8+
commands:
9+
- apt update
10+
- apt install -y wget gpg
11+
- curl -sSL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
12+
- install -o root -g root -m 644 packages.microsoft.gpg /etc/apt/trusted.gpg.d/
13+
- sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'
14+
- apt update
15+
- apt install -y code
16+
17+
pre_build:
18+
commands:
19+
# Check for implicit env vars passed from the release pipeline.
20+
- test -n "${TARGET_EXTENSION}"
21+
22+
build:
23+
commands:
24+
- VERSION=$(node -e "console.log(require('./packages/${TARGET_EXTENSION}/package.json').version);")
25+
# get extension name
26+
- |
27+
if [ "${TARGET_EXTENSION}" = "amazonq" ]; then
28+
extension_name="amazonwebservices.amazon-q-vscode"
29+
elif [ "${TARGET_EXTENSION}" = "toolkit" ]; then
30+
extension_name="amazonwebservices.aws-toolkit-vscode"
31+
else
32+
echo checkmarketplace: "Unknown TARGET_EXTENSION: ${TARGET_EXTENSION}"
33+
exit 1
34+
fi
35+
# keep reinstalling the extension until the desired version is updated. Otherwise fail on codebuild timeout (1 hour).
36+
- |
37+
while true; do
38+
code --uninstall-extension "${extension_name}" --no-sandbox --user-data-dir /tmp/vscode
39+
code --install-extension ${extension_name} --no-sandbox --user-data-dir /tmp/vscode
40+
cur_version=$(code --list-extensions --show-versions --no-sandbox --user-data-dir /tmp/vscode | grep ${extension_name} | cut -d'@' -f2)
41+
if [ "${cur_version}" = "${VERSION}" ]; then
42+
echo "checkmarketplace: Extension ${extension_name} is updated to version '${cur_version}.'"
43+
break
44+
else
45+
echo "checkmarketplace: Current version '${cur_version}' does not match expected version '${VERSION}'. Retrying..."
46+
fi
47+
sleep 120 # Wait for 2 minutes before retrying
48+
done

0 commit comments

Comments
 (0)