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