689d759e64
* add "cachable: true" to set_fact calls when the fact would be used by other roles in later runs; the other fact names were checked to make sure they are not referred to in other roles * consolidate the formatting of the set_fact calls, using the proper yaml structure instead of `set_fact: foo=bar` Depends-On: I987d51cc252b7ebc3972d60497234fa676864882 Change-Id: I5dd3084ead618e357b1e7d841ea2ee794bd0569a
90 lines
3.0 KiB
YAML
90 lines
3.0 KiB
YAML
---
|
|
- name: Set release name
|
|
set_fact:
|
|
artg_release: "{{ artg_change.branch | replace('stable/', '') }}"
|
|
|
|
- name: Set DLRN distro (legacy distgit branch naming)
|
|
set_fact:
|
|
artg_distro: "rpm-{{ artg_release }}"
|
|
when: artg_release in ['master', 'mitaka']
|
|
|
|
- name: Set DLRN distro (new stable branch naming scheme)
|
|
set_fact:
|
|
artg_distro: "{{ artg_release }}-rdo"
|
|
when: artg_release not in ['master', 'mitaka']
|
|
|
|
- name: Use local baseurl when using local mirrors
|
|
set_fact:
|
|
dlrn_baseurl: 'file:///tmp/fake-dlrn-repos'
|
|
when: dlrn_use_local_mirrors|bool
|
|
|
|
- name: Override projects.ini settings
|
|
lineinfile:
|
|
dest: '{{ build_repo_dir }}/DLRN/projects.ini'
|
|
regexp: '{{ project_item.regexp }}'
|
|
line: '{{ project_item.line }}'
|
|
with_items:
|
|
- { regexp: 'baseurl=.*', line: 'baseurl={{ dlrn_baseurl }}' }
|
|
- { regexp: 'distro=.*', line: 'distro={{ artg_distro }}' }
|
|
- { regexp: 'source=.*', line: 'source={{ artg_change.branch }}' }
|
|
loop_control:
|
|
loop_var: project_item
|
|
|
|
- name: Map project name to DLRN project name
|
|
register: project_name_mapped
|
|
shell: >
|
|
source {{ build_repo_dir }}/dlrn-venv/bin/activate;
|
|
export PROJECT_NAME=$(echo {{ artg_change.project }} | sed "s|openstack/||");
|
|
rdopkg findpkg -s $PROJECT_NAME -l rdoinfo | grep ^name | awk '{print $2}'
|
|
args:
|
|
chdir: '{{ build_repo_dir }}/DLRN'
|
|
|
|
- debug:
|
|
msg: "WARNING: Unable to build {{ artg_change.project }}. No pkg found."
|
|
when: project_name_mapped.stdout == ''
|
|
|
|
- when: project_name_mapped.stdout != ''
|
|
block:
|
|
- name: Create data directory if doesn't exist yet
|
|
file: path="{{ build_repo_dir }}/DLRN/data/" state=directory
|
|
|
|
- name: Copy from ready directories if configured
|
|
command: >
|
|
cp -raf {{ artg_repos_dir }}/{{ artg_change.project|regex_replace('openstack[^/]*/', '') }}
|
|
{{ build_repo_dir }}/DLRN/data/{{ project_name_mapped.stdout }}
|
|
ignore_errors: true
|
|
register: copy_dir
|
|
when: artg_repos_dir is defined
|
|
|
|
- name: Clone the gated change
|
|
git:
|
|
repo: '{{ artg_change.host }}/{{ artg_change.project }}'
|
|
dest: '{{ build_repo_dir }}/DLRN/data/{{ project_name_mapped.stdout }}'
|
|
refspec: '{{ artg_change.refspec }}'
|
|
version: 'FETCH_HEAD'
|
|
when: artg_repos_dir is not defined or copy_dir|failed
|
|
|
|
- name: Run DLRN
|
|
shell: >
|
|
set +e;
|
|
source {{ build_repo_dir }}/dlrn-venv/bin/activate;
|
|
while true; do
|
|
dlrn --config-file projects.ini --head-only --package-name {{ project_name_mapped.stdout }} --local --info-repo rdoinfo --dev;
|
|
if [ $? -eq 0 ]; then
|
|
# SUCCESS
|
|
break;
|
|
elif [ $? -eq 1 ]; then
|
|
# FAILED
|
|
exit 1;
|
|
elif [ $? -eq 2 ]; then
|
|
# RETRY
|
|
continue;
|
|
fi;
|
|
# Unexpected DLRN return code
|
|
exit $?;
|
|
done;
|
|
args:
|
|
chdir: '{{ build_repo_dir }}/DLRN'
|
|
register: repo_built
|
|
|