Allow depending on changes we dont actually build

It is common practice in TripleO to depend on a documentation
change when changing some aspect of CI or dev tooling. However, we
can not actually build a package from these changes, so the job
will fail.

This change makes sure we only try to build the package if it maps
to some package in rdoinfo.  A debug message will be printed if no
package is found.

Change-Id: I076d1ed89bc8707630841cbcb2683295e935a944
Closes-Bug: 1679650
Co-Authored-By: Alex Schultz <aschultz@redhat.com>
This commit is contained in:
John Trowbridge 2017-04-04 20:38:11 +00:00 committed by Sagi Shnaidman
parent 45d316afff
commit 1ba891036e

View File

@ -38,46 +38,52 @@
rdopkg findpkg -s $PROJECT_NAME -l rdoinfo | grep ^name | awk '{print $2}'
args:
chdir: '{{ build_repo_dir }}/DLRN'
failed_when: project_name_mapped.stdout == ''
- name: Create data directory if doesn't exist yet
file: path="{{ build_repo_dir }}/DLRN/data/" state=directory
- debug:
msg: "WARNING: Unable to build {{ artg_change.project }}. No pkg found."
when: project_name_mapped.stdout == ''
- 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
- 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: 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: 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
- 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