Skip to content

Commit 09e6962

Browse files
committed
create sdlf repositories in a separate stack from sdlf-main codepipeline
this allows creating git branches ahead of CodePipelines - then they won't fail so fast, allowing the CodePipeline stopper to kick in (see #261 or 4e290af)
1 parent c752dcd commit 09e6962

File tree

5 files changed

+907
-863
lines changed

5 files changed

+907
-863
lines changed

deploy.sh

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,16 +164,15 @@ devops_account () {
164164
aws cloudformation package \
165165
--s3-bucket "$ARTIFACTS_BUCKET" --s3-prefix template-cicd-sdlf-repositories \
166166
--template-file "$DIRNAME"/sdlf-cicd/template-cicd-sdlf-repositories.yaml \
167-
--output-template-file "$DIRNAME"/output/packaged-template.yaml \
167+
--output-template-file "$DIRNAME"/output/packaged-template-cicd-sdlf-repositories.yaml \
168168
--region "$REGION" \
169169
--profile "$DEVOPS_AWS_PROFILE"
170170
STACK_NAME=sdlf-cicd-sdlf-repositories
171171
aws cloudformation deploy \
172172
--s3-bucket "$ARTIFACTS_BUCKET" --s3-prefix sdlf-cicd-sdlf-repositories \
173173
--stack-name "$STACK_NAME" \
174-
--template-file "$DIRNAME"/output/packaged-template.yaml \
174+
--template-file "$DIRNAME"/output/packaged-template-cicd-sdlf-repositories.yaml \
175175
--parameter-overrides \
176-
pArtifactsBucket=/SDLF/S3/DevOpsArtifactsBucket \
177176
pKMSKey=/SDLF/KMS/CICDKeyId \
178177
--tags Framework=sdlf \
179178
--capabilities "CAPABILITY_NAMED_IAM" "CAPABILITY_AUTO_EXPAND" \
@@ -182,10 +181,10 @@ devops_account () {
182181
template_protection "$STACK_NAME" "$REGION" "$DEVOPS_AWS_PROFILE"
183182
rm -Rf "$DIRNAME"/output
184183

185-
declare -a REPOSITORIES=("sdlf-cicd" "sdlf-foundations" "sdlf-team" "sdlf-pipeline" "sdlf-dataset" "sdlf-datalakeLibrary" "sdlf-stageA" "sdlf-stageB")
184+
declare -a REPOSITORIES=("sdlf-cicd" "sdlf-foundations" "sdlf-team" "sdlf-pipeline" "sdlf-dataset" "sdlf-datalakeLibrary" "sdlf-stageA" "sdlf-stageB" "sdlf-main")
186185
for REPOSITORY in "${REPOSITORIES[@]}"
187186
do
188-
latest_commit=$(aws --region "$REGION" --profile "$DEVOPS_AWS_PROFILE" codecommit get-branch --repository-name "$REPOSITORY" --branch-name main --query 'branch.commitId' --output text)
187+
latest_commit=$(aws --region "$REGION" --profile "$DEVOPS_AWS_PROFILE" codecommit get-branch --repository-name "$REPOSITORY" --branch-name main --query "branch.commitId" --output text)
189188
aws --region "$REGION" --profile "$DEVOPS_AWS_PROFILE" codecommit create-branch --repository-name "$REPOSITORY" --branch-name dev --commit-id "$latest_commit"
190189
aws --region "$REGION" --profile "$DEVOPS_AWS_PROFILE" codecommit create-branch --repository-name "$REPOSITORY" --branch-name test --commit-id "$latest_commit"
191190
done
@@ -195,6 +194,28 @@ devops_account () {
195194
aws --region "$REGION" --profile "$DEVOPS_AWS_PROFILE" s3api put-object --bucket "$ARTIFACTS_BUCKET" --key aws-sam-cli-linux-x86_64.zip --body "$DIRNAME"/sdlf-cicd/aws-sam-cli-linux-x86_64.zip
196195
rm "$DIRNAME"/sdlf-cicd/aws-sam-cli-linux-x86_64.zip
197196

197+
mkdir "$DIRNAME"/output
198+
aws cloudformation package \
199+
--s3-bucket "$ARTIFACTS_BUCKET" --s3-prefix template-cicd-sdlf-pipelines \
200+
--template-file "$DIRNAME"/sdlf-cicd/template-cicd-sdlf-pipelines.yaml \
201+
--output-template-file "$DIRNAME"/output/packaged-template-cicd-sdlf-pipelines.yaml \
202+
--region "$REGION" \
203+
--profile "$DEVOPS_AWS_PROFILE"
204+
STACK_NAME=sdlf-cicd-sdlf-pipelines
205+
aws cloudformation deploy \
206+
--s3-bucket "$ARTIFACTS_BUCKET" --s3-prefix sdlf-cicd-sdlf-pipelines \
207+
--stack-name "$STACK_NAME" \
208+
--template-file "$DIRNAME"/output/packaged-template-cicd-sdlf-pipelines.yaml \
209+
--parameter-overrides \
210+
pArtifactsBucket=/SDLF/S3/DevOpsArtifactsBucket \
211+
pKMSKey=/SDLF/KMS/CICDKeyId \
212+
--tags Framework=sdlf \
213+
--capabilities "CAPABILITY_NAMED_IAM" "CAPABILITY_AUTO_EXPAND" \
214+
--region "$REGION" \
215+
--profile "$DEVOPS_AWS_PROFILE" || exit 1
216+
template_protection "$STACK_NAME" "$REGION" "$DEVOPS_AWS_PROFILE"
217+
rm -Rf "$DIRNAME"/output
218+
198219
exit
199220
}
200221

sdlf-cicd/README.md

Whitespace-only changes.

sdlf-cicd/template-cicd-prerequisites.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,8 @@ Resources:
602602
detail-type:
603603
- CodePipeline Pipeline Execution State Change
604604
resources:
605-
- prefix: !Sub "arn:${AWS::Partition}:codepipeline:${AWS::Region}:${AWS::AccountId}:sdlf-cicd-sdlf-repositories-" # stop rMain CodePipeline
605+
- prefix: !Sub "arn:${AWS::Partition}:codepipeline:${AWS::Region}:${AWS::AccountId}:sdlf-cicd-sdlf-pipelines-" # stop rMain CodePipeline
606+
- prefix: !Sub "arn:${AWS::Partition}:codepipeline:${AWS::Region}:${AWS::AccountId}:sdlf-cicd-teams-" # stop rTeam CodePipeline
606607
detail:
607608
state:
608609
- STARTED

0 commit comments

Comments
 (0)