-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[INF][OPS] Use stripped assembly for pipeline CFN actions
Works around the 256MB input artifact size limit for CFN deploy actions in CodePipeline, which can be exceeded due to asset files. Related to aws/aws-cdk#9917.
- Loading branch information
Showing
4 changed files
with
43 additions
and
8 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
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,20 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Slightly hacky script to work around the 256MB input artifact size limit for CFN pipeline actions. | ||
# Ref: https://docs.aws.amazon.com/codepipeline/latest/userguide/limits.html | ||
# | ||
# Since assets are what makes the artifact so big, we use a separate, cloned artifact with assets removed. | ||
# Relevant GitHub issue: https://github.com/aws/aws-cdk/issues/9917 | ||
|
||
# Make a copy of the cloud assembly but exclude any asset files | ||
rsync -av gen/cloud_assembly/ gen/cloud_assembly_no_assets/ --exclude '/asset.*' | ||
|
||
# Prep a JQ expression to update all pipeline CFN actions to use the no-assets artifact | ||
JQ_PIPELINE_ACTIONS_PATH='.Resources.DeploymentPipelineD53681EF.Properties.Stages[].Actions[]' | ||
JQ_ACTION_IS_CFN_TYPE='.ActionTypeId.Provider == "CloudFormation"' | ||
JQ_OVERWRITE_ARTIFACT_EXPR='.InputArtifacts = [{Name:"cloud_assembly_no_assets"}]' | ||
JQ_EXPR="$JQ_PIPELINE_ACTIONS_PATH |= if ($JQ_ACTION_IS_CFN_TYPE) then ($JQ_OVERWRITE_ARTIFACT_EXPR) else . end" | ||
|
||
# Edit the pipeline stack template file in-place | ||
PIPELINE_STACK_FILE='gen/cloud_assembly/DeploymentPipelineStack.template.json' | ||
jq "$JQ_EXPR" $PIPELINE_STACK_FILE | sponge $PIPELINE_STACK_FILE |
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