Hook data in environment variables
At the moment in build scenario we can use some environment variables, that exported by runner (https://gitlab.com/gitlab-org/gitlab-ci-runner/blob/master/lib/build.rb#L133). Idea is to export some additional data that coming from gitlab, for example, repo url or all data that becomes with hook - https://gitlab.com/help/web_hooks/web_hooks.md#push-events
"user_id": 4,
"user_name": "John Smith",
"project_id": 15,
"repository": {
"name": "Diaspora",
"url": "git@example.com:diaspora.git",
"description": "",
"homepage": "http://example.com/diaspora"
}
With this we can ability write deploy's scenario (or any other) in more simple way that now.
if [[ "$CI_BUILD_REF_NAME" = "master" ]]
then
ssh -t -t deploy.host "
cd /path_to_/ &&
git clone $CI_BUILD_REPO_NAME
"
fi
where $CI_BUILD_REPO_NAME
is repo url like this http://gitlab-ci-token:token@git.devlabs.me/repos/repo.git
or git@example.com:diaspora.git
Edited by 🤖 GitLab Bot 🤖