File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 2727 executable : /bin/bash
2828 register : version
2929
30- - name : Obtain current branch of this repository.
30+ - name : Obtain current branch of this repository. Does not work in detached-head state.
3131 shell : git symbolic-ref HEAD | grep -o [^/]*$
3232 args :
3333 chdir : " {{ container_dir }}"
3434 executable : /bin/bash
3535 register : branch
36+ when : ("{{ lookup('env','GIT_BRANCH') }}" == "")
37+
38+ # Alternatively, we can obtain the branch in detached-head state using the
39+ # environment variable GIT_BRANCH if it is set. This helps out Jenkins.
40+ - name : Obtain current branch of this repository using GIT_BRANCH environment variable.
41+ shell : echo $GIT_BRANCH
42+ args :
43+ chdir : " {{ container_dir }}"
44+ executable : /bin/bash
45+ register : branch
46+ when : ("{{ lookup('env','GIT_BRANCH') }}" == "")
3647
3748# Exporting container filesystem as tarball.
3849
You can’t perform that action at this time.
0 commit comments