Skip to content

Commit ee95905

Browse files
authored
chore: skip post_build on build failure (#18365)
According to the docs on CodeBuild [build transitions], the `POST_BUILD` step is always run after `BUILD`, even if `BUILD` fails. This can mean in our pipeline we can fail the build, and then wait for the (currently very expensive) packing step to run completely before the job fails. This change short-circuits the logic so we only run pack if the build succeeded. [build transitions]: https://docs.aws.amazon.com/codebuild/latest/userguide/view-build-details.html ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 856d170 commit ee95905

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

buildspec.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ phases:
2727
- /bin/bash ./scripts/transform.sh
2828
post_build:
2929
commands:
30+
# Short-circuit: Don't run pack if the above build failed.
31+
- '[[ "$CODEBUILD_BUILD_SUCCEEDING" -eq 1 ]] || exit 1'
3032
- "[ -f .BUILD_COMPLETED ] && /bin/bash ./pack.sh"
3133
- /bin/bash ./scripts/cache-store.sh
3234
artifacts:

0 commit comments

Comments
 (0)