Hi,
I was building a gitops process using Octopus Deploy to run terraform plan and terraform apply based on github(self hosted) pull request or merge. Our terraform code is in github and we don’t want to create packages for terraform. We want to deploy directly from github.
I was wondering is there a way to trigger the deployment from github, using webhook.
I saw integrations with github actions. I was thinking to use github actions to trigger the pipeline.
Is there a better way to do this. Please let me know. Do you have any sample code?
Combine this with our Github integration which includes an Action specifically for Deploying Releases and it should allow you to trigger an Octopus Deployment without needing to build a package directly from Github:
Feel free to reach out if you have any questions or run into any issues at all, I’d be more than happy to clarify any part of the process further!
Ours is a self hosted github enterprise which is not exposed to internet. So won’t be able to add it to Octopus Cloud.
We don’t tag the terraform code in git. We just create pull request and merge to a branch.
I have written a script which executes git clone and then terraform apply in octopus deploy. This script runs locally in the worker which has access to the self hosted github.
3a. I also created the process in Octopus Deploy
I also have a Powershell script which trigger the deployment in Octopus Deploy using the API.
Now one thing pending in the gitops process is the trigger from github(merge or pullrequest) to run the Powershell script which starts the octopus deployment.
That should allow you to trigger a script on a specific worker from a PR to the main branch, without requiring a package or proxy to route the connection to a Github Feed.
Let me know if that doesn’t help or if you have any questions at all!