Clone repos with zuul changes applied
Clone required repos for CI and apply ZUUL changes on them. Change-Id: Idad0dee8a8bd1923c20adcde983a38ceb7442a4e
This commit is contained in:
parent
6b1fc20ecf
commit
1323845b43
@ -1,3 +1,10 @@
|
||||
nodepool_cirros_url: http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img
|
||||
nodepool_cirros_dest: /opt/cache/files/cirros-0.3.5-x86_64-disk.img
|
||||
nodepool_cirros_checksum: md5:f8ab98ff5e73ebab884d80c9dc9c7290
|
||||
repos:
|
||||
- https://git.openstack.org/openstack/tripleo-quickstart
|
||||
- https://git.openstack.org/openstack/tripleo-quickstart-extras
|
||||
- https://git.openstack.org/openstack-infra/tripleo-ci
|
||||
- https://git.openstack.org/openstack-dev/devstack
|
||||
- https://git.openstack.org/openstack-infra/devstack-gate
|
||||
zuul_changes: "{{ lookup('env', 'ZUUL_CHANGES') }}"
|
||||
|
@ -16,17 +16,20 @@
|
||||
state: link
|
||||
become: true
|
||||
|
||||
- name: Clone repos
|
||||
git:
|
||||
repo: "{{ item }}"
|
||||
dest: "/opt/stack/{{ item.split('/')[-1] }}"
|
||||
version: master
|
||||
with_items:
|
||||
- https://git.openstack.org/openstack/tripleo-quickstart
|
||||
- https://git.openstack.org/openstack/tripleo-quickstart-extras
|
||||
- https://git.openstack.org/openstack-infra/tripleo-ci
|
||||
- https://git.openstack.org/openstack-dev/devstack
|
||||
- https://git.openstack.org/openstack-infra/devstack-gate
|
||||
- name: Set up git credentials
|
||||
shell: >
|
||||
git config --global user.email "user@example.com";
|
||||
git config --global user.name "CI user"
|
||||
|
||||
- include_tasks: patch_repos.yml
|
||||
with_items: "{{ repos }}"
|
||||
loop_control:
|
||||
loop_var: repo_item
|
||||
|
||||
- name: Set oooq extras to install from local copy
|
||||
copy:
|
||||
dest: /opt/stack/tripleo-quickstart/quickstart-extras-requirements.txt
|
||||
content: git+file:///opt/stack/tripleo-quickstart-extras/#egg=tripleo-quickstart-extras
|
||||
|
||||
- name: Create /opt/cache/files directory
|
||||
file:
|
||||
|
35
roles/nodepool-setup/tasks/patch_repos.yml
Normal file
35
roles/nodepool-setup/tasks/patch_repos.yml
Normal file
@ -0,0 +1,35 @@
|
||||
- name: Check if repo should be changed
|
||||
set_fact:
|
||||
proj: "{{ repo_item.replace('.git', '').split('/')[-2:]|join('/') }}:"
|
||||
|
||||
- name: Clone usually if project has no changes to apply
|
||||
git:
|
||||
repo: "{{ repo_item }}"
|
||||
dest: "/opt/stack/{{ repo_item.replace('.git', '').split('/')[-1] }}"
|
||||
version: master
|
||||
when: proj not in zuul_changes
|
||||
|
||||
- name: Clone project and apply changes to it
|
||||
when: proj in zuul_changes
|
||||
block:
|
||||
|
||||
- name: Get changes
|
||||
set_fact:
|
||||
zuul_changes_list: "{{ zuul_changes.split('^')|list }}"
|
||||
|
||||
- name: Clone repo and apply change
|
||||
shell: |
|
||||
export dir={{ item.split(':')[0].split('/')[1] }}
|
||||
export refs={{ item.split(':')[2] }}
|
||||
if [[ ! -e $dir ]]; then
|
||||
git clone {{ repo_item }}
|
||||
cd $dir
|
||||
git fetch {{ repo_item }} $refs && git checkout FETCH_HEAD
|
||||
else
|
||||
cd $dir
|
||||
git fetch {{ repo_item }} $refs && git cherry-pick --allow-empty FETCH_HEAD
|
||||
fi
|
||||
with_items: "{{ zuul_changes_list }}"
|
||||
when: proj in item
|
||||
args:
|
||||
chdir: /opt/stack
|
Loading…
Reference in New Issue
Block a user