| Ian Wienand | 7bb5fff | 2018-12-19 14:16:41 +1100 | [diff] [blame] | 1 | - name: Find all OpenStack source repos used by this job | 
| Monty Taylor | 36ddea3 | 2017-10-02 10:05:17 -0500 | [diff] [blame] | 2 |   find: | 
 | 3 |     paths: | 
| Monty Taylor | dc9ba8b | 2019-04-23 13:02:00 +0000 | [diff] [blame] | 4 |       - src/opendev.org/opendev | 
| OpenDev Sysadmins | 666f549 | 2019-04-19 19:43:10 +0000 | [diff] [blame] | 5 |       - src/opendev.org/openstack | 
 | 6 |       - src/opendev.org/openstack-dev | 
 | 7 |       - src/opendev.org/openstack-infra | 
| Dean Troyer | e7f3d91 | 2019-04-20 09:11:58 -0500 | [diff] [blame] | 8 |       - src/opendev.org/starlingx | 
 | 9 |       - src/opendev.org/x | 
 | 10 |       - src/opendev.org/zuul | 
| Monty Taylor | 36ddea3 | 2017-10-02 10:05:17 -0500 | [diff] [blame] | 11 |     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 Wienand | 7bb5fff | 2018-12-19 14:16:41 +1100 | [diff] [blame] | 19 | # 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 Frittoli | 1473884 | 2018-09-13 17:50:29 +0200 | [diff] [blame] | 43 | - 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 Taylor | 36ddea3 | 2017-10-02 10:05:17 -0500 | [diff] [blame] | 72 | - 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 |