Skip to content

Output the results of CI job traces right after a commit just like Heroku

License

Notifications You must be signed in to change notification settings

PandelisZ/gitlab-ci-trace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Output the results of CI job traces right after a commit just like Heroku

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published