Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
42771ff
Beginnings of template for arclight code pipeline
barbarahui May 27, 2026
4dd1287
Make linter happy
barbarahui May 27, 2026
1b621fd
Source and build steps run successfully
barbarahui May 28, 2026
ca4844f
Add arclight/dev config
barbarahui May 28, 2026
729839d
Make linter happy
barbarahui May 28, 2026
3faac1e
Trigger pipeline based on pushed commit with 'v*' tag
barbarahui May 28, 2026
2568d42
Edit notes and tidy up triggers config
barbarahui May 28, 2026
81a4e6d
Remove ECS permissions from codebuild policy
barbarahui May 28, 2026
e891909
Update codebuild template support GITHUB or CODEPIPELINE source types
barbarahui May 29, 2026
70f678e
Update arclight stage and prod config to work with template changes
barbarahui May 29, 2026
8e692bb
Remove arclight stage pipeline config for now
barbarahui May 29, 2026
c0d1500
Put some IAM permissions back into the template
barbarahui May 29, 2026
1463156
Update dags-deploy config to work with new template
barbarahui May 29, 2026
1e851f5
Update remaining build config to work with new template
barbarahui May 29, 2026
b564091
Fix policy statement in codebuild template
barbarahui May 29, 2026
e0df028
Configure dev arclight codebuild to be triggered by pipeline
barbarahui May 29, 2026
272de59
Fix dev code-pipeline config and template
barbarahui May 29, 2026
1f8296e
Add git push filter as sceptre_user_data parameter
barbarahui Jun 26, 2026
8b17623
Add scheduler to code-pipeline template
barbarahui Jun 26, 2026
824dfa5
Fix EOF for linter
barbarahui Jun 26, 2026
f7965b7
Add draft of pipeline trigger lambda for patching
barbarahui Jun 30, 2026
4c14a98
Rename lambda function
barbarahui Jul 1, 2026
061655a
Add config and templates for building lambda function
barbarahui Jul 1, 2026
bddd695
Move and rename config files
barbarahui Jul 1, 2026
7a3fcee
Add eventbridge scheduler
barbarahui Jul 2, 2026
c23c9d0
Fix curly braces
barbarahui Jul 2, 2026
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
6 changes: 4 additions & 2 deletions infrastructure/cinco/config/dags-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ template:
path: codebuild.j2
type: file
parameters:
GitHubRepo: https://github.com/ucldc/cinco
Namespace: cinco-dags-deploy
Branch: main

sceptre_user_data:
Source:
Type: GITHUB
GitHubRepo: https://github.com/ucldc/cinco
Branch: main
CodeBuildPolicies:
- arn:aws:iam::777968769372:policy/cinco-dags-sync
TriggerFilterGroups:
Expand Down
39 changes: 39 additions & 0 deletions infrastructure/cinco/config/dev/arclight/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
template:
path: codebuild.j2
type: file
parameters:
Namespace: cinco-arclight-dev

sceptre_user_data:
ECRRepositoryName: cinco-arclight
BuildEnvironment:
- SUBNET_IDS: {{ var.dev.SUBNET_IDS }}
Source:
Type: CODEPIPELINE
build_spec: |-
!Sub >-
version: 0.2

phases:
build:
commands:
- aws ecr get-login-password --region us-west-2 | docker login --username AWS --password-stdin ${AWS::AccountId}.dkr.ecr.us-west-2.amazonaws.com
- docker build -t cinco-arclight arclight --file arclight/Dockerfile
- docker tag cinco-arclight:latest ${AWS::AccountId}.dkr.ecr.us-west-2.amazonaws.com/cinco-arclight:latest
- docker push ${AWS::AccountId}.dkr.ecr.us-west-2.amazonaws.com/cinco-arclight:latest
post_build:
commands:
- docker run -d --name arclight-tail-dev-null cinco-arclight tail -f /dev/null
- docker cp arclight-tail-dev-null:/rails/public/assets ./public_assets
- aws s3 cp --recursive ./public_assets s3://cinco-dev-tmp/arclight_assets/assets
- docker stop arclight-tail-dev-null
additional_policy_statements: |-
- Effect: Allow
Action:
- s3:PutObject
- s3:GetObject
- s3:GetObjectVersion
- s3:GetBucketAcl
- s3:GetBucketLocation
Resource:
- !Sub arn:aws:s3:::cinco-dev*
41 changes: 41 additions & 0 deletions infrastructure/cinco/config/dev/arclight/code-pipeline.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
template:
path: code-pipeline.yaml.j2
type: file
parameters:
Namespace: cinco-arclight-dev
SourceRepositoryId: ucldc/cinco
ChangeDetectionBranchName: infrastructure-arclight-auto-patching
CodeConnectionArn: arn:aws:codeconnections:us-west-2:866216109762:connection/fa425c08-dc3a-40c2-b45d-adb3bc6f91c7
CodeBuildRoleName: !stack_output_external cinco-dev-arclight-build::CodeBuildRole
CodeBuildProjectName: cinco-arclight-dev

sceptre_user_data:
GitPushFilter:
- Branches:
Includes:
- infrastructure-arclight-auto-patching
FilePaths:
Includes:
- arclight/**
### prod git push filter
# there is no native release event for CodePipeline, so we trigger on tags starting with 'v' for version
# GitPushFilter:
# - Tags:
# Includes:
# - v*
### stage git push filter
# GitPushFilter:
# - Branches:
# Includes:
# - main
# FilePaths:
# Includes:
# - arclight/**

# For patching, we want to rebuild and deploy the container using the same dockerfile, code version, or env vars
# Steps:
# - use describeServiceDeployments API to get info on what's currently deployed: stage==Completed, state==SUCCESSFUL
# - get currently deployed task definition id (targetServiceRevision/arn)
# - get image build details for that task definition using describe tasks API
# - we need to use the git hash in our tags for stage
# https://aws.amazon.com/blogs/containers/improving-deployment-visibility-for-amazon-ecs-services/
10 changes: 10 additions & 0 deletions infrastructure/cinco/config/dev/arclight/patching-scheduler.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
template:
path: lambda-scheduler.yaml
type: file
parameters:
Namespace: cinco-arclight-dev-patching
TargetLambdaArn: !stack_output_external cinco-patching-lambda-function::LambdaFunctionArn
Description: Scheduler for cinco arclight dev regular patching
# Tuesdays at 10:30am
ScheduleExpression: "cron(30 10 ? * 3 *)"
Input: '{"pipeline": "cinco-arclight-dev-pipeline", "cluster": "cinco-stage", "service": "cinco-arclight-dev-service", "gitrepo": "ucldc/cinco"}'
5 changes: 5 additions & 0 deletions infrastructure/cinco/config/dev/s3.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
template:
path: public-s3.yaml
type: file
parameters:
BucketName: {{ var.dev.S3_BUCKET_NAME }}
48 changes: 48 additions & 0 deletions infrastructure/cinco/config/patching-lambda-codebuild.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
template:
path: codebuild.j2
type: file
parameters:
Namespace: cinco-trigger-ecs-patching-pipeline-codebuild

sceptre_user_data:
Source:
Type: GITHUB
GitHubRepo: https://github.com/ucldc/cinco
Branch: main
ECRRepositoryName: cinco-trigger-ecs-patching-pipeline
BuildEnvironment:
- SUBNET_IDS: {{ var.stage.SUBNET_IDS }}
TriggerFilterGroups:
- - Type: EVENT
Pattern: PUSH
- Type: HEAD_REF
Pattern: ^refs/heads/main$
ExcludeMatchedPattern: false
- Type: FILE_PATH
Pattern: "infrastructure/lambdas/trigger-ecs-patching-pipeline/*"
ExcludeMatchedPattern: false
build_spec: |-
!Sub >-
version: 0.2

phases:
pre_build:
commands:
- cd $CODEBUILD_SRC_DIR/lambdas/trigger-ecs-patching-pipeline
build:
commands:
# login to ECR public so we can pull lambda image
- aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws
- docker build --platform linux/amd64 -t ${Namespace} .
# login to ECR private so we can push new image
- aws ecr get-login-password --region us-west-2 | docker login --username AWS --password-stdin ${AWS::AccountId}.dkr.ecr.us-west-2.amazonaws.com
- docker tag ${Namespace}:latest ${AWS::AccountId}.dkr.ecr.us-west-2.amazonaws.com/${Namespace}:latest
- docker push ${AWS::AccountId}.dkr.ecr.us-west-2.amazonaws.com/${Namespace}:latest
# update lambda function with new image
- aws lambda update-function-code --function-name trigger-ecs-patching-pipeline-lambda-function --image-uri ${AWS::AccountId}.dkr.ecr.us-west-2.amazonaws.com/${Namespace}:latest
additional_policy_statements: |-
- Effect: Allow
Action:
- lambda:GetLayerVersion
- lambda:UpdateFunctionCode
Resource: "*"
26 changes: 26 additions & 0 deletions infrastructure/cinco/config/patching-lambda-function.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
template:
path: lambda-function.j2
type: file
parameters:
Namespace: cinco-trigger-ecs-patching-pipeline
VpcId: {{ var.prd.VPC_ID }}
FunctionDescription: Trigger patching pipeline for an ECS Service
ECRRepositoryName: cinco-trigger-ecs-patching-pipeline
SubnetId1: subnet-08a31a6d2aff9ac32
SubnetId2: subnet-09e65806b80ebad6b
Timeout: '20'

sceptre_user_data:
additional_policy_statements: |-
- Effect: Allow
Action:
- ecs:ListServiceDeployments
- ecs:DescribeServiceRevisions
- ecs:DescribeTaskDefinition
Resource:
- !Sub arn:aws:ecs:${AWS::Region}:${AWS::AccountId}:service/*
- Effect: Allow
Action:
- codepipeline:StartPipelineExecution
Resource:
- !Sub arn:aws:codepipeline:${AWS::Region}:${AWS::AccountId}:*
13 changes: 11 additions & 2 deletions infrastructure/cinco/config/prd/arclight/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ template:
path: codebuild.j2
type: file
parameters:
GitHubRepo: https://github.com/ucldc/cinco
Namespace: cinco-arclight-prd
Branch: ''
ECRRepositoryURI: 777968769372.dkr.ecr.us-west-2.amazonaws.com/cinco-arclight

sceptre_user_data:
Source:
Type: GITHUB
GitHubRepo: https://github.com/ucldc/cinco
BuildEnvironment:
- SUBNET_IDS: {{ var.prd.SUBNET_IDS }}
- SLACK_HOOK: {{ var.prd.SLACK_HOOK }}
Expand Down Expand Up @@ -48,6 +49,14 @@ sceptre_user_data:
- aws ecs update-service --cluster cinco-prd --service cinco-arclight-prd-service --task-definition $TASK_FAMILY:$TD_REVISION --force-new-deployment
additional_policy_statements: |-
- Effect: Allow
Action:
- ecs:RunTask
- ecs:DescribeTasks
- ecs:DescribeTaskDefinition
- ecs:RegisterTaskDefinition
- ecs:UpdateService
Resource: "*"
- Effect: Allow
Action:
- s3:PutObject
- s3:GetObject
Expand Down
22 changes: 16 additions & 6 deletions infrastructure/cinco/config/prd/cincoctrl/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,21 @@ template:
path: codebuild.j2
type: file
parameters:
GitHubRepo: https://github.com/ucldc/cinco
Namespace: cinco-ctrl-prd
Branch: ''
ECRRepositoryURI: 777968769372.dkr.ecr.us-west-2.amazonaws.com/cinco-ctrl

sceptre_user_data:
Source:
Type: GITHUB
GitHubRepo: https://github.com/ucldc/cinco
BuildEnvironment:
- SUBNET_IDS: {{ var.prd.SUBNET_IDS }}
- SLACK_HOOK: {{ var.prd.SLACK_HOOK }}
- SUBNET_IDS: {{ var.prd.SUBNET_IDS }}
- SLACK_HOOK: {{ var.prd.SLACK_HOOK }}
TriggerFilterGroups:
# A build is triggered if any filter group evaluates to true, which
# occurs when all the filters in the group evaluate to true.
- - Type: EVENT
Pattern: RELEASED
- - Type: EVENT
Pattern: RELEASED
build_spec: |-
!Sub >-
version: 0.2
Expand Down Expand Up @@ -49,3 +50,12 @@ sceptre_user_data:
- echo "Forcing a new deployment of the service to apply changes"
- python $CODEBUILD_SRC_DIR/infrastructure/cinco/scripts/message_slack.py --application cincoctrl --cinco_version $TAG --td_family_revisions "$TASK_FAMILY:$TD_REVISION"
- aws ecs update-service --cluster cinco-prd --service cinco-ctrl-prd-service --task-definition $TASK_FAMILY:$TD_REVISION --force-new-deployment
additional_policy_statements: |-
- Effect: Allow
Action:
- ecs:RunTask
- ecs:DescribeTasks
- ecs:DescribeTaskDefinition
- ecs:RegisterTaskDefinition
- ecs:UpdateService
Resource: "*"
15 changes: 13 additions & 2 deletions infrastructure/cinco/config/prd/solr/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ template:
path: codebuild.j2
type: file
parameters:
GitHubRepo: https://github.com/ucldc/cinco
Namespace: cinco-solr-prd
Branch: ''
ECRRepositoryURI: !stack_output stage/solr/build.yaml::ECRRepository

sceptre_user_data:
Source:
Type: GITHUB
GitHubRepo: https://github.com/ucldc/cinco
TriggerFilterGroups:
# A build is triggered if any filter group evaluates to true, which
# occurs when all the filters in the group evaluate to true.
Expand Down Expand Up @@ -71,3 +72,13 @@ sceptre_user_data:
# - aws ecs update-service --cluster cinco-prd --service cinco-solr-follower-2-prd-service --task-definition $TASK_FAMILY:$TD_REVISION --force-new-deployment
###### Message Slack #####
- python $CODEBUILD_SRC_DIR/infrastructure/cinco/scripts/message_slack.py --application solr --cinco_version $TAG --td_family_revisions $LEADER $FOLLOWER_1 $FOLLOWER_2
additional_policy_statements: |-
- Effect: Allow
Action:
- ecs:RunTask
- ecs:DescribeTasks
- ecs:DescribeTaskDefinition
- ecs:RegisterTaskDefinition
- ecs:UpdateService

Resource: "*"
14 changes: 12 additions & 2 deletions infrastructure/cinco/config/stage/arclight/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ template:
path: codebuild.j2
type: file
parameters:
GitHubRepo: https://github.com/ucldc/cinco
Namespace: cinco-arclight-stage
Branch: main

sceptre_user_data:
Source:
Type: GITHUB
GitHubRepo: https://github.com/ucldc/cinco
Branch: main
ECRRepositoryName: cinco-arclight
BuildEnvironment:
- SUBNET_IDS: {{ var.stage.SUBNET_IDS }}
Expand Down Expand Up @@ -39,6 +41,14 @@ sceptre_user_data:
- aws ecs update-service --cluster cinco-stage --service cinco-arclight-stage-service --force-new-deployment
additional_policy_statements: |-
- Effect: Allow
Action:
- ecs:RunTask
- ecs:DescribeTasks
- ecs:DescribeTaskDefinition
- ecs:RegisterTaskDefinition
- ecs:UpdateService
Resource: "*"
- Effect: Allow
Action:
- s3:PutObject
- s3:GetObject
Expand Down
16 changes: 14 additions & 2 deletions infrastructure/cinco/config/stage/cincoctrl/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ template:
path: codebuild.j2
type: file
parameters:
GitHubRepo: https://github.com/ucldc/cinco
Namespace: cinco-ctrl-stage
Branch: main

sceptre_user_data:
Source:
Type: GITHUB
GitHubRepo: https://github.com/ucldc/cinco
Branch: main
ECRRepositoryName: cinco-ctrl
BuildEnvironment:
- SUBNET_IDS: {{ var.stage.SUBNET_IDS }}
Expand Down Expand Up @@ -39,3 +41,13 @@ sceptre_user_data:
- python $CODEBUILD_SRC_DIR/infrastructure/cinco/scripts/ecs_manage.py collectstatic --no-input
- python $CODEBUILD_SRC_DIR/infrastructure/cinco/scripts/ecs_manage.py migrate --no-input
- aws ecs update-service --cluster cinco-stage --service cinco-ctrl-stage-service --force-new-deployment
additional_policy_statements: |-
- Effect: Allow
Action:
- ecs:RunTask
- ecs:DescribeTasks
- ecs:DescribeTaskDefinition
- ecs:RegisterTaskDefinition
- ecs:UpdateService

Resource: "*"
14 changes: 12 additions & 2 deletions infrastructure/cinco/config/stage/solr/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ template:
path: codebuild.j2
type: file
parameters:
GitHubRepo: https://github.com/ucldc/cinco
Namespace: cinco-solr-stage
Branch: main

sceptre_user_data:
Source:
Type: GITHUB
GitHubRepo: https://github.com/ucldc/cinco
Branch: main
ECRRepositoryName: cinco-solr
TriggerFilterGroups:
- - Type: EVENT
Expand Down Expand Up @@ -34,3 +36,11 @@ sceptre_user_data:
post_build:
commands:
- aws ecs update-service --cluster cinco-stage --service cinco-solr-stage-service --force-new-deployment
additional_policy_statements: |-
- Effect: Allow
Action:
- ecs:RunTask
- ecs:DescribeTasks
- ecs:DescribeTaskDefinition
- ecs:RegisterTaskDefinition
- ecs:UpdateService
Loading
Loading