blob: 160757ede919ddb6a99a4cbbe0eadf0e4b2c0a2f [file] [log] [blame]
Ian Wienand7bb5fff2018-12-19 14:16:41 +11001- name: Find all OpenStack source repos used by this job
Monty Taylor36ddea32017-10-02 10:05:17 -05002 find:
3 paths:
Monty Taylordc9ba8b2019-04-23 13:02:00 +00004 - src/opendev.org/opendev
OpenDev Sysadmins666f5492019-04-19 19:43:10 +00005 - src/opendev.org/openstack
6 - src/opendev.org/openstack-dev
7 - src/opendev.org/openstack-infra
Dean Troyere7f3d912019-04-20 09:11:58 -05008 - src/opendev.org/starlingx
9 - src/opendev.org/x
10 - src/opendev.org/zuul
Monty Taylor36ddea32017-10-02 10:05:17 -050011 file_type: directory
12 register: found_repos
13
14- name: Copy Zuul repos into devstack working directory
15 command: rsync -a {{ item.path }} {{ devstack_base_dir }}
16 with_items: '{{ found_repos.files }}'
17 become: yes
18
Ian Wienand7bb5fff2018-12-19 14:16:41 +110019# Github projects are github.com/username/repo (username might be a
20# top-level project too), so we have to do a two-step swizzle to just
21# get the full repo path (ansible's find module doesn't help with this
22# :/)
23- name: Find top level github projects
24 find:
25 paths:
26 - src/github.com
27 file_type: directory
28 register: found_github_projects
29
30- name: Find actual github repos
31 find:
32 paths: '{{ found_github_projects.files | map(attribute="path") | list }}'
33 file_type: directory
34 register: found_github_repos
35 when: found_github_projects.files
36
37- name: Copy github repos into devstack working directory
38 command: rsync -a {{ item.path }} {{ devstack_base_dir }}
39 with_items: '{{ found_github_repos.files }}'
40 become: yes
41 when: found_github_projects.files
42
Andrea Frittoli14738842018-09-13 17:50:29 +020043- name: Setup refspec for repos into devstack working directory
44 shell:
45 # Copied almost "as-is" from devstack-gate setup-workspace function
46 # but removing the dependency on functions.sh
47 # TODO this should be rewritten as a python module.
48 cmd: |
49 cd {{ devstack_base_dir }}/{{ item.path | basename }}
50 base_branch={{ devstack_sources_branch }}
51 if git branch -a | grep "$base_branch" > /dev/null ; then
52 git checkout $base_branch
53 elif [[ "$base_branch" == stable/* ]]; then
54 # Look for an eol tag for the stable branch.
55 eol_tag=${base_branch#stable/}-eol
56 if git tag -l |grep $eol_tag >/dev/null; then
57 git checkout $eol_tag
58 git reset --hard $eol_tag
59 if ! git clean -x -f -d -q ; then
60 sleep 1
61 git clean -x -f -d -q
62 fi
63 fi
64 else
65 git checkout master
66 fi
67 args:
68 executable: /bin/bash
69 with_items: '{{ found_repos.files }}'
70 when: devstack_sources_branch is defined
71
Monty Taylor36ddea32017-10-02 10:05:17 -050072- name: Set ownership of repos
73 file:
74 path: '{{ devstack_base_dir }}'
75 state: directory
76 recurse: true
77 owner: stack
78 group: stack
79 become: yes