...
The very first step before we can consider building a project is to simply get a Github message into FlexDeploy so we know what we are dealing with. For this to occur there are 4 things we need
A FlexDeploy Webhook Provider for GitHub
A FlexDeploy Webhook Function - this is what will ultimately build our Project
A public endpoint for GitHub to send the message to.
A GitHub Repository with Webhooks enabled.
Creating the GitHub Provider
Navigate to Administration → Integrations → Incoming Webhooks
Click the Manage Providers button Configuration button in the top right of the page, and then the Create Provider button button at the top right of the table to create a new Provider.
...
First lets edit the match script by changing tabs. 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 Click Save.
...
Creating a BuildProject Function
Now that we have our Provider, navigate Back to back to the Webhook Functions Configuration screen. You should now see your GitHub Provider set up toprow in the table. Click Create Function in the row's context menu or click the button at the top right of the table 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 within the Uri field. This is the resource path we will ultimately give to GitHub to call our Function. Select the Clipboard icon next to this to copy the full resource path. Make the updates as I have done here and click Save.
...
Creating a public endpoint (Optional)
...
https://feac-24-106-28-162/flexdeploy/webhooks/v1v2/git/push
Info |
---|
Security WarningThe approach here is only meant for testing. We have just opened up a public url to our machine on port 8000. Anyone in the world can now hit that port. For real production setup see here. |
...
Now that we have our endpoint we just need to setup a webhook in GitHub with this endpoint.
...
Trying it out
With the GitHub webhook enabled all we need to do is push a change to the repository. After pushing a change, navigate back to Webhook Messages to ensure we received the event.
...
Click on the message row to view its details in a popup, and ensure that the logging went through.
...
Building the Project
Updating our BuildProject Function
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 selecting the dropdown icon on the GitHub Provider row and clicking on the name of your Function.
...
Update the Function script to the following:
...
Info |
---|
PropertiesProviders 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.
...