Revert "Revert "Add ability to have dlrn build all the packages at once""

This reverts commit 2af6e87045.

This includes a fix for the repo_built variable logic

It turns out ansible will always register a variable even if a task is
skipped. In this case, that means we are not properly collecting the
repo since repo_built is skipped in the second declaration.  This logic
works fine if artg_build_one is false but not if it is true (the
default)

Change-Id: I1408d9ded18cdacbd1fb5410e70de2ef8104f950
This commit is contained in:
Alex Schultz 2018-09-18 14:28:21 +00:00
parent cb23aba7b6
commit 65384f03fd
4 changed files with 42 additions and 3 deletions

View File

@ -32,6 +32,9 @@ Role Variables
to skip projects that DLRN cannot build.
* `artg_repos_dir` -- Root directory which contains project directories with
sources for build.
* `artg_build_one` -- Boolean to indicate if dlrn should build one package at a
time. If set to false, dlrn will be run to build all the required packages
in one invocation of dlrn.
* `dlrn_target` -- Target for the DLRN build Can be something like centos or
fedora. Defaults to centos.
* `dlrn_baseurl` -- URL used by DLRN to get the repo definitions when building

View File

@ -5,6 +5,7 @@ build_repo_dir: "{{ ansible_user_dir }}"
artg_dlrn_repo_url: "https://github.com/openstack-packages/DLRN.git"
artg_rdoinfo_repo_url: "https://github.com/redhat-openstack/rdoinfo"
artg_compressed_gating_repo: "/home/stack/gating_repo.tar.gz"
artg_build_one: True
dlrn_target: centos
dlrn_cleanup: false
dlrn_baseurl: "https://trunk.rdoproject.org/centos7/"

View File

@ -43,8 +43,17 @@
msg: "WARNING: Unable to build {{ artg_change.project }}. No pkg found."
when: project_name_mapped.stdout == ''
- name: Ensure artg_rdo_packages is defined
set_fact:
artg_rdo_packages: []
when: artg_rdo_packages is not defined
- when: project_name_mapped.stdout != ''
block:
- name: Append project name to package list
set_fact:
artg_rdo_packages: '{{ artg_rdo_packages }} + {{ [ project_name_mapped.stdout ] }}'
- name: Create data directory if doesn't exist yet
file: path="{{ build_repo_dir }}/DLRN/data/" state=directory
@ -95,4 +104,5 @@
args:
chdir: '{{ build_repo_dir }}/DLRN'
register: repo_built
when: artg_build_one|bool

View File

@ -154,6 +154,31 @@
- item.project not in artg_skipped_projects
- release in item.branch
- 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 {{ artg_rdo_packages|join(' --package-name ') }} --local --info-repo rdoinfo --dev --order;
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_multi
when: not artg_build_one|bool
- block:
- name: Create a directory to hold the rpms
file:
@ -175,9 +200,9 @@
shell: 'tar czf {{ artg_compressed_gating_repo }} gating_repo'
args:
chdir: '{{ build_repo_dir }}'
when:
- repo_built is defined
- repo_built.skipped is not defined
when: >
(repo_built is defined and repo_built.skipped is not defined) or
(repo_built_multi is defined and repo_built_multi.skipped is not defined)
- name: Clean up
file: