Browse Source

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
tags/2.1.1
Attila Darazs 2 years ago
parent
commit
92a1bf7f05

+ 4
- 0
roles/build-test-packages/README.md View File

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

+ 2
- 0
roles/build-test-packages/defaults/main.yml View File

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

+ 6
- 7
roles/build-test-packages/tasks/dlrn-build.yml View File

@@ -12,24 +12,23 @@
12 12
     artg_distro: "{{ artg_release }}-rdo"
13 13
   when: artg_release not in ['master', 'mitaka']
14 14
 
15
+- name: Use local baseurl when using local mirrors
16
+  set_fact:
17
+    dlrn_baseurl: 'file:///tmp/fake-dlrn-repos'
18
+  when: dlrn_use_local_mirrors|bool
19
+
15 20
 - name: Override projects.ini settings
16 21
   lineinfile:
17 22
     dest: '{{ build_repo_dir }}/DLRN/projects.ini'
18 23
     regexp: '{{ project_item.regexp }}'
19 24
     line: '{{ project_item.line }}'
20 25
   with_items:
21
-    - { regexp: 'baseurl=.*', line: 'baseurl=https://trunk.rdoproject.org/centos7-{{ artg_release }}' }
26
+    - { regexp: 'baseurl=.*', line: 'baseurl={{ dlrn_baseurl }}' }
22 27
     - { regexp: 'distro=.*', line: 'distro={{ artg_distro }}' }
23 28
     - { regexp: 'source=.*', line: 'source={{ artg_change.branch }}' }
24 29
   loop_control:
25 30
       loop_var: project_item
26 31
 
27
-- name: Fetch local rdoinfo copy
28
-  git:
29
-    repo: '{{ artg_rdoinfo_repo_url }}'
30
-    dest: '{{ build_repo_dir }}/DLRN/rdoinfo'
31
-    version: 'master'
32
-
33 32
 - name: Map project name to DLRN project name
34 33
   register: project_name_mapped
35 34
   shell: >

+ 25
- 0
roles/build-test-packages/tasks/main.yml View File

@@ -48,6 +48,31 @@
48 48
     version: master
49 49
   when: not dlrn_cloned.stat.exists
50 50
 
51
+- name: Fetch local rdoinfo copy
52
+  git:
53
+    repo: '{{ artg_rdoinfo_repo_url }}'
54
+    dest: '{{ build_repo_dir }}/DLRN/rdoinfo'
55
+    version: 'master'
56
+
57
+- name: Use local CentOS mirror if available
58
+  shell: >
59
+    gawk '{ print $0 }; /^# repos$/ { exit }' {{ build_repo_dir }}/DLRN/scripts/centos.cfg
60
+    > {{ build_repo_dir }}/DLRN/scripts/centos-local.cfg;
61
+    cat /etc/yum.repos.d/quickstart-centos-*.repo >> {{ build_repo_dir }}/DLRN/scripts/centos-local.cfg;
62
+    cat /etc/yum.repos.d/delorean*.repo >> {{ build_repo_dir }}/DLRN/scripts/centos-local.cfg;
63
+    echo '"""' >> {{ build_repo_dir }}/DLRN/scripts/centos-local.cfg;
64
+    mkdir -p /tmp/fake-dlrn-repos/current;
65
+    touch /tmp/fake-dlrn-repos/delorean-deps.repo;
66
+    touch /tmp/fake-dlrn-repos/current/delorean.repo;
67
+  when: dlrn_use_local_mirrors|bool
68
+
69
+- name: Use custom target for DLRN
70
+  lineinfile:
71
+    dest: '{{ build_repo_dir }}/DLRN/projects.ini'
72
+    regexp: 'target=.*'
73
+    line: 'target=centos-local'
74
+  when: dlrn_use_local_mirrors|bool
75
+
51 76
 #Remove the rpm install test to speed up delorean
52 77
 #TODO: add an option for this in delorean
53 78
 - name: Remove DLRN RPM install test

Loading…
Cancel
Save