openstack-ansible-repo_build/tasks/repo_clone_git.yml
zhulingjie 4a6aeadd43 Remove the unnecessary space
Change-Id: Ib65b3644fe375978b84a85938efbd09437862cbe
2018-08-18 00:58:22 +08:00

58 lines
2.0 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.
- 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: Build filtered list of repos to clone
set_fact:
_repo_build_git_clone_list: "{{ _repo_build_git_clone_list | default([]) + [ item ] }}"
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))
- name: Clone git repositories
become: yes
become_user: "{{ repo_build_service_user_name }}"
environment: "{{ global_environment_variables | default({}) }}"
git:
repo: "{{ item['url'] }}"
dest: "{{ repo_build_git_dir }}/{{ item['name'] }}"
version: "{{ item['version'] }}"
depth: "{{ repo_build_git_depth }}"
force: yes
with_items: "{{ _repo_build_git_clone_list }}"
register: _git_clone
until: _git_clone is success
delay: 5
retries: 10