-
Notifications
You must be signed in to change notification settings - Fork 0
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: DBTP-1507 Setup codepipeline notifications #314
feat: DBTP-1507 Setup codepipeline notifications #314
Conversation
…eline-notifications
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## DBTP-1503-manual-pipeline #314 +/- ##
==========================================================
Coverage 81.68% 81.68%
==========================================================
Files 7 7
Lines 868 868
==========================================================
Hits 709 709
Misses 159 159 ☔ View full report in Codecov by Sentry. |
…eline-notifications
…om:uktrade/terraform-platform-modules into DBTP-1507-setup-codepipeline-notifications
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few minor comments.
- aws ecr get-login-password --region ${AWS_REGION} | docker login --username AWS --password-stdin ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com | ||
|
||
# construct Slack message env vars | ||
- | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think in general, these multiline commands should be reserved for blocks, such as if/then/else clauses, function definitions while loops etc. So I'd put line 30 in it's own single line item.
echo "Image contains no timestamp label" | ||
exit 1 | ||
fi | ||
echo "Found image timestamp $SLACK_REF" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly this echo should be it's own item
|
||
# Extract the pipeline name from CODEBUILD_INITIATOR default env var | ||
- | | ||
PIPELINE_NAME="" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed - the conditional will either add the PIPELINE_NAME or exit
fi | ||
|
||
# Construct the pipeline execution URL | ||
- | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Split this into 2 single line items.
echo "Pipeline execution URL: ${PIPELINE_EXECUTION_URL}" | ||
|
||
- | | ||
BUILD_ID_PREFIX=$(echo $CODEBUILD_BUILD_ID | cut -d':' -f1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And here
BUILD_ID_PREFIX=$(echo $CODEBUILD_BUILD_ID | cut -d':' -f1) | ||
echo "BUILD_ID_PREFIX - ${BUILD_ID_PREFIX}" | ||
|
||
- | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be just a single line item. - MESSAGE=...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried adding as a single line comment but there was a syntax error because of the use of the ":" which only resolved when using multiline
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI - you should be able to just surround the line in single quotes. It's because it thinks it's a map rather than a string. Surrounding in single quotes will make the YAML parser treat it as a string.
But happy for you to leave it as a multi-line quote in this case as it's probably neater.
STATUS_TEXT="STOP_REQUESTED/STOPPED/PENDING/IN_PROGRESS" | ||
;; | ||
esac | ||
echo "Status emoji set to ${STATUS_EMOJI}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The echo should be a command on it's own
esac | ||
echo "Status emoji set to ${STATUS_EMOJI}" | ||
|
||
- | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't need the block scalar indicator here as it's just a single line.
Co-authored-by: Anthony Roy <[email protected]>
Co-authored-by: Anthony Roy <[email protected]>
Co-authored-by: John Stainsby <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking better. A minor formatting thing left, but approved.
|
||
# Construct the pipeline execution URL | ||
- PIPELINE_EXECUTION_URL="https://${AWS_REGION}.console.aws.amazon.com/codesuite/codepipeline/pipelines/${PIPELINE_NAME}/executions/${PIPELINE_EXECUTION_ID}" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe just remove some of these random empty lines in this section.
BUILD_ID_PREFIX=$(echo $CODEBUILD_BUILD_ID | cut -d':' -f1) | ||
echo "BUILD_ID_PREFIX - ${BUILD_ID_PREFIX}" | ||
|
||
- | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI - you should be able to just surround the line in single quotes. It's because it thinks it's a map rather than a string. Surrounding in single quotes will make the YAML parser treat it as a string.
But happy for you to leave it as a multi-line quote in this case as it's probably neater.
Addresses DBTP-1507
Use platform-helper notify commands for notifications, similar to our other pipelines.
codebase-pipelines/buildspec-deploy.yml
codebase-pipelines/codepipeline.tf
codebase-pipelines/locals.tf
codebase-pipelines/codepipeline.tf
codebase-pipelines/tests/unit.tftest.hcl
codebase-pipelines/iam.tf
Checklist:
Title:
Description:
Tasks: