a node.js
lambda function that forwards CodeBuild
events to Slack
via SNS
# clone the repo and install dependencies
$ git clone [email protected]:cludden/tf-codebuild-sns-slack.git
- Clone it (
git clone [email protected]:cludden/tf-codebuild-sns-slack.git
) - Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes using conventional changelog standards (
git commit -m 'feat(my-new-feature): Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Ensure linting/security/tests are all passing
- Create new Pull Request
Prerequisites:
# run test suite and generate code coverage
$ docker-compose run tf-codebuild-sns-slack
# run linter
$ docker-compose run tf-codebuild-sns-slack npm run lint
# run security scan
$ docker-compose run tf-codebuild-sns-slack npm run sec
$ docker-compose run tf-codebuild-sns-slack
- Merge fixes & features to master
- Run lint check
npm run lint
- Run security check
npm run sec
- Run full test suite
docker-compose run tf-codebuild-sns-slack
- Run release script
npm run release
- Push release & release tag to github
git push --follow-tags
- Publish new release in github, using the release notes from the CHANGELOG
Define custom configuration
{
"slack": {
"webhookUrl": "xxxx"
},
"log": {
"level": "info"
}
}
Add JSON configuration to ssm
$ aws ssm put-parameter --name /secrets/codebuild-sns-slack/custom --type SecureString --value $JSONCONFIG
Via terraform
module "codebuild_trigger" {
source = "git::[email protected]:cludden/tf-codebuild-sns-slack.git//terraform?ref={version}"
additional_parameter_names = "/secrets/codebuild-sns-slack/custom"
config_parameter_name = "/secrets/codebuild-sns-slack"
debug = ""
memory_size = 128
name = "codebuild-sns-slack"
node_env = "production"
region = "us-west-2"
s3_bucket = "my-artifact-bucket"
s3_key = "tf-codebuild-sns-slack/${var.version}/index.zip"
timeout = 10
}
Licensed under the MIT License
Copyright (c) 2017 Chris Ludden