Browse code

Created a script to run tito builds and upack leftover artifacts

Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>

Steve Kuznetsov authored on 2016/10/07 00:14:31
Showing 2 changed files
... ...
@@ -240,7 +240,7 @@ install-travis:
240 240
 # Example:
241 241
 #   make build-rpms
242 242
 build-rpms:
243
-	OS_ONLY_BUILD_PLATFORMS='linux/amd64' tito build --test --rpm --no-cleanup --rpmbuild-options='--define "make_redistributable 0"'
243
+	OS_ONLY_BUILD_PLATFORMS='linux/amd64' hack/build-rpm-release.sh
244 244
 .PHONY: build-rpms
245 245
 
246 246
 # Build RPMs for all architectures
... ...
@@ -248,9 +248,18 @@ build-rpms:
248 248
 # Example:
249 249
 #   make build-rpms-redistributable
250 250
 build-rpms-redistributable:
251
-	tito build --test --rpm --no-cleanup --rpmbuild-options='--define "make_redistributable 1"'
251
+	hack/build-rpm-release.sh
252 252
 .PHONY: build-rpms-redistributable
253 253
 
254
+# Build a release of OpenShift using tito for linux/amd64 and the images that depend on it.
255
+#
256
+# Example:
257
+#   make release
258
+release-rpms: clean build-rpms
259
+	hack/build-images.sh
260
+	hack/extract-release.sh
261
+.PHONY: release
262
+
254 263
 # Vendor the Origin Web Console
255 264
 #
256 265
 # Args:
257 266
new file mode 100755
... ...
@@ -0,0 +1,56 @@
0
+#!/bin/bash
1
+
2
+# This script generates release zips and RPMs into _output/releases.
3
+# tito and other build dependencies are required on the host. We will
4
+# be running `hack/build-cross.sh` under the covers, so we transitively
5
+# consume all of the relevant envars.
6
+source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
7
+os::build::setup_env
8
+os::util::environment::setup_tmpdir_vars "build-rpm-release"
9
+
10
+if [[ "${OS_ONLY_BUILD_PLATFORMS:-}" == 'linux/amd64' ]]; then
11
+	# when the user is asking for only Linux binaries, we will
12
+	# furthermore not build cross-platform clients in tito
13
+	make_redistributable=0
14
+else
15
+	make_redistributable=1
16
+fi
17
+
18
+os::log::info 'Building Origin release RPMs with tito...'
19
+tito_tmp_dir="${BASETMPDIR}/tito"
20
+mkdir -p "${tito_tmp_dir}"
21
+tito build --output="${tito_tmp_dir}" --rpm --test --no-cleanup \
22
+           --rpmbuild-options="--define 'make_redistributable ${make_redistributable}'"
23
+
24
+os::log::info 'Unpacking tito artifacts for reuse...'
25
+output_directories=( $( find "${tito_tmp_dir}" -type d -name 'rpmbuild-origin*' ) )
26
+if [[ "${#output_directories[@]}" -eq 0 ]]; then
27
+	os::log::error 'After the tito build, no rpmbuild directory was found!'
28
+	exit 1
29
+elif [[ "${#output_directories[@]}" -gt 1 ]]; then
30
+	# find the newest directory in the list
31
+	output_directory="${output_directories[0]}"
32
+	for directory in "${output_directories[@]}"; do
33
+		if [[ "${directory}" -nt "${output_directory}" ]]; then
34
+			output_directory="${directory}"
35
+		fi
36
+	done
37
+	os::log::warn 'After the tito build, more than one rpmbuild directory was found!'
38
+	os::log::warn 'This script will unpack the most recently modified directory: '"${output_directory}"
39
+else
40
+	output_directory="${output_directories[0]}"
41
+fi
42
+
43
+if ! tito_output_directory="$( find "${output_directory}" -type d -path '*/BUILD/origin-git-*/_output/local' )"; then
44
+	os::log::error 'No _output artifact directory found in tito rpmbuild artifacts!'
45
+	exit 1
46
+fi
47
+
48
+# clean up our local state so we can unpack the tito artifacts cleanly
49
+make clean
50
+
51
+# migrate the tito artifacts to the Origin directory
52
+mkdir -p "${OS_OUTPUT}"
53
+cp -r "${tito_output_directory}"/* "${OS_OUTPUT}"
54
+mkdir -p "${OS_LOCAL_RELEASEPATH}"
55
+cp "${tito_tmp_dir}"/x86_64/*.rpm "${OS_LOCAL_RELEASEPATH}"
0 56
\ No newline at end of file