aboutsummaryrefslogtreecommitdiff
path: root/bigdata-bigtop-deb/builders.sh
blob: 438a7eabe59ede12ab7f2b6998eed8d8d2eb4274 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash

set -ex

# number of CPU_CORES to build with
export CPU_CORES=$(getconf _NPROCESSORS_ONLN)

# get source
rm -rf bigtop-trunk
git clone --depth 1 --branch working-tar-gz-packaging https://git.linaro.org/leg/bigdata/bigtop-trunk.git

# Before starting the container, give other users `w` access to `bigtop`
# home directory. It is required for gradle installation as 'jenkins' users.
# Otherwise, you will see this error when run 'gradlew tasks'.
#   FAILED: Could not create service of type CrossBuildFileHashCache
#    using BuildSessionScopeServices.createCrossBuildFileHashCache().
chmod a+w bigtop-trunk

# now build bigtop slaves
cd bigtop-trunk

# optionally, build docker images locally - only needed once
#./gradlew -POS=debian-9 -Pprefix=erp18.06 bigtop-puppet
#./gradlew -POS=debian-9 -Pprefix=erp18.06 bigtop-slaves

# build bigdata bigtop components. This will take a while.
# Artifacts will be stored under individual component folder inside output folder.
#
# Example command line:
#   docker run --rm -u jenkins --workdir /ws -v ${PWD}:/ws \
#          bigtop/slaves:1.4.0-debian-9-aarch64 bash -l -c '. /etc/profile.d/bigtop.sh; ./gradlew deb repo'
#
# Note:
#   - User 'jenkins' is employed. It exists by default in the root docker image of bigtop/slaves.
#   - It's not allowed using 'root' to build bigtop. Some component refuses to be built in root.
#   - Image "bigtop/slaves:*-aarch64" will be retrieved from docker hub on live.
#   - bigtop.sh sets environment variables such as: JAVA_HOME, MAVEN_HOME, ANT_HOME, GRADLE_HOME, etc.

docker run --rm -u jenkins --workdir /ws -v ${PWD}:/ws \
  bigtop/slaves:1.4.0-debian-9-aarch64 bash -l -c '. /etc/profile.d/bigtop.sh; ./gradlew deb repo; chmod -R a+w output build .gradle dl;'

# cleanup
#docker prune -fa