When upstream and downstream projects are configured with CaC and backed by forked repositories it becomes possible to merge changes from upstream to downstream repositories.
The Octopus - Merge CaC Updates steps merges changes by:
- Scanning the workspaces in the Terraform state created when deploying downstream projects
- Finding any CaC enabled projects
- Cloning the downstream Git repository
- Adding the upstream repo as a remote repository
- Merging changes from the upstream repo to the downstream repository
Each Octopus - Merge CaC Updates step is configured with a specific Terraform backend. For example, the Octopus - Merge CaC Updates (S3 Backend) step is configured to read Terraform state persisted in an S3 bucket.
The Octopus - Merge CaC Updates steps are typically defined in a runbook attached to the upstream project:
- Create a runbook called
__ Merge CaC Updatesattached to the upstream project. - Add one of the
Octopus - Merge CaC Updatessteps.- Run the step on a worker with a recent version of Terraform installed or set the container image to a Docker image with Terraform installed like
octopuslabs/terraform-workertools. - Set the
Octopus Spacesfield to a newline-separated list of downstream space names containing projects to update. Leave the field blank to process all downstream spaces. The default value of#{Octopus.Deployment.Tenant.Name}assumes the step is run against a tenant and the tenant name matches the space name. - Set the
Octopus Projectsfield to a newline-separated list of downstream project names to process. Leave the field blank to process all downstream projects. - Set the
Git Usernamefield to the Git repository username. GitHub users with access tokens set this field tox-access-token. - Set the
Git Passwordfield to the Git repository password or access token. - Set the
Git Protocolfield to eitherHTTPorHTTPS. All publicly hosted Git platforms useHTTPS. - Set the
Git Hostnamefield to the Git repository host name e.g.github.com,gitlab.com,bitbucket.com. - Set the
Git Organizationfield to the Git repository owner or organization. - Set the
Git Template Repofield to the Git repository hosting the upstream project. - Each
Octopus - Merge CaC Updatesstep then defines additional fields related to the specific Terraform backend. For example, theOctopus - Merge CaC Updates (S3 Backend)step has fields for AWS credentials, region, bucket, and key.
- Run the step on a worker with a recent version of Terraform installed or set the container image to a Docker image with Terraform installed like
Executing the runbook will merge upstream changes into downstream repositories or print instructions on manually resolving merge conflicts in the verbose logs.
Help us continuously improve
Please let us know if you have any feedback about this page.
Page updated on Thursday, November 9, 2023