Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question Can I run a script when the cloud build fails?

Discussion in 'Unity Build Automation' started by JamesSozoLabs, Feb 2, 2023.

  1. JamesSozoLabs

    JamesSozoLabs

    Joined:
    Jan 10, 2022
    Posts:
    13
    Hey,

    Is there a way to execute a script when the Unity Cloud Build fails?

    Currently as part of our Post Build Scripts we're sending a message to our project's Slack channel when a build is successful.
    We would like to also send a message to the Slack channel when a build fails, potentially with a reason.

    Is there anyway to have a specific script execute when a build fails?
     
  2. tonemcbride

    tonemcbride

    Joined:
    Sep 7, 2010
    Posts:
    1,077
    If you click 'Integrations' in the project you can add webhooks or slack notifications when builds fail or succeed. I'm not sure if you get much information passed through though. In the past I made a webhook that called a script on our server which then posted a Teams message along with a link to the build log so maybe that's something you could do.

    upload_2023-2-2_11-3-56.png

    upload_2023-2-2_11-4-24.png
     
    Last edited: Feb 2, 2023
  3. JamesSozoLabs

    JamesSozoLabs

    Joined:
    Jan 10, 2022
    Posts:
    13
    Awesome, thank you so much!

    I actually never knew about the Integration section.

    Wrote a Post Processing script that returned the build data to us.

    Curious to see what formatting this comes in.
     
    tonemcbride likes this.
  4. tonemcbride

    tonemcbride

    Joined:
    Sep 7, 2010
    Posts:
    1,077