whenever a PR is created code build triggers runs some tests and gives the result. based on the result i have a codecommit approval rule template created which needs to be approved from codebuild . In this case codebuild is not considering the approval rule template created instead its marking the PR as approved when successfull - when i run "aws codecommit update-pull-request-approval-state --pull-request-id $pullRequestId --approval-state APPROVE --revision-id $revisionId" I need help on how do i tell my codebuild to approve the template rule which i have created?
CodePudding user response:
In your case, I think you can follow these steps:
- In the CodeBuild for PR-Created action, you put your test commands in build section
- Base on the results of commands above, you can decide what to do next. This is the example one:
version: 0.2
phases:
build:
commands:
- test commands 1
- test commands 2
post_build:
commands:
- |-
if [ "$CODEBUILD_BUILD_SUCCEEDING" -gt "0" ]; then
aws codecommit ...
else
notify some channels
fi
CodePudding user response: