We are using GitlabHQ and Gitlab-CI in our infrastructure. Having such continuous integration set we are willing to customize the build logic in CI.
Right now on new commit GitlabHQ triggers a hook to CI, which tells gitlab-ci-runner to run a build or test.
Runner has a hardcoded logic (at least not customizable in web UI) and before running user-defined scripts issues these commands:
cd $HOMEDIR/gitlab-ci-runner/tmp/builds && git clone git@$GITLABSERVER:root/test1.git project-1 && cd project-1 && git checkout $COMMIT cd $HOMEDIR/gitlab-ci-runner/tmp/builds/project-1 && git reset --hard && git checkout $COMMIT
and then user-defined scripts go
What do I want:
- customize options passed to git
- run some user-defined scripts before commands above are issued (in my case I want to start a Virtual Machine kept on runner in order to get a clean env for tests)
The questions is: Has anyone hit the similar situation? Is there a nice way to workaround the absence of needed options?
Right now I am using a very dirty hack: replaced git binary with bash script named 'git', which catches options passed to git and runs it inside virtual machine, but that does not seem to be a nice way IMO.