...
Click the Manage Providers button and then the Create Provider button to create a new Provider.
To start with I am simply going to return true here to allow any message through (we will update this later on but right now we just want the message to get through). Click Save.
...
Now that we have our Provider, navigate Back to the Webhook Functions screen. You should now see your GitHub Provider set up top. Click Create Function to create a Function for the GitHub Provider.
Similar to the Provider Script, we will circle back here and flesh this out, but for now we just simply log that we ran the function and finish. Notice the Full Resource Path that is displayed. This is the resource path we will ultimately give to GitHub to call our Function. Make the updates as I have done here and click Save.
...
If you are running this command on the FlexDeploy server you can omit the server and just specify the port. In this case that is exactly what we are doing:
Copy your new public endpoint (http or https works for GitHub). Lastly we need to append the Full Resource Path from our Function. Our full url looks like the following:
...
With the GitHub webhook enabled all we need to do is push a change to the repository. After pushing a change, navigate to Webhook Messages to ensure we received the event.
Building the Project
...
Now that we have communication between GitHub and FlexDeploy we can enhance our scripts to make sure it does what we expect. Edit your BuildProject Function by clicking on the name.
Update the Function script to the following:
...
First we need to Enable Webhooks for the Project.
Testing it out
...
Info | ||
---|---|---|
| ||
You also have the option to resubmit messages from the Webhook Messages UI. Since we added the query parameter, resubmitting the original message would not work in this case. |
Drill into the execution and check out the change logs to see the changes from your push.
...
Info | ||
---|---|---|
| ||
Providers also can also have secured properties associated with them. Normally this would be used instead of putting the secret in plain text in our script as seen here. |
Final Validation
Lastly lets push one more time and validate everything is still working.
Be sure to turn off your ngrok tunnel when you are done!