diff options
author | Paul Bonaud <paul.bonaud@fretlink.com> | 2018-11-05 10:21:02 +0100 |
---|---|---|
committer | Paul Bonaud <paul.bonaud@fretlink.com> | 2018-11-05 10:21:02 +0100 |
commit | 70a4225043ccae14e8053811b8e84d12e10e0587 (patch) | |
tree | e6d6529270604d858175c6097b100c0baa549892 /tasks/deploy.yml | |
parent | 36858ff42eae09bd653d7fec8b770c93d91a06ab (diff) | |
download | ansible-clever-70a4225043ccae14e8053811b8e84d12e10e0587.tar.gz ansible-clever-70a4225043ccae14e8053811b8e84d12e10e0587.tar.zst ansible-clever-70a4225043ccae14e8053811b8e84d12e10e0587.zip |
fix: clever_app_root is provided & exec is outside of "parent dir"
Imagine such a usecase:
- project is in `/project`
- executing Ansible in `/ansible` with `clever_app_root: /project`
will fail deploying with the git push with the following error:
```
Not a git repository (or any of the parent directories): .git"
```
This PR fixes this.
Diffstat (limited to 'tasks/deploy.yml')
-rw-r--r-- | tasks/deploy.yml | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tasks/deploy.yml b/tasks/deploy.yml index 400a79d..ca8bf15 100644 --- a/tasks/deploy.yml +++ b/tasks/deploy.yml | |||
@@ -26,6 +26,8 @@ | |||
26 | 26 | ||
27 | - name: Push to Clever-Cloud to trigger deployment | 27 | - name: Push to Clever-Cloud to trigger deployment |
28 | command: "git push --force git+ssh://git@push-par-clevercloud-customers.services.clever-cloud.com/{{ clever_app }}.git HEAD:refs/heads/master" | 28 | command: "git push --force git+ssh://git@push-par-clevercloud-customers.services.clever-cloud.com/{{ clever_app }}.git HEAD:refs/heads/master" |
29 | args: | ||
30 | chdir: "{{ clever_app_root }}" | ||
29 | register: clever_git_push | 31 | register: clever_git_push |
30 | ignore_errors: true | 32 | ignore_errors: true |
31 | tags: | 33 | tags: |
@@ -33,6 +35,8 @@ | |||
33 | 35 | ||
34 | - name: First time push to Clever-Cloud needs a full git clone | 36 | - name: First time push to Clever-Cloud needs a full git clone |
35 | command: "git fetch --unshallow" | 37 | command: "git fetch --unshallow" |
38 | args: | ||
39 | chdir: "{{ clever_app_root }}" | ||
36 | when: | 40 | when: |
37 | - clever_git_push is failed | 41 | - clever_git_push is failed |
38 | - clever_git_push.stderr is search("shallow update not allowed") | 42 | - clever_git_push.stderr is search("shallow update not allowed") |
@@ -41,6 +45,8 @@ | |||
41 | 45 | ||
42 | - name: Push to Clever-Cloud to trigger deployment | 46 | - name: Push to Clever-Cloud to trigger deployment |
43 | command: "git push --force git+ssh://git@push-par-clevercloud-customers.services.clever-cloud.com/{{ clever_app }}.git HEAD:refs/heads/master" | 47 | command: "git push --force git+ssh://git@push-par-clevercloud-customers.services.clever-cloud.com/{{ clever_app }}.git HEAD:refs/heads/master" |
48 | args: | ||
49 | chdir: "{{ clever_app_root }}" | ||
44 | when: clever_git_push is failed | 50 | when: clever_git_push is failed |
45 | tags: | 51 | tags: |
46 | - skip_ansible_lint | 52 | - skip_ansible_lint |