Skip to content

Commit 32f638e

Browse files
authored
Merge pull request #550 from CodeNow/halt-bad-deployes
old tags shall not pass
2 parents 0724758 + 5c0f4c9 commit 32f638e

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

ansible/roles/builder/tasks/main.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,26 @@
2323
accept_hostkey: yes
2424
force: yes
2525

26+
- name: get new tags from remote
27+
tags: deploy
28+
become: true
29+
shell: "git fetch --tags"
30+
args:
31+
chdir: "{{ build_dir }}/{{ name }}/repo"
32+
33+
- name: get latest tag name
34+
tags: deploy
35+
become: true
36+
shell: "git describe --tags `git rev-list --tags --max-count=1`"
37+
args:
38+
chdir: "{{ build_dir }}/{{ name }}/repo"
39+
register: latest_tag
40+
41+
- name: ensure latest tag is deployed
42+
tags: deploy
43+
fail: msg="Cannot deploy {{ git_branch }} because latest is {{latest_tag.stdout}}. Bypass with `-t i_am_deploying_an_old_tag`"
44+
when: node_env=="production-delta" and latest_tag.stdout != git_branch and i_am_deploying_an_old_tag is not defined
45+
2646
- name: copy dockerfile to build folder
2747
tags: deploy
2848
become: true

0 commit comments

Comments
 (0)