Skip to content

Latest commit

 

History

History
52 lines (34 loc) · 1.37 KB

README.md

File metadata and controls

52 lines (34 loc) · 1.37 KB

gitlab-ci-trace

npm version

Output the results of CI job traces into the console that has pushed the commit. This mimics the behaviour users of Heroku are used to where by a push to heroku will trigger a build and the build status appears as part of the push status.

Features

  • Support for gitlab.com or custom deployments
  • Auto detects the GitLab host based on the ssh or https git url
  • Trace multiple simultaneous jobs
  • Auto detect the correct running jobs based on the HEAD commit hash

Usage

npm install -g gitlab-ci-trace

You'll also need to set an enviroment variable in your bash enviroment so that we can make API requests to GitLab.

The token will need access to the API scope

# ~/.bashrc
export GITLAB_TOKEN='IMATOKENWEEE'

Unfortunately there is no functionality within git itself for a post push hook which is what we would like to hook onto. Instead we need to use a git alias.

You can choose to name the alias whatever you want. I chose git pusht for push and trace.

# ~/.gitconfig
[alias]
	pusht = !"git push $* && gitlab-ci-trace"

or

git config --global alias.pusht '!git push $* && gitlab-ci-trace'

You can also choose to just call the command directly after a push when you need to check on the status of a build.