fix: Handle case where destination exists but is not a git repo
Some checks failed
🚀 Build & Deploy Image / Build Runtime Base Image (push) Successful in 13s
🚀 Build & Deploy Image / Run Tests & Quality Checks (push) Has been skipped
Security Vulnerability Scan / Composer Security Audit (push) Has been skipped
🚀 Build & Deploy Image / Determine Build Necessity (push) Successful in 27s
Security Vulnerability Scan / Check for Dependency Changes (push) Successful in 31s
🚀 Build & Deploy Image / Build Docker Image (push) Successful in 13s
🚀 Build & Deploy Image / Auto-deploy to Staging (push) Failing after 1m22s
🚀 Build & Deploy Image / Auto-deploy to Production (push) Has been skipped
Some checks failed
🚀 Build & Deploy Image / Build Runtime Base Image (push) Successful in 13s
🚀 Build & Deploy Image / Run Tests & Quality Checks (push) Has been skipped
Security Vulnerability Scan / Composer Security Audit (push) Has been skipped
🚀 Build & Deploy Image / Determine Build Necessity (push) Successful in 27s
Security Vulnerability Scan / Check for Dependency Changes (push) Successful in 31s
🚀 Build & Deploy Image / Build Docker Image (push) Successful in 13s
🚀 Build & Deploy Image / Auto-deploy to Staging (push) Failing after 1m22s
🚀 Build & Deploy Image / Auto-deploy to Production (push) Has been skipped
- Check if destination directory exists separately from git repo check - Remove directory if it exists but is not a git repository - Prevents 'destination path already exists' error during clone
This commit is contained in:
@@ -44,6 +44,18 @@
|
|||||||
path: "{{ application_code_dest }}/.git"
|
path: "{{ application_code_dest }}/.git"
|
||||||
register: git_repo_exists
|
register: git_repo_exists
|
||||||
|
|
||||||
|
- name: Check if destination directory exists
|
||||||
|
stat:
|
||||||
|
path: "{{ application_code_dest }}"
|
||||||
|
register: dest_dir_exists
|
||||||
|
|
||||||
|
- name: Remove destination directory if it exists but is not a git repo
|
||||||
|
file:
|
||||||
|
path: "{{ application_code_dest }}"
|
||||||
|
state: absent
|
||||||
|
when: dest_dir_exists.stat.exists and not git_repo_exists.stat.exists
|
||||||
|
become: yes
|
||||||
|
|
||||||
- name: Clone repository (if not exists)
|
- name: Clone repository (if not exists)
|
||||||
ansible.builtin.git:
|
ansible.builtin.git:
|
||||||
repo: "{{ git_repo_url }}"
|
repo: "{{ git_repo_url }}"
|
||||||
|
|||||||
Reference in New Issue
Block a user