Skip to content

Commit

Permalink
Merge pull request #299 from fullyint/source-path
Browse files Browse the repository at this point in the history
Update git remote URL before cloning on deploys
  • Loading branch information
swalkinshaw committed Aug 16, 2015
2 parents f18d68f + 59e8c19 commit b6aba1e
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions roles/deploy/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,24 @@
- name: Initialize
deploy_helper: path="{{ project_root }}" state=present

- name: Check whether project source path is a git repo
stat: path={{ project_source_path }}/.git
register: git_project

- name: Get current git remote URL
command: git config --get remote.origin.url
args:
chdir: "{{ project_source_path }}"
register: remote_origin_url
when: git_project.stat.exists
changed_when: false

- name: Update git remote URL
command: git remote set-url origin {{ project_git_repo }}
args:
chdir: "{{ project_source_path }}"
when: git_project.stat.exists and remote_origin_url.stdout != project_git_repo

- name: Clone project files
git: repo="{{ project_git_repo }}"
dest="{{ project_source_path }}"
Expand Down

0 comments on commit b6aba1e

Please sign in to comment.