... | ... |
@@ -12,6 +12,35 @@ |
12 | 12 |
with_items: '{{ found_repos.files }}' |
13 | 13 |
become: yes |
14 | 14 |
|
15 |
+- name: Setup refspec for repos into devstack working directory |
|
16 |
+ shell: |
|
17 |
+ # Copied almost "as-is" from devstack-gate setup-workspace function |
|
18 |
+ # but removing the dependency on functions.sh |
|
19 |
+ # TODO this should be rewritten as a python module. |
|
20 |
+ cmd: | |
|
21 |
+ cd {{ devstack_base_dir }}/{{ item.path | basename }} |
|
22 |
+ base_branch={{ devstack_sources_branch }} |
|
23 |
+ if git branch -a | grep "$base_branch" > /dev/null ; then |
|
24 |
+ git checkout $base_branch |
|
25 |
+ elif [[ "$base_branch" == stable/* ]]; then |
|
26 |
+ # Look for an eol tag for the stable branch. |
|
27 |
+ eol_tag=${base_branch#stable/}-eol |
|
28 |
+ if git tag -l |grep $eol_tag >/dev/null; then |
|
29 |
+ git checkout $eol_tag |
|
30 |
+ git reset --hard $eol_tag |
|
31 |
+ if ! git clean -x -f -d -q ; then |
|
32 |
+ sleep 1 |
|
33 |
+ git clean -x -f -d -q |
|
34 |
+ fi |
|
35 |
+ fi |
|
36 |
+ else |
|
37 |
+ git checkout master |
|
38 |
+ fi |
|
39 |
+ args: |
|
40 |
+ executable: /bin/bash |
|
41 |
+ with_items: '{{ found_repos.files }}' |
|
42 |
+ when: devstack_sources_branch is defined |
|
43 |
+ |
|
15 | 44 |
- name: Set ownership of repos |
16 | 45 |
file: |
17 | 46 |
path: '{{ devstack_base_dir }}' |