Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Pilot Lvl 1
Message 1 of 12

Github Actions failure handling during deployment

Solved! Go to Solution.

Given a workflow that is triggered on = "deployment" I would like to both deploy and update the deployment-api. From what I gather I guess these are my alternatives:

 

1. Deploy action does a http call to deployments api on failure/success

2. Deploy action saves deploy result in a file and uses exit code 0 for success. The sequential action reads from that file and does a http call to deployments api.

3. Use checks api or a Github App to notify Deployments API on failure/success

 

1 I don't like because it is hard to reuse code. reuses code, but complicates deploy actions. would be great, but how?

 

Anyone doing something similar? All the examples I find, that does deployment, never updates the deployment api. Most of them just does deploy automatically if the branch is the master branch.

11 Replies
Highlighted
Community Manager
Message 2 of 12

Re: Github Actions failure handling during deployment

Thank you for taking the time to write your feedback! Hopefully, someone else here has a similar workflow and can share their experience. In the meanwhile,  I've taken your feedback and passed it along to the appropriate teams. 

Mark helpful posts with Accept as Solution to help other users locate important info. Don't forget to give Kudos for great content!

Solution
Pilot Lvl 1
Message 3 of 12

Re: Github Actions failure handling during deployment

I found a functional solution for this, going along with option number 1.

 

What I found to be working quite well, was to create a generic action that adds shell scripts which later actions can reuse. The scripts strive to be as minimal as possible, and has only one dependency, and that is curl

 

It worked pretty well for a couple of projects that we are testing on, and the code is made available at https://github.com/unacast/actions/tree/master/github-deploy

 

I'd much appreciate comments or even better - pull requests :)

Copilot Lvl 2
Message 4 of 12

Re: Github Actions failure handling during deployment

I’ve been trying to come up with a solution for this on and off for the past couple weeks.

Based on my experience I came up with two ideas but it would require help from GitHub.

1. It seems like it would be great if an action was allowed to run regardless if the action it depended on succeeded or failed. If something like this we’re possible i believe we could have a simple deployment status action that sends the update based on the status of the previous actions, but allowing that would obviously be a flag/option the user enables.

2. Since the workflow is kicked off on deployment events maybe GitHub should fire back the deployment status per action automagically for us. If an action succeeds fire a success action, but if one fails fire off a failure.

What do you think about those? I personally like #2 because it just seems cleaner to not have your workflow with a bunch of status actions. Also, in your case your actions don’t have to worry about firing off deployment statuses they just do their job.

I also wonder how we can send a request like that in for consideration?
Pilot Lvl 1
Message 5 of 12

Re: Github Actions failure handling during deployment

#1 Yes please :)

#2 That was my initial thought also. But that's was not how it is implemented to begin with. Maybe later down the line. I think it could be pretty clean. Although it might be difficult for the App that is subscribing to the events from the workflow to extract information that it would like to add to a deployment status event

 

I also wonder how we can send a request like that in for consideration?

I don't quite know, seems like this is the place. Admins replies to discussions I see, and informs that they are taking the matter to the development team.

Community Manager
Message 6 of 12

Re: Github Actions failure handling during deployment

Hi @jerrylopez!

 

Thanks for the suggestion! While we don't have an official place to submit feature requests, @judoole is correct that GitHub Staff does frequent the GitHub Community Forum and as admins and moderators, we do our best to capture this sort of feedback and share it with the teams who are in charge of designing and improving GitHub.

 

Speaking of which, I've passed your feedback on to the appropriate teams. I can't promise if we will implement this suggestion or when we can make that happen, but we're always looking for new solutions and if we do implement this feature, it will be announced in the GitHub changelog.

 

Thanks!

Copilot Lvl 3
Message 7 of 12

Re: Github Actions failure handling during deployment

Hey @judoole 👋🏽


This looks like a nice and simple solution until GitHub adds a tighter integration with their own Deployment API. Imho, as @jerrylopez pointed out, if an action is triggered by a `deployment` event, it would have be great if GitHub provided an option to update the deployment in question - automatically populating it with target url and description.

 

In the meanwhile, I've looked at your solution and got it working with SlashDeploy - a chatbot to manage deployments from Slack. I've created an aws-eb custom action, which uses your scripts and now I am finally getting deployment notifications into our Slack 🙌🏽.

 

There is some room for improvement, so expect from me a PR that would populate log url and deployment description soon 😉.

 

Cheers!

 

Pilot Lvl 1
Message 8 of 12

Re: Github Actions failure handling during deployment

Thanks @assimovt! And aws-eb looked great!

 

I've had a quick look at Slashdeploy recently, love the work you are doing! We are considering it to replace Hubot for deployments from Slack. Think I tried to register a couple of weeks ago, but I think it failed, probably because I'm don't have owner-rights of the Unacast organization or something. Love that you can specify configuration within the repository.

 

For now, I've tested using the Github Slack integration for notifications. It is trying to add a deploy action in near future, it seems like. But I think it won't be as feature friendly as Slashdeploy :)

Copilot Lvl 3
Message 9 of 12

Re: Github Actions failure handling during deployment

Thx, @judoole It's still in PoC as I can't get the log URL and description of the deployment. Also, noticed you've bumped into a similar issue and tested that it's not being exposed in `ENV`. I think we have to wait for that to come in from GitHub.

 

Regarding SlashDeploy registration failure - you should be able to request GitHub app installation from organization/repository admins. Mind dropping me an email to `tair [at] getslashdeploy [com]` so I could help you out? It'd be really awesome if Unacast benefited from all those features we've built to support team deployment workflow 😉

 

 

Pilot Lvl 1
Message 10 of 12

Re: Github Actions failure handling during deployment

Btw, did you find a solution to the create a log_url to the action @assimovt? I also asked that in https://github.community/t5/GitHub-API-Development-and/Github-Actions-url-to-run/m-p/16471#M506