-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(webhook): add additional paths trigger (#129)
* feat(webhook): add additional paths trigger * feat(webhook): update AdditionnalTriggerPaths * feat(additionnalpaths): debug: add verbosity * feat(additionnalpaths): add debug * feat(common.go): remove debug los * feat(rbac): update * feat(additionnalpaths): enable on PR * fix(webhook): pr event revision name * feat(documentation): additionnal trigger paths * test(webhook): add tests for event handling on layers and PRs * fix(webhook): support relative parent paths * refactor(pullrequest): make LayerFilesHaveChanged public * chore(files): remove unused files * test(webhook): add tests around pull request closed events --------- Co-authored-by: Julien Jourdain <Julien Jourdain> Co-authored-by: Luca CORRIERI <lucac@padok.fr> Co-authored-by: Alan <alanl@padok.fr>
- Loading branch information
1 parent
a613394
commit e7a3a59
Showing
29 changed files
with
771 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Additionnal Trigger Paths | ||
|
||
By default, when you creating a layer, you must specify a repository and a path. This path is used to trigger the layer changes which means that when a change occurs in this path, the layer will be plan / apply accordingly. | ||
|
||
Sometimes, you need to trigger changes on a layer where the changes are not in the same path (e.g. update made on an internal terraform module hosted on the same repository). | ||
|
||
That's where the additional trigger paths feature comes! | ||
|
||
Let's take the following `TerraformLayer`: | ||
|
||
```yaml | ||
apiVersion: config.terraform.padok.cloud/v1alpha1 | ||
kind: TerraformLayer | ||
metadata: | ||
name: random-pets-terragrunt | ||
spec: | ||
terraform: | ||
version: "1.3.1" | ||
terragrunt: | ||
enabled: true | ||
version: "0.45.4" | ||
remediationStrategy: autoApply | ||
path: "terragrunt/random-pets/test" | ||
branch: "main" | ||
repository: | ||
name: burrito | ||
namespace: burrito | ||
``` | ||
The repository's path of my `TerraformLayer` is set to `terragrunt/random-pets/test`. But I want to trigger the layer plan / apply when a change occurs on my module which is in the `modules/random-pets` directory of my repository. | ||
|
||
To do so, I just have to add the `config.terraform.padok.cloud/additionnal-trigger-paths` annotation to my `TerraformLayer` as follow: | ||
|
||
```yaml | ||
apiVersion: config.terraform.padok.cloud/v1alpha1 | ||
kind: TerraformLayer | ||
metadata: | ||
name: random-pets-terragrunt | ||
annotations: | ||
config.terraform.padok.cloud/additionnal-trigger-paths: "modules/random-pets" | ||
spec: | ||
terraform: | ||
version: "1.3.1" | ||
terragrunt: | ||
enabled: true | ||
version: "0.45.4" | ||
remediationStrategy: autoApply | ||
path: "terragrunt/random-pets/test" | ||
branch: "main" | ||
repository: | ||
name: burrito | ||
namespace: burrito | ||
``` | ||
|
||
Now, when a change occurs in the `modules/random-pets` directory, the layer will be plan / apply. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.