Search Unity

Slack notification only for certain build configurations

Discussion in 'Unity Build Automation' started by Red-Owl-Games, Jan 31, 2017.

  1. Red-Owl-Games

    Red-Owl-Games

    Joined:
    Feb 4, 2015
    Posts:
    28
    Hi!

    I am setting up Unity Cloud Build for a small team of four people. We've got Slack so I thought it'd be nice to use that as a way of notifying other team members that a new build has finished.

    Currently I have two build configurations: one for the git feature branch I will be working on at that time, and one for the main development branch. I want notifications sent only when a new build has been made on the development branch.

    The problem is that notifications are sent for successful builds of both the 'feature' and the 'development' branch. I only want a notification when the development branch successfully builds.

    It seems there is no built-in functionality for this. I set out to write a custom webhook that checks the contents of the POST Unity sends and manually check its body for the buildTargetName to check if it is the development branch. If that's the case, it'll pass the entire contents on to a slack webhook. If not, it'll simply do nothing.

    The idea is clear but I don't know how to actually implement this. I have a site I can host php files on and I've been trying to follow along with this blostpost, (https://davidwalsh.name/curl-post) but I'm stuck at two points: I'm unable to “compile php with cURL” and I'm not sure how to extract the POST body data.

    I'm not knowledgeable about a lot of the technical details of the web.

    Is there anyone who can give some advice on how I should proceed? If this can be solved without custom webhooks that's fine too!
     
  2. dannyd

    dannyd

    Unity Technologies

    Joined:
    Jun 3, 2014
    Posts:
    786
    Probably much easier to just set up two different projects in cloud build that point to the same repo, and then only set up slack notifications for one of them.
     
  3. Red-Owl-Games

    Red-Owl-Games

    Joined:
    Feb 4, 2015
    Posts:
    28