| 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: | 
| Mohammed Naser | 332992a | 2020-04-26 12:39:05 -0400 | [diff] [blame] | 3 | paths: "{{ devstack_source_dirs }}" | 
| Monty Taylor | 36ddea3 | 2017-10-02 10:05:17 -0500 | [diff] [blame] | 4 | 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 Wienand | 7bb5fff | 2018-12-19 14:16:41 +1100 | [diff] [blame] | 12 | # 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 Frittoli | 1473884 | 2018-09-13 17:50:29 +0200 | [diff] [blame] | 36 | - 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 | 
| elajkat | 92b65a8 | 2024-08-05 11:39:06 +0200 | [diff] [blame] | 46 | elif [[ "$base_branch" == stable/* ]] || [[ "$base_branch" == unmaintained/* ]]; then | 
| Andrea Frittoli | 1473884 | 2018-09-13 17:50:29 +0200 | [diff] [blame] | 47 | # Look for an eol tag for the stable branch. | 
| elajkat | 92b65a8 | 2024-08-05 11:39:06 +0200 | [diff] [blame] | 48 | eol_tag="${base_branch#*/}-eol" | 
| Andrea Frittoli | 1473884 | 2018-09-13 17:50:29 +0200 | [diff] [blame] | 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 Taylor | 36ddea3 | 2017-10-02 10:05:17 -0500 | [diff] [blame] | 65 | - 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 |