|  | - name: Find all OpenStack source repos used by this job | 
|  | find: | 
|  | paths: | 
|  | - src/opendev.org/opendev | 
|  | - src/opendev.org/openstack | 
|  | - src/opendev.org/openstack-dev | 
|  | - src/opendev.org/openstack-infra | 
|  | - src/opendev.org/starlingx | 
|  | - src/opendev.org/x | 
|  | - src/opendev.org/zuul | 
|  | file_type: directory | 
|  | register: found_repos | 
|  |  | 
|  | - name: Copy Zuul repos into devstack working directory | 
|  | command: rsync -a {{ item.path }} {{ devstack_base_dir }} | 
|  | with_items: '{{ found_repos.files }}' | 
|  | become: yes | 
|  |  | 
|  | # Github projects are github.com/username/repo (username might be a | 
|  | # top-level project too), so we have to do a two-step swizzle to just | 
|  | # get the full repo path (ansible's find module doesn't help with this | 
|  | # :/) | 
|  | - name: Find top level github projects | 
|  | find: | 
|  | paths: | 
|  | - src/github.com | 
|  | file_type: directory | 
|  | register: found_github_projects | 
|  |  | 
|  | - name: Find actual github repos | 
|  | find: | 
|  | paths: '{{ found_github_projects.files | map(attribute="path") | list }}' | 
|  | file_type: directory | 
|  | register: found_github_repos | 
|  | when: found_github_projects.files | 
|  |  | 
|  | - name: Copy github repos into devstack working directory | 
|  | command: rsync -a {{ item.path }} {{ devstack_base_dir }} | 
|  | with_items: '{{ found_github_repos.files }}' | 
|  | become: yes | 
|  | when: found_github_projects.files | 
|  |  | 
|  | - name: Setup refspec for repos into devstack working directory | 
|  | shell: | 
|  | # Copied almost "as-is" from devstack-gate setup-workspace function | 
|  | # but removing the dependency on functions.sh | 
|  | # TODO this should be rewritten as a python module. | 
|  | cmd: | | 
|  | cd {{ devstack_base_dir }}/{{ item.path | basename }} | 
|  | base_branch={{ devstack_sources_branch }} | 
|  | if git branch -a | grep "$base_branch" > /dev/null ; then | 
|  | git checkout $base_branch | 
|  | elif [[ "$base_branch" == stable/* ]]; then | 
|  | # Look for an eol tag for the stable branch. | 
|  | eol_tag=${base_branch#stable/}-eol | 
|  | if git tag -l |grep $eol_tag >/dev/null; then | 
|  | git checkout $eol_tag | 
|  | git reset --hard $eol_tag | 
|  | if ! git clean -x -f -d -q ; then | 
|  | sleep 1 | 
|  | git clean -x -f -d -q | 
|  | fi | 
|  | fi | 
|  | else | 
|  | git checkout master | 
|  | fi | 
|  | args: | 
|  | executable: /bin/bash | 
|  | with_items: '{{ found_repos.files }}' | 
|  | when: devstack_sources_branch is defined | 
|  |  | 
|  | - name: Set ownership of repos | 
|  | file: | 
|  | path: '{{ devstack_base_dir }}' | 
|  | state: directory | 
|  | recurse: true | 
|  | owner: stack | 
|  | group: stack | 
|  | become: yes |