Merge "DRY when installing components"

This commit is contained in:
Jenkins 2016-12-05 21:07:23 +00:00 committed by Gerrit Code Review
commit 86ac35f073
5 changed files with 40 additions and 112 deletions

View File

@ -29,3 +29,33 @@ reqs_git_branch: master
# Conditional variables utilized based on CI or manual testing options.
copy_from_local_path: false
ci_testing_zuul: false
bifrost_install_sources:
- git_folder: "{{ ironic_git_folder }}"
git_url: "{{ ironic_git_url }}"
git_branch: "{{ ironic_git_branch }}"
name: ironic
- git_folder: "{{ ironicclient_git_folder }}"
git_url: "{{ ironicclient_git_url }}"
git_branch: "{{ ironicclient_git_branch }}"
name: ironicclient
- git_folder: "{{ shade_git_folder }}"
git_url: "{{ shade_git_url }}"
git_branch: "{{ shade_git_branch }}"
name: shade
- git_folder: "{{ dib_git_folder }}"
git_url: "{{ dib_git_url }}"
git_branch: "{{ dib_git_branch }}"
name: dib
- git_folder: "{{ ironicinspector_git_folder }}"
git_url: "{{ ironicinspector_git_url }}"
git_branch: "{{ ironicinspector_git_branch }}"
name: ironicinspector
- git_folder: "{{ ironicinspectorclient_git_folder }}"
git_url: "{{ ironicinspectorclient_git_url }}"
git_branch: "{{ ironicinspectorclient_git_branch }}"
name: ironicinspectorclient
- git_folder: "{{ reqs_git_folder }}"
git_url: "{{ reqs_git_url }}"
git_branch: "{{ reqs_git_branch }}"
name: requirements

View File

@ -1,26 +0,0 @@
# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
#
# 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: "Clone repository"
command: git clone {{ git_url }} {{ git_folder }} chdir={{ git_root }} creates={{ git_folder }}
- name: "Check out branch"
command: git checkout -f {{ git_branch }} chdir={{ git_folder }}
- name: "Reset local repository"
command: git reset --hard {{ git_branch }} chdir={{ git_folder }}
- name: "Resync local repository"
command: git pull --ff-only chdir={{ git_folder }}

View File

@ -1,49 +0,0 @@
# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
#
# 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.
---
- include: git.yml
git_url="{{ ironic_git_url }}"
git_folder="{{ ironic_git_folder }}"
git_branch="{{ ironic_git_branch }}"
- include: git.yml
git_url="{{ ironicclient_git_url }}"
git_folder="{{ ironicclient_git_folder }}"
git_branch="{{ ironicclient_git_branch }}"
- include: git.yml
git_url="{{ shade_git_url }}"
git_folder="{{ shade_git_folder }}"
git_branch="{{ shade_git_branch }}"
- include: git.yml
git_url="{{ dib_git_url }}"
git_folder="{{ dib_git_folder }}"
git_branch="{{ dib_git_branch }}"
- include: git.yml
git_url="{{ ironicinspector_git_url }}"
git_folder="{{ ironicinspector_git_folder }}"
git_branch="{{ ironicinspector_git_branch }}"
- include: git.yml
git_url="{{ ironicinspectorclient_git_url }}"
git_folder="{{ ironicinspectorclient_git_folder }}"
git_branch="{{ ironicinspectorclient_git_branch }}"
- include: git.yml
git_url="{{ reqs_git_url }}"
git_folder="{{ reqs_git_folder }}"
git_branch="{{ reqs_git_branch }}"

View File

@ -1,35 +0,0 @@
# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
#
# 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: "ironic - Copy into place"
command: cp -a {{ ironic_git_url }} {{ ironic_git_folder }} chdir={{ git_root }} creates={{ ironic_git_folder }}
- name: "python-ironicclient - Copy into place"
command: cp -a {{ ironicclient_git_url }} {{ ironicclient_git_folder }} chdir={{ git_root }} creates={{ ironicclient_git_folder }}
- name: "Shade - Copy into place"
command: cp -a {{ shade_git_url }} {{ shade_git_folder }} chdir={{ git_root }} creates={{ shade_git_folder }}
- name: "Disk Image Builder - Copy into place"
command: cp -a {{ dib_git_url }} {{ dib_git_folder }} chdir={{ git_root }} creates={{ dib_git_folder }}
- name: "ironic-inspector - Copy into place"
command: cp -a {{ ironicinspector_git_url }} {{ ironicinspector_git_folder }} chdir={{ git_root }} creates={{ ironicinspector_git_folder }}
- name: "python-ironic-inspector-client - Copy into place"
command: cp -a {{ ironicinspectorclient_git_url }} {{ ironicinspectorclient_git_folder }} chdir={{ git_root }} creates={{ ironicinspectorclient_git_folder }}i
- name: "Clone upper requirements"
command: cp -a {{ reqs_git_url }} {{ reqs_git_folder }} chdir={{ git_root }} creates={{ reqs_git_folder }}

View File

@ -21,9 +21,17 @@
group: "{{ ansible_user_gid }}"
- name: "Download via GIT"
include: git_download.yaml
git:
dest: "{{ item.git_folder }}"
force: yes
repo: "{{ item.git_url }}"
version: "{{ item.git_branch }}"
update: yes
clone: yes
with_items: "{{ bifrost_install_sources }}"
when: ci_testing_zuul | bool == false and copy_from_local_path | bool == false
- name: "Copy from local path"
include: local_path.yaml
command: cp -a {{ item.git_url }} {{ item.git_folder }} creates={{ item.git_folder }}
with_items: "{{ bifrost_install_sources }}"
when: ci_testing_zuul | bool == true or copy_from_local_path | bool == true