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

feat: add trigger filters to aws codepipeline #59

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion tf/environments/dev/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ module "ooniapi_ooniprobe_deployer" {
repo = "ooni/backend"
branch_name = "master"
buildspec_path = "ooniapi/services/ooniprobe/buildspec.yml"
trigger_path = "ooniapi/services/ooniprobe/**"
codestar_connection_arn = aws_codestarconnections_connection.oonidevops.arn

codepipeline_bucket = aws_s3_bucket.ooniapi_codepipeline_bucket.bucket
Expand Down Expand Up @@ -359,7 +360,6 @@ module "ooniapi_ooniprobe" {
)
}


#### OONI Run service

module "ooniapi_oonirun_deployer" {
Expand All @@ -369,6 +369,7 @@ module "ooniapi_oonirun_deployer" {
repo = "ooni/backend"
branch_name = "master"
buildspec_path = "ooniapi/services/oonirun/buildspec.yml"
trigger_path = "ooniapi/services/oonirun/**"
codestar_connection_arn = aws_codestarconnections_connection.oonidevops.arn

codepipeline_bucket = aws_s3_bucket.ooniapi_codepipeline_bucket.bucket
Expand Down Expand Up @@ -416,6 +417,7 @@ module "ooniapi_ooniauth_deployer" {
repo = "ooni/backend"
branch_name = "master"
buildspec_path = "ooniapi/services/ooniauth/buildspec.yml"
trigger_path = "ooniapi/services/ooniauth/**"
codestar_connection_arn = aws_codestarconnections_connection.oonidevops.arn

codepipeline_bucket = aws_s3_bucket.ooniapi_codepipeline_bucket.bucket
Expand Down Expand Up @@ -508,6 +510,7 @@ module "oonith_oohelperd_deployer" {
repo = "ooni/probe-cli"
branch_name = "master"
buildspec_path = "oonith/buildspec.yml"
trigger_tag = "release*"
codestar_connection_arn = aws_codestarconnections_connection.oonidevops.arn

codepipeline_bucket = aws_s3_bucket.oonith_codepipeline_bucket.bucket
Expand Down
18 changes: 18 additions & 0 deletions tf/modules/ooniapi_service_deployer/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,24 @@ resource "aws_codepipeline" "ooniapi" {
aws_codebuild_project.ooniapi
]

trigger {
provider_type = "CodeStarSourceConnection"

git_configuration {
source_action_name = "Source"

push {
branches {
includes = ["master"]
}
file_paths {
includes = [var.trigger_path]
excludes = ["**/README.md"]
}
}
}
}

stage {
action {

Expand Down
4 changes: 4 additions & 0 deletions tf/modules/ooniapi_service_deployer/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ variable "repo" {
default = "ooni/backend"
}

variable "trigger_path" {
description = "path filter for push changes which trigger the codepipeline eg. ooniapi/services/oonirun/**"
}

variable "ecs_cluster_name" {
description = "id of the cluster to deploy into"
}
Expand Down
17 changes: 17 additions & 0 deletions tf/modules/oonith_service_deployer/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,23 @@ resource "aws_codepipeline" "oonith" {
aws_codebuild_project.oonith
]

trigger {
provider_type = "CodeStarSourceConnection"

git_configuration {
source_action_name = "Source"

push {
branches {
includes = ["master"]
}
tags {
includes = [var.trigger_tag]
}
}
}
}

stage {
action {

Expand Down
4 changes: 4 additions & 0 deletions tf/modules/oonith_service_deployer/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ variable "branch_name" {
default = "main"
}

variable "trigger_tag" {
description = "tag filters to use to trigger pipeline eg. release-1.0"
}

variable "repo" {
default = "ooni/backend"
}
Expand Down
Loading