1 From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
2 Date: Sat, 18 Jun 2016 01:09:27 +0200
3 Subject: [PATCH] WIP: build: fuel-main: Decouple patches, Makefile.
5 FIXME: Not tested, only a discussion starter.
7 Submitted upstream in Fuel@OPNFv, see change-id.
10 Upstream removed all mirrors but usa and cz, and changed
11 its default to mirror.fuel-infra.org in [1].
13 This allows us to drop patching of fuel-main/config.mk
14 with the Czech mirror.
16 If needed, USE_MIRROR=cz can be specified as an env var.
18 FIXME: Remove when Fuel@OPNFV pulls change and deals with it.
20 Use `git apply` and/or `git am` in favor of `patch`.
21 Change patches from old context format to unified diff.
23 This change allows us to decouple Makefile and patches.
24 This means we no longer have to manually stage touched files
25 before committing them to git.
27 Possible improvements:
28 - replace cz mirror patch with USE_MIRROR=cz makevar;
29 - move patches to separate dir and add ordering info (prefix);
30 - merge patches (currently we have one per touched file);
32 Remove obsolete (unused?) patch:
33 - fuel-main_docker_version.patch
35 [1] https://github.com/openstack/fuel-main/commit/
36 751d502cfe15d9c9df0ee89530ac3b0b73aa1638
38 Change-Id: I5b621370993b259779c813b47105f632948e6da7
39 Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
41 build/Makefile | 17 ++--
42 build/bootstrap_admin_node.sh.patch | 167 +++++++++++++++--------------------
43 build/fuel-main_docker_version.patch | 20 -----
44 build/isolinux.cfg.patch | 43 +++++----
45 5 files changed, 113 insertions(+), 166 deletions(-)
46 delete mode 100644 build/fuel-main_docker_version.patch
48 diff --git a/build/Makefile b/build/Makefile
49 index 956183c..69e5690 100644
52 @@ -109,7 +109,7 @@ $(ISOCACHE):
53 cd /tmp && git clone $(FUEL_MAIN_REPO); \
55 cd /tmp/fuel-main && git checkout $(FUEL_MAIN_TAG)
56 - @echo "fuel" `git -C /tmp/fuel-main show | grep commit | head -1 | cut -d " " -f2` >> $(VERSION_FILE)
57 + @echo "fuel" `git -C /tmp/fuel-main rev-parse HEAD` >> $(VERSION_FILE)
58 # Remove Docker optimizations, otherwise multistrap will fail during
60 sudo rm -f /etc/apt/apt.conf.d/docker*
61 @@ -135,13 +135,10 @@ $(ISOCACHE):
62 # OPNFV patches at Fuel build time
63 # Need to be commited in order for them to be considered by the Fuel
65 - cd /tmp/fuel-main/iso && git config user.name "Fuel OPNFV"
66 - cd /tmp/fuel-main/iso && git config user.email "fuel@opnfv.org"
67 - cd /tmp/fuel-main/iso && patch -p0 < $(TOPDIR)/bootstrap_admin_node.sh.patch
68 - cd /tmp/fuel-main/iso && git add -u bootstrap_admin_node.sh
69 - cd /tmp/fuel-main/iso/isolinux && patch -p0 < $(TOPDIR)/isolinux.cfg.patch
70 - cd /tmp/fuel-main/iso/isolinux && git add -u isolinux.cfg
71 - cd /tmp/fuel-main/iso && git commit -m "Added OPNFV patches"
72 + cd /tmp/fuel-main && git config user.name "Fuel OPNFV"
73 + cd /tmp/fuel-main && git config user.email "fuel@opnfv.org"
74 + cd /tmp/fuel-main && git am $(TOPDIR)/bootstrap_admin_node.sh.patch
75 + cd /tmp/fuel-main && git am $(TOPDIR)/isolinux.cfg.patch
76 # Repeat build up to three times
77 sudo -E ./fuel_build_loop
78 cp /tmp/fuel-main/build/artifacts/fuel*.iso .
79 diff --git a/build/bootstrap_admin_node.sh.patch b/build/bootstrap_admin_node.sh.patch
80 index e137b74..8a2b69f 100644
81 --- a/build/bootstrap_admin_node.sh.patch
82 +++ b/build/bootstrap_admin_node.sh.patch
84 -*** bootstrap_admin_node.sh.orig Mon May 30 06:31:38 2016
85 ---- bootstrap_admin_node.sh Mon May 30 06:35:11 2016
91 - if [[ "$showmenu" == "yes" || "$showmenu" == "YES" ]]; then
94 - # Give user 15 seconds to enter fuelmenu or else continue
100 -+ ### OPNFV addition BEGIN
102 -+ for script in /opt/opnfv/bootstrap/pre.d/*.sh
104 -+ echo "Pre script: $script" >> /root/pre.log 2>&1
105 -+ $script >> /root/pre.log 2>&1
108 -+ ### OPNFV addition END
111 -+ systemctl enable sshd
112 -+ systemctl start sshd
114 - if [[ "$showmenu" == "yes" || "$showmenu" == "YES" ]]; then
117 - # Give user 15 seconds to enter fuelmenu or else continue
123 +From: Fuel OPNFV <fuel@opnfv.org>
124 +Date: Mon, 13 Jun 2016 22:23:57 +0200
125 +Subject: OPNFV: Additions to bootstrap_admin_node.sh
127 - # Enable online base MOS repos (security, updates) if we run an ISO installation
128 -! [ -f /etc/fuel_build_id ] && \
129 -! yum-config-manager --enable mos${FUEL_RELEASE}-security mos${FUEL_RELEASE}-updates --save
131 - if [ ! -f "${ASTUTE_YAML}" ]; then
132 - echo ${fuelmenu_fail_message}
137 -+ # OPNFV: Disabled to speedup installation in offline env.
138 - # Enable online base MOS repos (security, updates) if we run an ISO installation
139 -! #[ -f /etc/fuel_build_id ] && \
140 -! # yum-config-manager --enable mos${FUEL_RELEASE}-security mos${FUEL_RELEASE}-updates --save
142 - if [ ! -f "${ASTUTE_YAML}" ]; then
143 - echo ${fuelmenu_fail_message}
146 - [ ! -f /etc/fuel_build_id ] && \
147 - sed -i "s|127.0.0.1:8080/ubuntu/x86_64|mirror.fuel-infra.org/mos-repos/ubuntu/${FUEL_RELEASE}|g" "${ASTUTE_YAML}"
150 -! systemctl enable sshd
151 -! systemctl start sshd
154 - systemctl enable iptables.service
156 - [ ! -f /etc/fuel_build_id ] && \
157 - sed -i "s|127.0.0.1:8080/ubuntu/x86_64|mirror.fuel-infra.org/mos-repos/ubuntu/${FUEL_RELEASE}|g" "${ASTUTE_YAML}"
159 -! systemctl reload sshd
162 - systemctl enable iptables.service
169 -+ ### OPNFV addition BEGIN
171 -+ for script in /opt/opnfv/bootstrap/post.d/*.sh
173 -+ echo "Post script: $script" >> /root/post.log 2>&1
174 -+ $script >> /root/post.log 2>&1
177 -+ ### OPNFV addition END
179 - if [ "`get_bootstrap_skip`" = "False" ]; then
180 - build_ubuntu_bootstrap bs_status || true
183 +diff --git a/iso/bootstrap_admin_node.sh b/iso/bootstrap_admin_node.sh
184 +index 3197c91..e035145 100755
185 +--- a/iso/bootstrap_admin_node.sh
186 ++++ b/iso/bootstrap_admin_node.sh
187 +@@ -339,8 +339,22 @@ fuelmenu --save-only --iface=$ADMIN_INTERFACE || fail
191 ++### OPNFV addition BEGIN
193 ++for script in /opt/opnfv/bootstrap/pre.d/*.sh
195 ++ echo "Pre script: $script" >> /root/pre.log 2>&1
196 ++ $script >> /root/pre.log 2>&1
199 ++### OPNFV addition END
202 ++systemctl enable sshd
203 ++systemctl start sshd
205 + if [[ "$showmenu" == "yes" || "$showmenu" == "YES" ]]; then
209 + # Give user 15 seconds to enter fuelmenu or else continue
211 +@@ -360,9 +374,10 @@ else
215 ++# OPNFV: Disabled to speedup installation in offline env.
216 + # Enable online base MOS repos (security, updates) if we run an ISO installation
217 +-[ -f /etc/fuel_build_id ] && \
218 +- yum-config-manager --enable mos${FUEL_RELEASE}-security mos${FUEL_RELEASE}-updates --save
219 ++#[ -f /etc/fuel_build_id ] && \
220 ++# yum-config-manager --enable mos${FUEL_RELEASE}-security mos${FUEL_RELEASE}-updates --save
222 + if [ ! -f "${ASTUTE_YAML}" ]; then
223 + echo ${fuelmenu_fail_message}
224 +@@ -377,7 +392,5 @@ if [ ! -f /etc/fuel_build_id ]; then
227 +-systemctl enable sshd
228 +-systemctl start sshd
229 ++systemctl reload sshd
232 + systemctl enable iptables.service
233 +@@ -532,6 +545,16 @@ systemctl start ntpd
237 ++### OPNFV addition BEGIN
239 ++for script in /opt/opnfv/bootstrap/post.d/*.sh
241 ++ echo "Post script: $script" >> /root/post.log 2>&1
242 ++ $script >> /root/post.log 2>&1
245 ++### OPNFV addition END
247 + if [ "`get_bootstrap_skip`" = "False" ]; then
248 + build_ubuntu_bootstrap bs_status || true
250 diff --git a/build/fuel-main_docker_version.patch b/build/fuel-main_docker_version.patch
251 deleted file mode 100644
252 index 22b5824..0000000
253 --- a/build/fuel-main_docker_version.patch
256 -*** prepare-build-env.sh.orig 2016-01-11 14:55:50.615286910 +0100
257 ---- prepare-build-env.sh 2016-01-11 14:59:44.775308422 +0100
260 - sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
262 - sudo apt-get update
263 -! sudo apt-get -y install lxc-docker-1.5.0
268 - sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
270 - sudo apt-get update
271 -! sudo sh -c 'echo DOCKER_OPTS=\"--bip 172.45.0.1/24\" > /etc/default/docker'
272 -! sudo apt-get -y -o Dpkg::Options::="--force-confold" install lxc-docker-1.7.1
276 diff --git a/build/isolinux.cfg.patch b/build/isolinux.cfg.patch
277 index ebd991b..7ca7a5c 100644
278 --- a/build/isolinux.cfg.patch
279 +++ b/build/isolinux.cfg.patch
281 -*** isolinux.cfg.orig Tue May 10 10:13:21 2016
282 ---- isolinux.cfg Tue May 10 10:15:12 2016
285 - menu label ^1. Fuel Install (Static IP)
288 -! append initrd=initrd.img net.ifnames=0 biosdevname=0 inst.repo=cdrom:LABEL=will_be_substituted_with_ISO_VOLUME_ID:/ inst.ks=cdrom:LABEL=will_be_substituted_with_ISO_VOLUME_ID:/ks.cfg ip=10.20.0.2::10.20.0.1:255.255.255.0:fuel.domain.tld:eth0:off::: nameserver=10.20.0.1
290 - label nailgunifname
291 - menu label ^2. Fuel Advanced Install (Static IP)
293 -! append initrd=initrd.img inst.repo=cdrom:LABEL=will_be_substituted_with_ISO_VOLUME_ID:/ inst.ks=cdrom:LABEL=will_be_substituted_with_ISO_VOLUME_ID:/ks.cfg ip=10.20.0.2::10.20.0.1:255.255.255.0:fuel.domain.tld:adminif:off::: nameserver=10.20.0.1 ifname=adminif:XX:XX:XX:XX:XX:XX
295 - menu label ^1. Fuel Install (Static IP)
298 -! append initrd=initrd.img net.ifnames=0 biosdevname=0 inst.repo=cdrom:LABEL=will_be_substituted_with_ISO_VOLUME_ID:/ inst.ks=cdrom:LABEL=will_be_substituted_with_ISO_VOLUME_ID:/ks.cfg ip=10.20.0.2::10.20.0.1:255.255.255.0:fuel.domain.tld:eth0:off::: nameserver=10.20.0.1 showmenu=yes
300 - label nailgunifname
301 - menu label ^2. Fuel Advanced Install (Static IP)
303 -! append initrd=initrd.img inst.repo=cdrom:LABEL=will_be_substituted_with_ISO_VOLUME_ID:/ inst.ks=cdrom:LABEL=will_be_substituted_with_ISO_VOLUME_ID:/ks.cfg ip=10.20.0.2::10.20.0.1:255.255.255.0:fuel.domain.tld:adminif:off::: nameserver=10.20.0.1 ifname=adminif:XX:XX:XX:XX:XX:XX showmenu=yes
304 +From: Fuel OPNFV <fuel@opnfv.org>
305 +Date: Mon, 13 Jun 2016 22:23:57 +0200
306 +Subject: OPNFV: showmenu=yes in isolinux.cfg
309 +diff --git a/iso/isolinux/isolinux.cfg b/iso/isolinux/isolinux.cfg
310 +index c6b1ed9..77a4b18 100644
311 +--- a/iso/isolinux/isolinux.cfg
312 ++++ b/iso/isolinux/isolinux.cfg
313 +@@ -19,9 +19,9 @@ label nailgun
314 + menu label ^1. Fuel Install (Static IP)
317 +- append initrd=initrd.img net.ifnames=0 biosdevname=0 inst.repo=cdrom:LABEL=will_be_substituted_with_ISO_VOLUME_ID:/ inst.ks=cdrom:LABEL=will_be_substituted_with_ISO_VOLUME_ID:/ks.cfg ip=10.20.0.2::10.20.0.1:255.255.255.0:fuel.domain.tld:eth0:off::: nameserver=10.20.0.1
318 ++ append initrd=initrd.img net.ifnames=0 biosdevname=0 inst.repo=cdrom:LABEL=will_be_substituted_with_ISO_VOLUME_ID:/ inst.ks=cdrom:LABEL=will_be_substituted_with_ISO_VOLUME_ID:/ks.cfg ip=10.20.0.2::10.20.0.1:255.255.255.0:fuel.domain.tld:eth0:off::: nameserver=10.20.0.1 showmenu=yes
320 + label nailgunifname
321 + menu label ^2. Fuel Advanced Install (Static IP)
323 +- append initrd=initrd.img inst.repo=cdrom:LABEL=will_be_substituted_with_ISO_VOLUME_ID:/ inst.ks=cdrom:LABEL=will_be_substituted_with_ISO_VOLUME_ID:/ks.cfg ip=10.20.0.2::10.20.0.1:255.255.255.0:fuel.domain.tld:adminif:off::: nameserver=10.20.0.1 ifname=adminif:XX:XX:XX:XX:XX:XX
324 ++ append initrd=initrd.img inst.repo=cdrom:LABEL=will_be_substituted_with_ISO_VOLUME_ID:/ inst.ks=cdrom:LABEL=will_be_substituted_with_ISO_VOLUME_ID:/ks.cfg ip=10.20.0.2::10.20.0.1:255.255.255.0:fuel.domain.tld:adminif:off::: nameserver=10.20.0.1 ifname=adminif:XX:XX:XX:XX:XX:XX showmenu=yes