Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: DBTP-1366 - Force environment pipeline to trigger on correct branch #230

Merged
merged 7 commits into from
Sep 16, 2024

Conversation

JohnStainsby
Copy link
Contributor

@JohnStainsby JohnStainsby commented Sep 16, 2024

Explicitly add a trigger block with the source branch to the environment pipeline.

push {
branches {
includes = [
var.trigger_on_push ? var.branch : "NO_TRIGGER"
Copy link
Contributor Author

@JohnStainsby JohnStainsby Sep 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally here we would remove the trigger instead of setting a placeholder branch to prevent triggering var.trigger_on_push ? var.branch : "NO_TRIGGER", however Terraform doesn't detect the change if we omit the entire trigger block.

@JohnStainsby JohnStainsby marked this pull request as ready for review September 16, 2024 08:30
@JohnStainsby JohnStainsby requested a review from a team September 16, 2024 08:30

assert {
condition = length(aws_codepipeline.environment_pipeline.trigger[0].git_configuration[0].push[0].branches[0].includes) == 1
error_message = "Should be: true"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
error_message = "Should be: true"
error_message = "Should be: 1"

Copy link
Contributor Author

@JohnStainsby JohnStainsby Sep 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The length function evaluates this to true|false but I've added a better message anyway

@JohnStainsby JohnStainsby merged commit 3a95838 into main Sep 16, 2024
8 checks passed
@JohnStainsby JohnStainsby deleted the DBTP-1366-fix-environment-pipeline-trigger branch September 16, 2024 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants