From d5257198428c3c4b8f48679cd4918d370f8e6e79 Mon Sep 17 00:00:00 2001 From: Anandkumar Patel Date: Wed, 3 Aug 2016 09:35:35 -0700 Subject: [PATCH] fail delta deployes if not a version --- ansible/roles/build_with_dockerfile/tasks/main.yml | 5 +++++ ansible/roles/builder/tasks/main.yml | 6 ++++++ ansible/roles/git_repo/tasks/main.yml | 5 +++++ 3 files changed, 16 insertions(+) diff --git a/ansible/roles/build_with_dockerfile/tasks/main.yml b/ansible/roles/build_with_dockerfile/tasks/main.yml index 858daa33..d61c1d15 100644 --- a/ansible/roles/build_with_dockerfile/tasks/main.yml +++ b/ansible/roles/build_with_dockerfile/tasks/main.yml @@ -1,5 +1,10 @@ --- # commands to build an image from a repo that contains a Dockerfile +- name: Ensure Tag Deploy For Prod + tags: deploy + when: not git_branch | match("^v([0-9]+)\.([0-9]+)\.([0-9]+)$") and node_env=="production-delta" + fail: msg="only tag can be deployed on prod not {{ git_branch }}" + - name: create build folder become: true file: diff --git a/ansible/roles/builder/tasks/main.yml b/ansible/roles/builder/tasks/main.yml index f58d2c49..1a4d1589 100644 --- a/ansible/roles/builder/tasks/main.yml +++ b/ansible/roles/builder/tasks/main.yml @@ -1,5 +1,11 @@ --- # commands to build an image +# +- name: Ensure Tag Deploy For Prod + tags: deploy + when: not git_branch | match("^v([0-9]+)\.([0-9]+)\.([0-9]+)$") and node_env=="production-delta" + fail: msg="only tag can be deployed on prod not {{ git_branch }}" + - name: create build folder become: true file: diff --git a/ansible/roles/git_repo/tasks/main.yml b/ansible/roles/git_repo/tasks/main.yml index b5c0c71e..982668ad 100644 --- a/ansible/roles/git_repo/tasks/main.yml +++ b/ansible/roles/git_repo/tasks/main.yml @@ -1,4 +1,9 @@ --- +- name: Ensure Tag Deploy For Prod + tags: deploy + when: not git_branch | match("^v([0-9]+)\.([0-9]+)\.([0-9]+)$") and node_env=="production-delta" + fail: msg="only tag can be deployed on prod not {{ git_branch }}" + - name: Display Git Repo Name debug: msg: "application Installed: {{ app_name }}, branch : {{ git_branch }} "