Is it possible to get commit hash sent via webhook
I am currently receiving webhook events from my railway deployment, and I was wondering if it is possible to make it so that my railway webhook sends me the commit hash associated with the current build/deployment?
20 Replies
Project ID:
0423feca-1d4b-493b-a9fa-18ffa127a486
0423feca-1d4b-493b-a9fa-18ffa127a486
i thought they already did?
that example json in the web ui is just a small fraction of the data actually sent
@Brody I don't see a sha
commit sha **
@brody I think i just foudn
apologies have been absolutely blowing up your line these past few days
no worries but please enclose code blocks with triple backticks
you got it
Also I am pretty sure I don't get a commit sha when railway up is called from a github workflow.. not sure why
investigating
of course not
not sure if this makes a difference but the workflow is initiated on PR
it wasn't deployed from github, it was technically deployed from the filesystem
fair
looking for some work around
related to our earlier thread about using a --wait flag on the cli, I am just using webhooks and a proxy to solve the issue for now. Am close
the workflow polls the proxy until an update on the deployment can be given
what would the commit hash be used for in this scenario? couldn't you use the service id?
logical flow is as follows
1. Deployment gets initiated from workflow, and it begins to poll proxy
2. Right after, webhook is sent from Railway to proxy with the Deployment status and obviously abunch of other stuff that gets sent from railway's webhook
3. The commitHash is taken (or I try to take it) from the railway webhook and I use that as a key in a redis cache that holds the deployment status
4. Every time that the workflow polls for an update, it hits the cache which delivers the most current state held by the commitHash key which is available via a global variable in a github workflow file
5. When an update comes in from Railway saying that the deployment status has changed: SUCCESS, FAILURE... I update the key in the redis cache
6. Next time the poll hits, it will get that updated status
If that makes sense
so essentially the commitHash is the key piece of information that links both the railway deployment and the workflow
and since the workflow runs on PR, you will always be getting the updated value for your specific PR
since the commitHash belongs to that PR
makes sense
Yeah
but yeah no hash from something done with railway up
I just need one unique piece of information that is shared and available via the webhook payload and what's available to me in the workflow
yeah
Any other ideas of something I can use as a key
you'd first need to be able to see this key in your github workflow right?
Yes, I can see the key
its available via this global
in workflow
railway up also doesn't provide a way to add variables to a service during deployment
I don't currently have any ideas for a key you could use
no worries
Thanks for helping