e34eee48ea
When a set of global_environment_variables is not provided, Ansible throws a warning: [WARNING]: could not parse environment value, skipping: [u'{{deployment_environment_variables | default({}) }}', u'{{global_environment_variables | default(omit) }}'] This patch returns an empty dict rather than using the omit filter. Change-Id: I5e3399b816779821e936b84a2972ca1db39c1a62
65 lines
2.2 KiB
YAML
65 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.
|
|
|
|
- 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 }}"
|
|
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: "{{ 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
|