Thank you very much!
very useful!

--
Kalibekov Marat
8 777 4826322

On Thu, Apr 21, 2016 at 1:37 PM, Magnus Therning <mag...@cipherstone.com>
wrote:

>
> Marat Kalibekov <ma...@kalibek.kz> writes:
>
> > Hi all!
> > Is it possible to get branch name in build via some variable?
>
> Yupp. I have the following to print some information on each CI build:
>
>     REPO=${CI_BUILD_REPO:-NoRepo}
>     BRANCH=${CI_BUILD_REF:-NoBranch}
>     BUILD_NUM=${CI_BUILD_ID:-NoNum}
>     REPONAME=$(basename ${CI_PROJECT_DIR:-NoProject})
>     GITLAB_ID=$(basename $(dirname ${CI_PROJECT_DIR:-NoGitlabID/foo}))
>     GIT_CS=$(git rev-parse --short HEAD)
>     BUILD_DEST=${GITLAB_ID}-${REPONAME}-${BUILD_NUM}-${GIT_CS}
>
>     cat <<-EOF
>     REPO :       ${REPO}
>     BRANCH :     ${BRANCH}
>     BUILD_NUM :  ${BUILD_NUM}
>     REPONAME :   ${REPONAME}
>     GITLAB_ID :  ${GITLAB_ID}
>     GIT_CS :     ${GIT_CS}
>     BUILD_DEST : ${BUILD_DEST}
>     EOF
>
> /M
>
> --
> Magnus Therning,  magnus.thern...@cipherstone.com
> Cipherstone Technologies AB
> Theres Svenssons gata 10, 417 55 Gothenburg, Sweden
>
> The right to search for truth implies also a duty; one must not
> conceal any part of what one has recognized to be true.
>      -- Albert Einstein
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "GitLab" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/gitlabhq/rFWGz0aat7g/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> gitlabhq+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/gitlabhq/87a8knl8e1.fsf%40sobel.cipherstone.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"GitLab" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to gitlabhq+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/gitlabhq/CAHk3d_JSAZ2Z%2BbR1iUtiM8VQiUsMxX0EniTHsW_F86v-0av0HQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to