File tree Expand file tree Collapse file tree 1 file changed +2
-11
lines changed Expand file tree Collapse file tree 1 file changed +2
-11
lines changed Original file line number Diff line number Diff line change 27
27
executable : /bin/bash
28
28
register : version
29
29
30
- - name : Obtain current branch of this repository. Does not work in detached-head state.
31
- shell : git symbolic-ref HEAD | grep -o [^/]*$
32
- args :
33
- chdir : " {{ container_dir }}"
34
- executable : /bin/bash
35
- register : branch
36
- when : ("{{ lookup('env','GIT_BRANCH') }}" == "")
37
-
38
30
# Alternatively, we can obtain the branch in detached-head state using the
39
31
# 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
32
+ - name : Obtain current branch of this repository.
33
+ shell : if [ -z "$GIT_BRANCH" ]; then git symbolic-ref HEAD | grep -o [^/]*$; else echo " $GIT_BRANCH"; fi
42
34
args :
43
35
chdir : " {{ container_dir }}"
44
36
executable : /bin/bash
45
37
register : branch
46
- when : ("{{ lookup('env','GIT_BRANCH') }}" == "")
47
38
48
39
# Exporting container filesystem as tarball.
49
40
You can’t perform that action at this time.
0 commit comments