receive github hook, notify agent, receive task results, notify github

Downloads in past


5.7.26 years ago7 years agoMinified + gzip package size for github-task-manager in KB


npm version Build Status Code Climate Test Coverage Greenkeeper badge Commitizen friendly semantic-release Docker Build Status
receive github hook, notify agent, receive task results, notify github (Unofficial)


Create an asynchronous CI agnostic mechanism for running custom test stage gates for github pull requests.
  • allow team leads to configure task sequences without leaving github
  • allow developers to see output from tasks without leaving github
  • trigger multiple jobs in parallel and indicate pending status on pr checks
  • then add results for each back to pull request check/comments as they complete
  • make extensible for other github event handling
  • stateless and deployable to Kubernetes at scale


  • Deploy two functions to lambda via serverless framework ('gtmGithubHook', 'gtmGithubResults')
  • github PR open hook pointed at 'gtmGithubHook' lambda which adds event to a 'PendingQueue' SQS queue
  • agent(s) watch SQS for new test execution jobs
  • agent notifies 'ResultsQueue' SQS queue that a task has started (lambda updates github PR state)
  • agent triggers CI PR build, deploy and tests (plugin for each CI type)
  • agent formats and adds test results to 'ResultsQueue' SQS queue
  • agent notifies SNS topic which triggers 'gtmGithubResults' lambda
  • 'gtmGithubResults' lambda posts results to github pull request.



  • clone this repo or npm install --save github-task-manager
  • npm install
  • setup serverless aws creds per
  • setup a .env file in the repo root (copy from .envExample and modify)
  • create and AWS KMS key, and capture the id for var GTM_AWS_KMS_KEY_ID

| Environment variable | description | | -------------------- | ----------- | |GTMAWSKMSKEYID | aws kms key id | |GTMCRYPTGITHUBTOKEN | encrypted access token for accessing github | |GTMCRYPTGITHUBWEBHOOKSECRET | encrypted shared secret from github webook config | |GTMCRYPTAWSACCESSKEYID | encrypted aws key id - for agent only | |GTMCRYPTAWSSECRETACCESSKEY | encrypted aws secret - for agent only | |GTMCRYPTAGENTAWSSECRETACCESSKEY|secret key for agent| |GTMCRYPTAGENTAWSACCESSKEYID|access key for agent| |GTMCRYPTJENKINSTOKEN| encrypted token | |GTMCRYPTTEAMCITYPASSCODE| encrypted teamcity executor passcode| |GTMCRYPTSONARLOGIN| encrypted sonar access token | |GTMCRYPTSONARGITHUBOAUTH| encrypted github token for sonar to post comments and status | |GTMCRYPTDOCKERREGPASSWORD| encrypted docker private registry password| |GTMAWSREGION | awsregion to create resources in | |GTMSQSPENDINGQUEUE | name of SQS queue for new event | |GTMSQSRESULTSQUEUE | name of SQS queue for results | |GTMSNSRESULTSTOPIC | name of SNS topic for result ping | |GTMGITHUBHOST | api hostname can be updated for github enterprise | |GTMGITHUBDEBUG | debug mode for api calls | |GTMGITHUBTIMEOUT | github api timeout | |GTMGITHUBPATHPREFIX | path prefix for github enterprise | |GTMGITHUBPROXY | github api client proxy | |GTMTASKCONFIGFILENAME | filename in repo to look for for task config - default is .githubTaskManager | |AWSPROXY|URL of proxy to use for network requests. Optional| |GTMAGENTPORT| defaults to 9091 | |GTMJENKINSUSER|login for jenkins executor| |GTMJENKINSURL|url executor uses to talk to jenkins| |GTMJENKINSCSRF| is csrf enabled? true or false| |GTMTEAMCITYUSER|teamcity executor user| |GTMTEAMCITYURL|teamcity api url| |GTMDOCKERIMAGEWHITELIST| comma separated list of regex of allows docker images eg. alpine:,bash:latest| |GTMDOCKERIMAGEWHITELISTFILE|use an optional docker whitelist file .dockerImageWhitelistExample| |GTMDOCKERCOMMANDSALLOWED| default is false, set to true to enable docker executor| |GTMDOCKERALLOWPULL| allow agent to pull from registry | |GTMDOCKERDEFAULTWORKERIMAGE| for running ci tasks, default is zotoio/gtm-worker:latest | |GTMDOCKERREGUSERNAME| username for docker private registry| |GTMDOCKERREGSERVER| hostname for docker private registry| |IAMENABLED|agent host uses IAM ?| |LAUNCHDARKLYAPITOKEN|token for launchdarkly sass executor| |GTMLOGSTASHHOST|optional logstash host for elasticsearch analysis| |GTMLOGSTASHPORT|optional logstash port| |GTMSONARHOSTURL| sonar host url to connect to | |GTMSONARPROJECTNAMEPREFIX| prefix if reporting to sonarqube | |GTMSONARANALYSISMODE| mode for sonar runner, default preview for PRs | |GTMSONARSOURCES| default source dir is src| |GTMSONARJAVABINARIES| default is target| |GTMSONARMODULES| comma separated modules| |GTMSONARGITHUBENDPOINT| optional enterprise github api url| |GTMTASKCONFIGDEFAULTURL| url to default sample config used when repo is missing .githubTaskManager.json| |GTMTASKCONFIGDEFAULTMESSAGEPATH| path to markdown comment file added to PRs when repo is missing .githubTaskManager.json| |GTMDYNAMOTABLEEVENTS| DynamoDB table to store event summaries | |GTMDYNAMOTABLEAGENTS| DynamoDB table to store agent summaries | |GTMAWSVPCID| vpc id - only required for ddb endpoints | |GTMBASEURL| Base url used to render links to agent ui - eg elb cname | |GTMWELCOMEMESSAGEENABLED| If not 'false', send a warning message on unconfigured repository pull requests | |GTMS3DEPENDENCYBUCKET| aws s3 storage of build dependencies| |GTMAWSS3PROXY| httpsproxy for aws s3 | |GTMREPOBLACKLIST| comma separated list of regex to blackist repo names from triggering events | |GTMSLSEXECUTORAWSSTAGE| stage override from default calculation of dev/test| |GTMSLSEXECUTORAWSREGION| aws region for lambdas default ap-southeast-2| |GTMSLSEXECUTORAWSEXECUTIONROLE| docker serverless lambda execution role | |GTMSLSEXECUTORDEPLOYMODE| deploy multiple lambdas 'parallel' (default) or 'sequential'| |GTMSLSEXECUTORSNSERRORTOPICARN| sns topic to notify on serverless error| |GTMSLSEXECUTORAPIGWENDPOINTTYPE|EDGE or REGIONAL or PRIVATE| |GTMSLSEXECUTORAPIGWDOMAINSUFFIX|reverse proxy domain name that will have apiId added as subdomain. eg. will result in| |GTMSLSEXECUTORHTTPPROXY|proxy passed to serverless executor| |GTMSLSEXECUTORNOPROXY|noproxy passed to serverless executor| |GTMSLSEXECUTORVPCID|vpc id for private apigw endpoints| |GTMSLSEXECUTORVPCSECURITYGROUPID|vpc security group id| |GTMSLSEXECUTORVPCSUBNETA| vpc az subnet | |GTMSLSEXECUTORVPCSUBNETB| vpc az subnet | |GTMSLSEXECUTORVPCSUBNETC| vpc az subnet | |GTMSLSEXECUTORAWSKMSKEYID| kms key id for sls env var encryption | |GTMSLSEXECUTORCONFIGTYPE|'ssm' (aws parameter store) or 'spring' or 'dotenv'| |GTMSLSEXECUTORSPRINGCONFIGENDPOINT|endpoint url of spring config server eg. http://spring:8888 if GTMSLSEXECUTORCONFIGTYPE is 'spring'| |GTMWORKERSCRIPTSCLONE| for docker executors using based image - url of git repo to overlay on workspace eg. | |GTMWORKERSCRIPTSPATH| directory within scripts clone repo to overlay|
important: values of env vars prefixed with GTM_CRYPT_* must be created via npm run sls-encrypt [name] [value]

Configure and deploy

  • run: npm run sls-deploy - note that this will create aws re$ources..
  • capture the hook url output in console and add to github repo pull request conf
  • run: npm run sls-logs-hook or npm run sls-logs-results to tail the logs
  • create a .githubTaskManager.json in your repo per
  • start an agent locally using npm run build && npm start agent (or use docker/k8s)
  • create a pull request and confirm the hook is being hit and agent processes event

Docker and Kubernetes agents

You can run the latest image from docker hub:
npm run docker-hub-run
..or run using the local checkout and tail logs:
npm run docker-local-bounce
..or if you have a k8s cluster and kubectl configured:
npm run k8s-apply
npm run k8s-delete
note that these k8s npm script inject vars from .env into the manifest
a starting point k8s manifest is in ./k8s/k8s-gtm-agent.yml

Agent Configuration

Running the Agent

The agent uses environment variables to configure itself as well as any executors running within it. The below environment variables are required for basic operation of the GTM Agent.
TODO: Provide Variables

Agent Homepage

The GTM Agent provides an information page summarising the ongoing operation of the agent. The page is available on port 9091 by default.


Task executors for Jenkins, Teamcity, Travis, Http, Docker are in progress. Custom task executors can be added by adding this project as a dependency, and registering new Executors and EventHandlers. Please see for an example that you can fork and modify as required while still using this project as the core.
  • Executors contain the logic to run tasks against a given system type, and format the results.
  • EventHandlers are used to map Github events to specific functionality such as pull requests.


Fork this repository and work on your enhancements, then send a pull request. If you build custom plugins that may be useful to others in your forked gtm-agent, please let us know and may be able to assist wwith backporting to this project.
Use commitizen for conventional commit messages via git cz instead of git commit.
To setup if not already installed:
npm install -g commitizen
npm install -g cz-conventional-changelog
echo '{ "path": "cz-conventional-changelog" }' > ~/.czrc
...or you can just use npm run commit which will use local commitizen install.