Marat Kalibekov <[email protected]> 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, [email protected]
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 the Google Groups
"GitLab" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
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.