Skip to content

a node.js lambda function that updates github commit statuses based on codebuild events

License

Notifications You must be signed in to change notification settings

Mindflash/tf-codebuild-github-status-test-lambda

 
 

Repository files navigation

tf-codebuild-github-status

a node.js lambda function that updates github PR statuses based on codebuild events

architecture diagram

Installing

# clone the repo and install dependencies
$ git clone git@github.com:cludden/tf-codebuild-github-status.git

Contributing

  1. Clone it (git clone git@github.com:cludden/tf-codebuild-github-status.git)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes using conventional changelog standards (git commit -m 'feat(my-new-feature): Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Ensure linting/security/tests are all passing
  6. Create new Pull Request

Testing

Prerequisites:

# run test suite and generate code coverage
$ docker-compose run tf-codebuild-github-status

# run linter
$ docker-compose run tf-codebuild-github-status npm run lint

# run security scan
$ docker-compose run tf-codebuild-github-status npm run sec

Building

$ docker-compose run tf-codebuild-github-status

Releasing

  1. Merge fixes & features to master
  2. Run lint check npm run lint
  3. Run security check npm run sec
  4. Run full test suite docker-compose run tf-codebuild-github-status
  5. Run release script npm run release
  6. Push release & release tag to github git push --follow-tags
  7. Publish new release in github, using the release notes from the CHANGELOG

Configuring

Define custom configuration

{
  "github": {
    "url": "https://api.github.com",
    "owner": "my-org",
    "token": "xxxxxxxx"
  },
  "log": {
    "level": "info"
  }
}

Add JSON configuration to ssm

$ aws ssm put-parameter --name /secrets/codebuild-trigger/custom --type SecureString --value $JSONCONFIG

Deploying

Via terraform

module "codebuild_trigger" {
  source                     = "git::git@github.com:cludden/tf-codebuild-github-status.git//terraform?ref={version}"
  config_parameter_name      = "/secrets/codebuild-trigger"
  debug                      = ""
  memory_size                = 128
  name                       = "codebuild-github-status"
  node_env                   = "production"
  region                     = "us-west-2"
  s3_bucket                  = "my-artifact-bucket"
  s3_key                     = "tf-codebuild-github-status/${var.version}/index.zip"
  timeout                    = 10
}

License

Licensed under the MIT License

Copyright (c) 2017 Chris Ludden

About

a node.js lambda function that updates github commit statuses based on codebuild events

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 79.1%
  • HCL 20.9%