blob: c196c37e09503133c543f5dde77e9a4ac9317e7f [file] [log] [blame]
Monty Taylor36ddea32017-10-02 10:05:17 -05001- name: Find all source repos used by this job
2 find:
3 paths:
4 - src/git.openstack.org/openstack
5 - src/git.openstack.org/openstack-dev
6 - src/git.openstack.org/openstack-infra
7 file_type: directory
8 register: found_repos
9
10- name: Copy Zuul repos into devstack working directory
11 command: rsync -a {{ item.path }} {{ devstack_base_dir }}
12 with_items: '{{ found_repos.files }}'
13 become: yes
14
Andrea Frittoli14738842018-09-13 17:50:29 +020015- name: Setup refspec for repos into devstack working directory
16 shell:
17 # Copied almost "as-is" from devstack-gate setup-workspace function
18 # but removing the dependency on functions.sh
19 # TODO this should be rewritten as a python module.
20 cmd: |
21 cd {{ devstack_base_dir }}/{{ item.path | basename }}
22 base_branch={{ devstack_sources_branch }}
23 if git branch -a | grep "$base_branch" > /dev/null ; then
24 git checkout $base_branch
25 elif [[ "$base_branch" == stable/* ]]; then
26 # Look for an eol tag for the stable branch.
27 eol_tag=${base_branch#stable/}-eol
28 if git tag -l |grep $eol_tag >/dev/null; then
29 git checkout $eol_tag
30 git reset --hard $eol_tag
31 if ! git clean -x -f -d -q ; then
32 sleep 1
33 git clean -x -f -d -q
34 fi
35 fi
36 else
37 git checkout master
38 fi
39 args:
40 executable: /bin/bash
41 with_items: '{{ found_repos.files }}'
42 when: devstack_sources_branch is defined
43
Monty Taylor36ddea32017-10-02 10:05:17 -050044- name: Set ownership of repos
45 file:
46 path: '{{ devstack_base_dir }}'
47 state: directory
48 recurse: true
49 owner: stack
50 group: stack
51 become: yes