Add options to use local DLRN and CentOS mirrors

Add the dlrn_baseurl option that allows overriding the DLRN server,
making possible to use a proxy upstream. Also add
dlrn_use_local_mirrors option. When true, the package building will
use the already defined CentOS and DLRN repos from the machine where
the packages are built.

Also move the rdoinfo repo fetching in the main part of the role to
save time and bandwidth.

Change-Id: I0b440895267fcd8027394504649372bd923128d6
Closes-bug: #1710678
This commit is contained in:
Attila Darazs 2017-08-16 18:22:55 +02:00 committed by Emilien Macchi
parent 92e924a875
commit 92a1bf7f05
4 changed files with 37 additions and 7 deletions

View File

@ -32,6 +32,10 @@ Role Variables
to skip projects that DLRN cannot build. to skip projects that DLRN cannot build.
* `artg_repos_dir` -- Root directory which contains project directories with * `artg_repos_dir` -- Root directory which contains project directories with
sources for build. sources for build.
* `dlrn_baseurl` -- URL used by DLRN to get the repo definitions when building
packages
* `dlrn_use_local_mirrors` -- use the local repo definitions from
/etc/yum.repos.d/ for CentOS and DLRN while building packages; used upstream
```yaml ```yaml
artg_change_list: artg_change_list:

View File

@ -6,6 +6,8 @@ artg_dlrn_repo_url: "https://github.com/openstack-packages/DLRN.git"
artg_rdoinfo_repo_url: "https://github.com/redhat-openstack/rdoinfo" artg_rdoinfo_repo_url: "https://github.com/redhat-openstack/rdoinfo"
artg_compressed_gating_repo: "/home/stack/gating_repo.tar.gz" artg_compressed_gating_repo: "/home/stack/gating_repo.tar.gz"
dlrn_cleanup: false dlrn_cleanup: false
dlrn_baseurl: "https://trunk.rdoproject.org/centos7-{{ artg_release }}"
dlrn_use_local_mirrors: false
artg_skipped_projects: artg_skipped_projects:
- openstack/puppet-openstack-integration - openstack/puppet-openstack-integration

View File

@ -12,24 +12,23 @@
artg_distro: "{{ artg_release }}-rdo" artg_distro: "{{ artg_release }}-rdo"
when: artg_release not in ['master', 'mitaka'] 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 - name: Override projects.ini settings
lineinfile: lineinfile:
dest: '{{ build_repo_dir }}/DLRN/projects.ini' dest: '{{ build_repo_dir }}/DLRN/projects.ini'
regexp: '{{ project_item.regexp }}' regexp: '{{ project_item.regexp }}'
line: '{{ project_item.line }}' line: '{{ project_item.line }}'
with_items: with_items:
- { regexp: 'baseurl=.*', line: 'baseurl=https://trunk.rdoproject.org/centos7-{{ artg_release }}' } - { regexp: 'baseurl=.*', line: 'baseurl={{ dlrn_baseurl }}' }
- { regexp: 'distro=.*', line: 'distro={{ artg_distro }}' } - { regexp: 'distro=.*', line: 'distro={{ artg_distro }}' }
- { regexp: 'source=.*', line: 'source={{ artg_change.branch }}' } - { regexp: 'source=.*', line: 'source={{ artg_change.branch }}' }
loop_control: loop_control:
loop_var: project_item loop_var: project_item
- name: Fetch local rdoinfo copy
git:
repo: '{{ artg_rdoinfo_repo_url }}'
dest: '{{ build_repo_dir }}/DLRN/rdoinfo'
version: 'master'
- name: Map project name to DLRN project name - name: Map project name to DLRN project name
register: project_name_mapped register: project_name_mapped
shell: > shell: >

View File

@ -48,6 +48,31 @@
version: master version: master
when: not dlrn_cloned.stat.exists when: not dlrn_cloned.stat.exists
- name: Fetch local rdoinfo copy
git:
repo: '{{ artg_rdoinfo_repo_url }}'
dest: '{{ build_repo_dir }}/DLRN/rdoinfo'
version: 'master'
- name: Use local CentOS mirror if available
shell: >
gawk '{ print $0 }; /^# repos$/ { exit }' {{ build_repo_dir }}/DLRN/scripts/centos.cfg
> {{ build_repo_dir }}/DLRN/scripts/centos-local.cfg;
cat /etc/yum.repos.d/quickstart-centos-*.repo >> {{ build_repo_dir }}/DLRN/scripts/centos-local.cfg;
cat /etc/yum.repos.d/delorean*.repo >> {{ build_repo_dir }}/DLRN/scripts/centos-local.cfg;
echo '"""' >> {{ build_repo_dir }}/DLRN/scripts/centos-local.cfg;
mkdir -p /tmp/fake-dlrn-repos/current;
touch /tmp/fake-dlrn-repos/delorean-deps.repo;
touch /tmp/fake-dlrn-repos/current/delorean.repo;
when: dlrn_use_local_mirrors|bool
- name: Use custom target for DLRN
lineinfile:
dest: '{{ build_repo_dir }}/DLRN/projects.ini'
regexp: 'target=.*'
line: 'target=centos-local'
when: dlrn_use_local_mirrors|bool
#Remove the rpm install test to speed up delorean #Remove the rpm install test to speed up delorean
#TODO: add an option for this in delorean #TODO: add an option for this in delorean
- name: Remove DLRN RPM install test - name: Remove DLRN RPM install test