README
¶
CodePipeline -> Lambda -> Github
Update a GitHub pull request status via CodePipeline events
Table of Contents
Installation
Prerequisites
1) Clone or go get the files locally
go get github.com/mrz1818/lambda-codeship-github/...
cd $GOPATH/src/github.com/mrz1818/lambda-codeship-github
2) Test your local installation (executes the status
function)
make run-status
Deployment & Hosting
This repository has CI integration using AWS CodePipeline.
Deploying to the master
branch will automatically sync the code to AWS Lambda.
Any changes to the environment via the AWS CloudFormation template will be applied.
The actual build process can be found in the buildspec.yml file.
Create New Hosting Environment (AWS)
This will create a new AWS CloudFormation stack with:
- (1) Lambda Function(s)
- (1) CloudWatch Event Rule to subscribe to Pipeline events
- (1) CloudWatch LogGroups for Lambda Function(s)
- (1) CodePipeline with multiple stages to deploy the application from Github
- (1) CodePipeline Webhook to receive Github notifications from a specific
branch:name
- (1) CodeBuild Project(s) to test, build and deploy the app
- (2) Service Roles for working with CodeBuild and CodePipeline
NOTE: Requires an existing S3 bucket for artifacts and sam-cli deployments (located in the Makefile)
1) Add your Github token to SSM
make save-token token=YOUR_TOKEN
2) One command will build, test, package and deploy the application to AWS. After initial deployment, updating the function is as simple as committing to Github.
make deploy
If you make any adjustments to the command above, update the buildspec file accordingly.
Tear Down Hosting Environment (AWS)
Remove the Stack(s)
make teardown
Lambda Logging
View all the logs in AWS CloudWatch via log groups:
/aws/lambda/<app_name>-<stage_name>-<function_name>
Documentation
You can view the generated documentation here.
Run the status function with different events
make run-status event=failed
Library Deployment
goreleaser for easy binary or library deployment to Github and can be installed via: brew install goreleaser
.
The .goreleaser.yml file is used to configure goreleaser.
Use make release-snap
to create a snapshot version of the release, and finally make release
to ship to production.
Makefile Commands
View all makefile
commands
make help
List of all current commands:
all Run multiple pre-configured commands at once
bench Run all benchmarks in the Go application
build Build the lambda function as a compiled application
clean Remove previous builds and any test cache data
clean-mods Remove all the Go mod cache
coverage Shows the test coverage
deploy Build, prepare and deploy
godocs Sync the latest tag with GoDocs
help Show all commands available
lambda Build a compiled version to deploy to Lambda
lint Run the Go lint application
package Process the CF template and prepare for deployment
release Full production release (creates release in Github)
release-test Full production test release (everything except deploy)
release-snap Test the full release (build binaries)
run-status Fires the lambda function (IE: run-status event=started)
save-token Saves the token to the parameter store (IE: save-token token=YOUR_TOKEN)
tag Generate a new tag and push (IE: tag version=0.0.0)
tag-remove Remove a tag if found (IE: tag-remove version=0.0.0)
tag-update Update an existing tag to current commit (IE: tag-update version=0.0.0)
teardown Deletes the entire stack
test Runs vet, lint and ALL tests
test-short Runs vet, lint and tests (excludes integration tests)
update Update all project dependencies
update-releaser Update the goreleaser application
vet Run the Go vet application
Examples & Tests
All unit tests run via Travis CI and uses Go version 1.14.x. View the deployment configuration file.
Run all tests (including integration tests)
make test
Code Standards
Read more about this Go project's code standards.
Maintainers
![]() |
---|
MrZ |
Contributing
View the contributing guidelines and follow the code of conduct.
Support the development of this project 🙏
Credits
This application would not be possible without the work provided in these repositories:
- CPLiakas's SAM Golang Example
- InfoPark's Github Status
- Jenseickmeyer's Commit Status Bot
- Rowanu's SAM Golang Starter
License
Documentation
¶
There is no documentation for this package.