69 lines
2.2 KiB
YAML
69 lines
2.2 KiB
YAML
---
|
|
# Copyright 2015, Rackspace US, Inc.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
# TODO (odyssey4me): Remove in Pike
|
|
- name: Remove clone process script (from Newton and before)
|
|
file:
|
|
path: "/opt/op-clone-script.sh"
|
|
state: absent
|
|
|
|
- name: Check if the git folder exists already
|
|
stat:
|
|
path: "{{ repo_build_git_dir }}"
|
|
register: _git_folder
|
|
|
|
- name: Git service data folder setup
|
|
file:
|
|
path: "{{ (_git_folder.stat.exists and _git_folder.stat.islnk) | ternary(_git_folder.stat.lnk_source, repo_build_git_dir) }}"
|
|
state: "directory"
|
|
owner: "{{ repo_build_service_user_name }}"
|
|
group: "{{ repo_build_service_group_name }}"
|
|
recurse: true
|
|
|
|
- name: Retrieve requirements content
|
|
slurp:
|
|
src: "{{ repo_build_release_path }}/requirements.txt"
|
|
register: slurp_requirements
|
|
|
|
- name: Clone git repositories asynchronously
|
|
become: yes
|
|
become_user: "{{ repo_build_service_user_name }}"
|
|
git:
|
|
repo: "{{ item['url'] }}"
|
|
dest: "{{ repo_build_git_dir }}/{{ item['name'] }}"
|
|
version: "{{ item['version'] }}"
|
|
force: yes
|
|
with_items: "{{ local_packages.results.0.item.remote_package_parts }}"
|
|
when: >
|
|
(not repo_build_git_selective | bool) or
|
|
(item['name'] in slurp_requirements.content | b64decode | splitlines) or
|
|
((groups[item['project_group']] is defined) and (groups[item['project_group']] | length > 0))
|
|
register: _git_clone
|
|
async: 1800
|
|
poll: 0
|
|
|
|
- name: Wait for git clones to complete
|
|
become: yes
|
|
become_user: "{{ repo_build_service_user_name }}"
|
|
async_status:
|
|
jid: "{{ item['ansible_job_id'] }}"
|
|
register: _git_jobs
|
|
until: _git_jobs['finished'] | bool
|
|
delay: 5
|
|
retries: 360
|
|
with_items: "{{ _git_clone['results'] }}"
|
|
when:
|
|
- item['ansible_job_id'] is defined
|