Sign inSign up

zotoio/gtm-worker

By zotoio

•Updated about 8 years ago

Docker image to execute adhoc builds and tests for Github Task Manager

Image
1

6.1K

zotoio/gtm-worker repository overview

⁠GTM Worker

Docker Build Status

A general purpose docker image for execution by Github Task Manager⁠ agents using the Docker Executor. Tools such as nodejs, maven, java, gradle and sonar-scanner are baked in.

⁠Why?

To execute standalone adhoc builds and test runs, driven by environment variables passed in from GTM Agents servicing pull request hooks, without the overhead of managing external CI jobs.

⁠How?

The Github Task Manager Docker executor can pull a docker image, and run it with a set of environment vars and an adhoc command. This docker image incorporates a number of common tools that are useful for build and test executions.

⁠Install

The image is intended to be used by Github Task Manager, meaning no direct install is required.

Follow the guide here⁠ for implementation steps using the zotoio/gtm-worker docker image.

To run it locally for experimentation, create a .env file base on .envSample and:

docker run -it --env-file .env --net=host  zotoio/gtm-worker /bin/bash

..then use the scripts in the /usr/workspace directory.

For sonarqube support, install and configure the official docker image:

docker run -d --name sonarqube -p 9000:9000 -p 9092:9092 sonarqube

⁠Configuration

Environment variabledescription
SONAR_HOST_URLeg. http://localhost:9000⁠
SONAR_LOGINaccess token from SonarQube
SONAR_PROJECTNAME_PREFIXprefix to append for display in sonarqube - not used for pull requests
SONAR_SOURCESdefault is 'src' which is in the default checkout location
SONAR_JAVA_BINARIESdefault is 'target' which is in the default checkout location
SONAR_MODULESoptional comma separated list of modules. sonar will look for source and target within each
SONAR_GITHUB_REPOSITORYgit org/repo eg. zotoio/gtm-agent
SONAR_ANALYSIS_MODE'preview' used for pull requests
SONAR_GITHUB_OAUTHgithub personal access token
SONAR_KEEP_PROJECT_PROPERTIESIf not true, delete any sonar-project.properties files in repo
GIT_CLONEgit clone uri eg, https://github.com/org/repo.git⁠
GIT_PR_BRANCHNAMEbranch name from PR event
GIT_PR_IDpull request number from PR event
BUILD_TYPEnodejs or maven or gradle
BUILD_COMMANDcustom build command rather than derived from build type
S3_DEPENDENCY_BUCKETbucket name to cache node_modules etc
GTM_AWS_REGIONaws region env var if not using IAM instance role
GTM_AWS_ACCESS_KEY_IDaws access key env var if not using IAM instance role
GTM_AWS_SECRET_ACCESS_KEYaws secret env var if not using IAM instance role
IAM_ENABLED'true' to use ec2 instance profile
AWS_S3_PROXYproxy used to call s3 api
SLS_AWS_STAGEserverless executor stage
SLS_AWS_REGIONserverless executor region
SLS_CUSTOM_DOMAINcustom apigw domain
SLS_DEPLOY_MODEparallel or sequential deploy of multiple lambda packages
SLS_APIGW_ENDPOINT_TYPEEDGE, REGIONAL, or PRIVATE for private vpc endpoint
SLS_AWS_EXECUTION_ROLErole arn for lambda execution
SLS_DEPLOYMENT_S3_BUCKET_PREFIXuse a shared bucket prefix for central serverless mgmt
SLS_HTTP_PROXYhttps_proxy env var for sls build
SLS_NO_PROXYno_proxy env var for sls build
SLS_VPC_IDoptional vpc id for serverless deployments
SLS_VPC_SECURITY_GROUP_IDoptional security group id for serverless deployments
SLS_VPC_SUBNET_Aoptional subnet id for serverless deployments
SLS_VPC_SUBNET_Boptional subnet id for serverless deployments
SLS_VPC_SUBNET_Coptional subnet id for serverless deployments
SLS_AWS_KMS_KEY_IDkms key for sls encrypted env var
SLS_CONFIG_TYPEconfig type for sls package vars. 'ssm', 'spring' or 'dotev' (default)
SLS_SPRING_CONFIG_ENDPOINTendpoint url of spring config server eg. http://spring:8888⁠ if SLS_CONFIG_TYPE is 'spring'
GTM_WORKER_SCRIPTS_CLONEurl of git repo to overlay on workspace eg. https://github.com/zotoio/gtm-worker-scripts.git⁠
GTM_WORKER_SCRIPTS_PATHdirectory within scripts clone repo to overlay

Tag summary

Content type

Image

Digest

Size

732.8 MB

Last updated

about 8 years ago

docker pull zotoio/gtm-worker:1.8.0