Skip to content

Conversation

@huanjani
Copy link
Contributor

Fixes #3072.

If a workload manifest fails, the pipeline build stage will fail, too, but only after many more steps, logs, and time. The validation error gets buried, and it isn't obvious that it's the cause of the failure.

This change checks if the params.json file that would be generated upon successful manifest validation is empty; if it is, the build exits with a suggestion to look for a manifest validation error message. There are, of course, still logs to wade through, but this should make the point of failure easier to pinpoint.

Manually tested with invalid service manifest (ARM + Spot), valid service manifest, invalid job manifest (bad platform), valid job manifest.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the Apache 2.0 License.

@huanjani huanjani requested a review from a team as a code owner November 29, 2021 23:48
@huanjani huanjani requested review from efekarakus and removed request for a team November 29, 2021 23:48
tag=$(sed 's/:/-/g' <<<"${CODEBUILD_BUILD_ID##*:}-${env}" | rev | cut -c 1-128 | rev)
for svc in $svcs; do
./copilot-linux svc package -n $svc -e $env --output-dir './infrastructure' --tag $tag;
[ -s ./infrastructure/$svc-$env.params.json ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this mean 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It checks if a file is empty or not.
I've removed it, as we can just check the exit code from the svc package command.

Copy link
Contributor

@Lou1415926 Lou1415926 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!

@mergify mergify bot merged commit 9334c7b into aws:mainline Nov 30, 2021
@huanjani huanjani deleted the fast-fail branch December 16, 2021 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

buildspec-- handle manifest validation failures

3 participants