sdm: How do i fail a build from a plugin?

Is there a way to get sdm to fail from a plugin? I’m doing everything I can think of and it’s still just chugging along assuming our custom plugin succeeded. I’m explicitly writing to stderr and exiting with a non 0 exit code

if [ $? -ne 0 ]; then >&2 echo "Failed to get claim.pem.crt from AWS" && exit 1; fi

sdm output

Failed to get claim.pem.crt from AWS
* Phase 0 Completed
* Enter image '../2023-05-03-raspios-bullseye-arm64-lite.img' for Phase 1

This is problematic because sdm will build an image that doesn’t have what we require. Worse, it’s burying the error message in the massive amount of output.

About this issue

  • Original URL
  • State: closed
  • Created 8 months ago
  • Comments: 27 (18 by maintainers)

Most upvoted comments

In the scenario I was testing, one of the apps specified no longer exists in a particular repository. You can reproduce this issue with something like --plugin apps:"apps=fakeappdoesntexist"

For this issue, the final return/exit code of SDM was not being set correctly. The error messages were printed as appropriate and the final return code was 0 despite the error. I’m not sure if that’s been corrected in the console output you shared

Ah! Thanks for the clarification. Will address.

Ah, so the failure is that the apps plugin doesn’t check status. Yes, indeed, it doesn’t now, but it will for the next release, which I’m planning for the week of March 18th due to some impending out-of-pocketness.

This is complete in V10.0. Please give it a go and LMK of any issues. Thx