Skip to content

Commit a72c582

Browse files
authored
Run-wrapper for services. (dart-lang#9423)
1 parent 4a3772c commit a72c582

4 files changed

Lines changed: 25 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ AppEngine version, listed here to ease deployment and troubleshooting.
1010
* Bump runtimeVersion to `2026.06.03`.
1111
* Upgraded stable Dart analysis SDK to `3.12.1`
1212
* Upgraded stable Flutter analysis SDK to `3.44.1`.
13+
* Note: started to use `tool/run-wrapper.sh`
1314

1415
## `20260601t084200-all`
1516
* Bump runtimeVersion to `2026.06.01`.

Dockerfile.app

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ COPY --from=go-build /project/pkg/signature_verifier/signature_verifier /project
7070
COPY --from=build /project/app/search_index.dill /project/app/search_index.dill
7171
COPY --from=build /project/app/sdk_isolate_index.dill /project/app/sdk_isolate_index.dill
7272

73+
COPY --from=build /bin/sh /bin/sh
74+
COPY --from=build /bin/sleep /bin/sleep
75+
COPY --from=build /project/tool/run-wrapper.sh /project/tool/run-wrapper.sh
76+
7377
WORKDIR /project/app
7478
EXPOSE 8080
75-
ENTRYPOINT ["/usr/lib/dart/bin/dart", "/project/app/server.jit"]
79+
ENTRYPOINT ["/project/tool/run-wrapper.sh", "/usr/lib/dart/bin/dart", "/project/app/server.jit"]

Dockerfile.worker

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,4 @@ ENV SANDBOX_RUNNER="${PUB_WORKER_BUILD_DIR}/sandbox_runner"
7676

7777
# This container image is launched by cloud-init, and cloud-init is responsible
7878
# for shutting down the VM when the container exits.
79-
ENTRYPOINT ["pub_worker"]
79+
ENTRYPOINT ["/home/worker/pub-dev/tool/run-wrapper.sh", "pub_worker"]

tool/run-wrapper.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/sh
2+
# Wrapper script that runs a command and logs exit status to stderr,
3+
# sleeping 10 seconds before exiting to allow log collection.
4+
5+
set -u
6+
7+
"$@"
8+
EXIT_CODE=$?
9+
10+
if [ "$EXIT_CODE" -eq 0 ]; then
11+
echo '{"message": "[pub-run-wrapper-exited]", "severity": "NOTICE", "component": "pub-run-wrapper"}' >&2
12+
sleep 3
13+
else
14+
echo '{"message": "[pub-run-wrapper-failed] exit code $EXIT_CODE", "severity": "CRITICAL", "component": "pub-run-wrapper"}' >&2
15+
sleep 10
16+
fi
17+
18+
exit "$EXIT_CODE"

0 commit comments

Comments
 (0)