Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Unity Cloud Build To HockeyApp

Discussion in 'Unity Build Automation' started by MatmiDeveloper, Aug 21, 2016.

  1. MatmiDeveloper

    MatmiDeveloper

    Joined:
    Sep 27, 2013
    Posts:
    10
    Unity Cloud Build To HockeyApp
    A NodeJS application to automate binary deployments from Unity Cloud Build to HockeyApp.



    Note; This is an initial release which is functional, but needs refactoring.

    App Flow
    1. Receive a webhook from Unity Cloud Build to notify a build is ready.
    2. Get the build details from the JSON payload within the webhook.
    3. Download the app binary from the Unity Cloud Build API.
    4. Upload the app binary to HockeyApp.
    Requirements
    • Setup a Unity Cloud Build account and project.
    • Setup a HockeyApp account. HockeyApp will use the app package name to detemine which project to upload to.
    Installation
    1. Clone this repository.

    2. Add API keys to '.env' for both Unity Cloud Build and HockeyApp.
      • UCB API key can be obtained here.
      • HockeyApp API key can be created here. Be sure to create a key 'Upload' rights (e.g. anything above 'Read Only').
    3. Deploy.
      • Have only tested running on Heroku.
    4. Setup the Unity Cloud Build webhook.
      • Within UCB, view your app. Click 'Notifications', then 'Add New' and enter your app URL with '/build' appended. E.g. 'http://[appurl]/build/'
      • Use a tool like Request Bin to test web hooks from UCB, ontain the payload and test requests to '/build/'.
    Notes
    • If you use Slack, integrate UCB and HockeyApp to be notified when a new build is ready and has been pused to HockeyApp. See screenshot above.
    • You don't need to setup the app on HockeyApp, if you upload the binary it will automatically create a new app instance.
    • Configure HockeyApp to automatically notify users after the binary has uploaded. See the 'notify' variable within the 'uploadToHockeyApp()' function. HockeyApp API
    Todo
    • Clean up and comment codebase.
    • Populate HockeyApp release notes with Git commit message.
    • Add logging feature to show builds processed and deployed.
    • Integrate job system to manage/prioritise jobs and view jobs in progress.
    Licenses
    Copyright 2016 Nathan Brodbent

    This software is licensed under Apache License 2.0.
     
    FaetterJens likes this.
  2. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    Pretty cool. We have been thinking of switching our crash reporting service and HockeyApp was one of the names i have on my list of services to check.

    Can this app be generalized to work with other services as well?
     
  3. MatmiDeveloper

    MatmiDeveloper

    Joined:
    Sep 27, 2013
    Posts:
    10
    Sure, this could easily be adapted to deploy to another service providing they have an API that allows you to upload the binary.

    HockeyApp is great. It will also group crashes then create tickets in your bug tracker system automatically.
    Although, our favourite feature in the HockeyApp SDK is the ability to notify and update apps within the app itself.

    https://support.hockeyapp.net/kb/cl...eyapp-for-android-sdk#add-update-distribution
    https://support.hockeyapp.net/kb/client-integration-ios-mac-os-x-tvos/hockeyapp-for-ios#betaupdates
     
  4. l7ocHoliday

    l7ocHoliday

    Joined:
    Aug 29, 2014
    Posts:
    6
    @MatmiDeveloper

    Thank you for this and providing it on GitHub. We used Hockeyapp on our last project and it was a great help.

    However, I'm not able to get this properly setup. I keep getting an error when I test the Webhook request.

    Code (JavaScript):
    1. 017-10-23T11:46:49.044198+00:00 app[web.1]: TypeError: Cannot read property 'api_self' of undefined
    2. 2017-10-23T11:46:49.044201+00:00 app[web.1]:     at /app/index.js:56:37
    3. 2017-10-23T11:46:49.044202+00:00 app[web.1]:     at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
    4. 2017-10-23T11:46:49.044203+00:00 app[web.1]:     at next (/app/node_modules/express/lib/router/route.js:131:13)
    5. 2017-10-23T11:46:49.044204+00:00 app[web.1]:     at /app/node_modules/body-parser/lib/read.js:129:5
    6. 2017-10-23T11:46:49.044208+00:00 app[web.1]:     at invokeCallback (/app/node_modules/raw-body/index.js:262:16)
    7. 2017-10-23T11:46:49.044208+00:00 app[web.1]:     at done (/app/node_modules/raw-body/index.js:251:7)
    8. 2017-10-23T11:46:49.044209+00:00 app[web.1]:     at IncomingMessage.onEnd (/app/node_modules/raw-body/index.js:307:7)
    9. 2017-10-23T11:46:49.044210+00:00 app[web.1]:     at emitNone (events.js:86:13)
    10. 2017-10-23T11:46:49.044210+00:00 app[web.1]:     at IncomingMessage.emit (events.js:185:7)
    11. 2017-10-23T11:46:49.044211+00:00 app[web.1]:     at endReadableNT (_stream_readable.js:974:12)
    I setup the .env with my API keys for UCB & Hockeyapp. Then I also setup environment variables inside of Heroku using this https://devcenter.heroku.com/articles/config-vars.

    Never used Node.js before and I'm still a noob when it comes to webhooks. Any ideas would be much appreciated.

    Thanks!
     
    SeanMcTex likes this.
  5. oldSerge_bxp

    oldSerge_bxp

    Joined:
    Sep 8, 2017
    Posts:
    1
    Hey man, just had this problem.

    Check the following in your Unity Cloud webhook:
    1. URL= [YOUR APP URL]/build (NOT ([YOUR APP URL]/build/")
    2. Make sure that "Include Share Link" is enabled
     
  6. HugoAtLion

    HugoAtLion

    Joined:
    Mar 25, 2020
    Posts:
    4