Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Click the Manage Providers button and then the Create Provider button to create a new Provider.

Image RemovedImage Added

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.

Image RemovedImage Added

Image RemovedImage Added

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:

Image RemovedImage RemovedImage AddedImage Added

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:

...

Now that we have our endpoint we just need to setup a webhook in GitHub with this endpoint.

Image RemovedImage Added

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 to Webhook Messages to ensure we received the event.

Image RemovedImage Added

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.

Image RemovedImage Added

Update the Function script to the following:

...

First we need to Enable Webhooks for the Project.

Image RemovedImage Added

Image RemovedImage Added


Testing it out

...

Info
titleResubmitting

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.


Image RemovedImage Added

Drill into the execution and check out the change logs to see the changes from your push.

...

Info
titleProperties

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.


Image RemovedImage Added

Final Validation

Lastly lets push one more time and validate everything is still working.

Image RemovedImage Added

Be sure to turn off your ngrok tunnel when you are done!