blob: 4df8bbe657101fa0b29738cc1c1f8d9aeb4ebd70 (
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
#!/bin/sh
# WARNING: REQUIRES /bin/sh
#
# - must run on /bin/sh on solaris 9
# - must run on /bin/sh on AIX 6.x
# - if you think you are a bash wizard, you probably do not understand
# this programming language. do not touch.
# - if you are under 40, get peer review from your elders.
#
# Build you some jenkins
#
set -e
set -x
os=`uname -s`
# Return truthy (which is zero) if a command does not exist
# (this is deliberately inverted because /bin/sh on Solaris does not support "if ! exists" syntax)
not_exists() {
if command -v $1 >/dev/null 2>&1; then
return 1
else
return 0
fi
}
exists() {
if command -v $1 >/dev/null 2>&1; then
return 0
else
return 1
fi
}
# The key used to sign RPM packages is passphrase-less
OMNIBUS_RPM_SIGNING_PASSPHRASE=notset
export OMNIBUS_RPM_SIGNING_PASSPHRASE
if [ "x$os" = "xAIX" ]; then
# need to unset LIBPATH on AIX (like LD_LIBRARY_PATH on Solaris, Jenkins sets this (wrongly) on AIX)
unset LIBPATH
fi
if [ -z $OMNIBUS_PROJECT_NAME ]; then
echo "OMNIBUS_PROJECT_NAME environment variable is not set!"
exit 1
fi
# create the build timestamp file for fingerprinting if it doesn't exist (manual build execution)
if [ ! -f build_timestamp ]; then
date > build_timestamp
echo "$BUILD_TAG / $BUILD_ID" > build_timestamp
fi
PATH=/opt/ruby-2.1.2/bin:/opt/ruby1.9/bin:/usr/local/bin:$PATH
export PATH
if [ "x$os" = "xAIX" ]; then
# AIX is hateful and requires a bunch of root stuff to build BFF packages
sudo rm -rf /.info || true
sudo mkdir /.info || true
sudo chown root /.info || true
sudo rm -rf /tmp/bff || true
# deinstall the bff if it got installed, can't build if it is installed
sudo installp -u $OMNIBUS_PROJECT_NAME || true
# AIX needs /opt/freeware/bin and /usr/sbin
if [ -d "/opt/freeware/bin" ]; then
PATH=/opt/freeware/bin:$PATH:/usr/sbin
export PATH
fi
fi
# clean up our target directory
sudo rm -rf "/opt/${OMNIBUS_PROJECT_NAME}" || true
sudo mkdir -p "/opt/${OMNIBUS_PROJECT_NAME}"
# and any old package cruft from prior builds
sudo rm -f pkg/* || true
if [ "$CLEAN" = "true" ]; then
# nuke everything, including the git cache
sudo rm -rf /var/cache/omnibus/* || true
else
# we need to nuke these from old builds in order to reliably use
# the git caching
sudo rm -rf /var/cache/omnibus/pkg/* || true
sudo rm -rf /var/cache/omnibus/src/* || true
sudo rm -f /var/cache/omnibus/build/*/*.manifest || true
fi
# always fix up permissions
if [ "x$os" = "xAIX" ]; then
sudo chown -R root "/opt/${OMNIBUS_PROJECT_NAME}"
sudo chown -R root "/var/cache/omnibus"
else
sudo chown -R jenkins-node "/opt/${OMNIBUS_PROJECT_NAME}" || sudo chown -R jenkins "/opt/${OMNIBUS_PROJECT_NAME}"
sudo chown -R jenkins-node "/var/cache/omnibus" || sudo chown -R jenkins "/var/cache/omnibus"
fi
# horrible hack for solaris 9 to get ffi to compile in the bundle
if [ -f "/etc/release" ]; then
# solaris /bin/sh needs the stupid || true or set -x bombs here
release=`cat /etc/release | grep 'Solaris 9' || true`
if [ "x$release" != "x" ]; then
# magic CONFIGURE_ARGS to get CFLAGS through bundle/gem install
CONFIGURE_ARGS="--with-cflags='-U__STRICT_ANSI__'"
export CONFIGURE_ARGS
fi
fi
# docs do not install on solaris 9
bundle install --without development
if [ "$RELEASE_BUILD" = "true" ]; then
bundle exec omnibus build $OMNIBUS_PROJECT_NAME -l internal --override append_timestamp:false
else
bundle exec omnibus build $OMNIBUS_PROJECT_NAME -l internal
fi
# Dump the build-generated version so the Omnitruck release script uses the
# correct version string format.
echo "`awk -v p=$OMNIBUS_PROJECT_NAME '$1 == p {print $2}' /opt/${OMNIBUS_PROJECT_NAME}/version-manifest.txt`" > pkg/BUILD_VERSION
|