Skip to content

Commit 65d6b31

Browse files
committed
Fix syntax mistake.
1 parent 126d21c commit 65d6b31

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

jobs/hook_container.yml

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,14 @@
2727
executable: /bin/bash
2828
register: version
2929

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-
3830
# Alternatively, we can obtain the branch in detached-head state using the
3931
# 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
4234
args:
4335
chdir: "{{ container_dir }}"
4436
executable: /bin/bash
4537
register: branch
46-
when: ("{{ lookup('env','GIT_BRANCH') }}" == "")
4738

4839
# Exporting container filesystem as tarball.
4940

0 commit comments

Comments
 (0)