Alanny Lopez | b0a12dd | 2017-04-24 16:21:47 -0500 | [diff] [blame^] | 1 | ############################################################################### |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 2 | # |
Alanny Lopez | b0a12dd | 2017-04-24 16:21:47 -0500 | [diff] [blame^] | 3 | # This build script is for running the OpenBMC builds as containers with the |
| 4 | # option of launching the containers with Docker or Kubernetes. |
Alanny Lopez | 3fbaa51 | 2017-04-24 15:46:52 -0500 | [diff] [blame] | 5 | # |
Alanny Lopez | b0a12dd | 2017-04-24 16:21:47 -0500 | [diff] [blame^] | 6 | ############################################################################### |
| 7 | # |
| 8 | # Variables used for Jenkins build job matrix: |
| 9 | # target = barreleye|palmetto|witherspoon|firestone|garrison|evb-ast2500 |
| 10 | # zaius|romulus|qemu |
| 11 | # distro = fedora|ubuntu |
| 12 | # imgtag = Varies by distro. latest|16.04|14.04|trusty|xenial; 23|24|25 |
| 13 | # ocache = Path of the OpenBMC repo cache that is used to speed up git |
| 14 | # clones, default directory location "${WORKSPACE}/openbmc" |
| 15 | # obmcdir = Path of the OpenBMC directory, where the build occurs inside |
| 16 | # the container cannot be placed on external storage default |
| 17 | # directory location "/tmp/openbmc" |
| 18 | # sscdir = Path of the BitBake shared-state cache directoy, will default |
| 19 | # to directory "/home/${USER}", used to speed up builds. |
| 20 | # WORKSPACE = Path of the workspace directory where some intermediate files |
| 21 | # and the images will be saved to. |
| 22 | # |
| 23 | # Optional Variables: |
| 24 | # launch = job|pod |
| 25 | # Can be left blank to launch via Docker if not using |
| 26 | # Kubernetes to launch the container. |
| 27 | # Job lets you keep a copy of job and container logs on the |
| 28 | # api, can be useful if not using Jenkins as you can run the |
| 29 | # job again via the api without needing this script. |
| 30 | # Pod launches a container which runs to completion without |
| 31 | # saving anything to the api when it completes. |
| 32 | # imgname = Defaults to a relatively long but descriptive name, can be |
| 33 | # changed or passed to give a specific name to created image. |
| 34 | # http_proxy = The HTTP address for the proxy server you wish to connect to. |
| 35 | # BITBAKE_OPTS = Set to "-c populate_sdk" or whatever other bitbake options |
| 36 | # you'd like to pass into the build. |
| 37 | # |
| 38 | ############################################################################### |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 39 | |
Joel Stanley | 4b8b239 | 2016-02-12 15:44:57 +1030 | [diff] [blame] | 40 | # Trace bash processing. Set -e so when a step fails, we fail the build |
Joel Stanley | 38c9d14 | 2016-02-16 12:31:55 +1030 | [diff] [blame] | 41 | set -xeo pipefail |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 42 | |
| 43 | # Default variables |
| 44 | target=${target:-qemu} |
| 45 | distro=${distro:-ubuntu} |
Alanny Lopez | ccc650e | 2017-04-24 15:14:20 -0500 | [diff] [blame] | 46 | imgtag=${imgtag:-latest} |
Alanny Lopez | e687019 | 2017-04-24 15:25:59 -0500 | [diff] [blame] | 47 | obmcdir=${obmcdir:-/tmp/openbmc} |
Alanny Lopez | 97a7950 | 2017-04-24 16:19:25 -0500 | [diff] [blame] | 48 | sscdir=${sscdir:-${HOME}} |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 49 | WORKSPACE=${WORKSPACE:-${HOME}/${RANDOM}${RANDOM}} |
Alanny Lopez | b0a12dd | 2017-04-24 16:21:47 -0500 | [diff] [blame^] | 50 | ocache=${ocache:-${WORKSPACE}/openbmc} |
Alanny Lopez | 3fbaa51 | 2017-04-24 15:46:52 -0500 | [diff] [blame] | 51 | launch=${launch:-} |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 52 | http_proxy=${http_proxy:-} |
Chris Smart | c352254 | 2016-02-16 11:59:36 +1100 | [diff] [blame] | 53 | PROXY="" |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 54 | |
Alanny Lopez | ccc650e | 2017-04-24 15:14:20 -0500 | [diff] [blame] | 55 | # Determine the architecture |
| 56 | ARCH=$(uname -m) |
| 57 | |
| 58 | # Determine the prefix of the Dockerfile's base image |
| 59 | case ${ARCH} in |
| 60 | "ppc64le") |
| 61 | DOCKER_BASE="ppc64le/" |
| 62 | ;; |
| 63 | "x86_64") |
| 64 | DOCKER_BASE="" |
| 65 | ;; |
| 66 | *) |
| 67 | echo "Unsupported system architecture(${ARCH}) found for docker image" |
| 68 | exit 1 |
| 69 | esac |
Andrew Geissler | 11abbbe | 2016-08-14 19:39:47 -0500 | [diff] [blame] | 70 | |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 71 | # Timestamp for job |
| 72 | echo "Build started, $(date)" |
| 73 | |
Alanny Lopez | e687019 | 2017-04-24 15:25:59 -0500 | [diff] [blame] | 74 | # If the ocache directory doesn't exist clone it in, ocache will be used as a cache for git clones |
| 75 | if [ ! -d ${ocache} ]; then |
| 76 | echo "Clone in openbmc master to ${ocache} to act as cache for future builds" |
| 77 | git clone https://github.com/openbmc/openbmc ${ocache} |
Andrew Geissler | c3c3520 | 2016-08-16 08:47:50 -0500 | [diff] [blame] | 78 | fi |
| 79 | |
Alanny Lopez | eaa2eae | 2017-04-24 14:55:07 -0500 | [diff] [blame] | 80 | # Work out what build target we should be running and set BitBake command |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 81 | case ${target} in |
| 82 | barreleye) |
| 83 | BITBAKE_CMD="TEMPLATECONF=meta-openbmc-machines/meta-openpower/meta-rackspace/meta-barreleye/conf source oe-init-build-env" |
| 84 | ;; |
| 85 | palmetto) |
| 86 | BITBAKE_CMD="TEMPLATECONF=meta-openbmc-machines/meta-openpower/meta-ibm/meta-palmetto/conf source oe-init-build-env" |
| 87 | ;; |
Joel Stanley | 0e07720 | 2016-06-28 16:42:45 +0930 | [diff] [blame] | 88 | witherspoon) |
| 89 | BITBAKE_CMD="TEMPLATECONF=meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/conf source oe-init-build-env" |
| 90 | ;; |
| 91 | firestone) |
| 92 | BITBAKE_CMD="TEMPLATECONF=meta-openbmc-machines/meta-openpower/meta-ibm/meta-firestone/conf source oe-init-build-env" |
| 93 | ;; |
| 94 | garrison) |
| 95 | BITBAKE_CMD="TEMPLATECONF=meta-openbmc-machines/meta-openpower/meta-ibm/meta-garrison/conf source oe-init-build-env" |
| 96 | ;; |
| 97 | evb-ast2500) |
| 98 | BITBAKE_CMD="TEMPLATECONF=meta-openbmc-machines/meta-evb/meta-evb-aspeed/meta-evb-ast2500/conf source oe-init-build-env" |
| 99 | ;; |
Joel Stanley | 915381f | 2016-11-01 16:58:59 +1030 | [diff] [blame] | 100 | zaius) |
| 101 | BITBAKE_CMD="TEMPLATECONF=meta-openbmc-machines/meta-openpower/meta-ingrasys/meta-zaius/conf source oe-init-build-env" |
| 102 | ;; |
| 103 | romulus) |
| 104 | BITBAKE_CMD="TEMPLATECONF=meta-openbmc-machines/meta-openpower/meta-ibm/meta-romulus/conf source oe-init-build-env" |
| 105 | ;; |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 106 | qemu) |
| 107 | BITBAKE_CMD="source openbmc-env" |
| 108 | ;; |
| 109 | *) |
| 110 | exit 1 |
| 111 | ;; |
| 112 | esac |
| 113 | |
Alanny Lopez | eaa2eae | 2017-04-24 14:55:07 -0500 | [diff] [blame] | 114 | # Configure Docker build |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 115 | if [[ "${distro}" == fedora ]];then |
| 116 | |
| 117 | if [[ -n "${http_proxy}" ]]; then |
| 118 | PROXY="RUN echo \"proxy=${http_proxy}\" >> /etc/dnf/dnf.conf" |
| 119 | fi |
| 120 | |
| 121 | Dockerfile=$(cat << EOF |
Alanny Lopez | ccc650e | 2017-04-24 15:14:20 -0500 | [diff] [blame] | 122 | FROM ${DOCKER_BASE}${distro}:${imgtag} |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 123 | |
Alanny Lopez | eaa2eae | 2017-04-24 14:55:07 -0500 | [diff] [blame] | 124 | ${PROXY} |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 125 | |
Alanny Lopez | eaa2eae | 2017-04-24 14:55:07 -0500 | [diff] [blame] | 126 | # Set the locale |
| 127 | RUN locale-gen en_US.UTF-8 |
| 128 | ENV LANG en_US.UTF-8 |
| 129 | ENV LANGUAGE en_US:en |
| 130 | ENV LC_ALL en_US.UTF-8 |
Saqib Khan | 7563512 | 2017-03-23 10:57:34 -0500 | [diff] [blame] | 131 | |
Alanny Lopez | eaa2eae | 2017-04-24 14:55:07 -0500 | [diff] [blame] | 132 | RUN dnf --refresh install -y \ |
| 133 | bzip2 \ |
| 134 | chrpath \ |
| 135 | cpio \ |
| 136 | diffstat \ |
| 137 | findutils \ |
| 138 | gcc \ |
| 139 | gcc-c++ \ |
| 140 | git \ |
| 141 | make \ |
| 142 | patch \ |
| 143 | perl-bignum \ |
| 144 | perl-Data-Dumper \ |
| 145 | perl-Thread-Queue \ |
| 146 | python-devel \ |
| 147 | python3-devel \ |
| 148 | SDL-devel \ |
| 149 | socat \ |
| 150 | subversion \ |
| 151 | tar \ |
| 152 | texinfo \ |
| 153 | wget \ |
| 154 | which |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 155 | |
Alanny Lopez | eaa2eae | 2017-04-24 14:55:07 -0500 | [diff] [blame] | 156 | RUN grep -q ${GROUPS} /etc/group || groupadd -g ${GROUPS} ${USER} |
| 157 | RUN grep -q ${UID} /etc/passwd || useradd -d ${HOME} -m -u ${UID} -g ${GROUPS} ${USER} |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 158 | |
Alanny Lopez | eaa2eae | 2017-04-24 14:55:07 -0500 | [diff] [blame] | 159 | USER ${USER} |
| 160 | ENV HOME ${HOME} |
| 161 | RUN /bin/bash |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 162 | EOF |
| 163 | ) |
| 164 | |
Alanny Lopez | ccc650e | 2017-04-24 15:14:20 -0500 | [diff] [blame] | 165 | elif [[ "${distro}" == ubuntu ]]; then |
| 166 | |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 167 | if [[ -n "${http_proxy}" ]]; then |
| 168 | PROXY="RUN echo \"Acquire::http::Proxy \\"\"${http_proxy}/\\"\";\" > /etc/apt/apt.conf.d/000apt-cacher-ng-proxy" |
| 169 | fi |
| 170 | |
| 171 | Dockerfile=$(cat << EOF |
Alanny Lopez | ccc650e | 2017-04-24 15:14:20 -0500 | [diff] [blame] | 172 | FROM ${DOCKER_BASE}${distro}:${imgtag} |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 173 | |
Alanny Lopez | eaa2eae | 2017-04-24 14:55:07 -0500 | [diff] [blame] | 174 | ${PROXY} |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 175 | |
Alanny Lopez | eaa2eae | 2017-04-24 14:55:07 -0500 | [diff] [blame] | 176 | ENV DEBIAN_FRONTEND noninteractive |
Saqib Khan | 7563512 | 2017-03-23 10:57:34 -0500 | [diff] [blame] | 177 | |
Alanny Lopez | eaa2eae | 2017-04-24 14:55:07 -0500 | [diff] [blame] | 178 | # Set the locale |
| 179 | RUN locale-gen en_US.UTF-8 |
| 180 | ENV LANG en_US.UTF-8 |
| 181 | ENV LANGUAGE en_US:en |
| 182 | ENV LC_ALL en_US.UTF-8 |
Saqib Khan | 7563512 | 2017-03-23 10:57:34 -0500 | [diff] [blame] | 183 | |
Alanny Lopez | eaa2eae | 2017-04-24 14:55:07 -0500 | [diff] [blame] | 184 | RUN apt-get update && apt-get install -yy \ |
| 185 | build-essential \ |
| 186 | chrpath \ |
| 187 | debianutils \ |
| 188 | diffstat \ |
| 189 | gawk \ |
| 190 | git \ |
| 191 | libdata-dumper-simple-perl \ |
| 192 | libsdl1.2-dev \ |
| 193 | libthread-queue-any-perl \ |
| 194 | python \ |
| 195 | python3 \ |
| 196 | socat \ |
| 197 | subversion \ |
| 198 | texinfo \ |
| 199 | cpio \ |
| 200 | wget |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 201 | |
Alanny Lopez | eaa2eae | 2017-04-24 14:55:07 -0500 | [diff] [blame] | 202 | RUN grep -q ${GROUPS} /etc/group || groupadd -g ${GROUPS} ${USER} |
| 203 | RUN grep -q ${UID} /etc/passwd || useradd -d ${HOME} -m -u ${UID} -g ${GROUPS} ${USER} |
Chris Smart | d30c590 | 2016-03-01 15:00:54 +1100 | [diff] [blame] | 204 | |
Alanny Lopez | eaa2eae | 2017-04-24 14:55:07 -0500 | [diff] [blame] | 205 | USER ${USER} |
| 206 | ENV HOME ${HOME} |
| 207 | RUN /bin/bash |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 208 | EOF |
| 209 | ) |
| 210 | fi |
| 211 | |
Alanny Lopez | eaa2eae | 2017-04-24 14:55:07 -0500 | [diff] [blame] | 212 | # Create the Docker run script |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 213 | export PROXY_HOST=${http_proxy/#http*:\/\/} |
| 214 | export PROXY_HOST=${PROXY_HOST/%:[0-9]*} |
| 215 | export PROXY_PORT=${http_proxy/#http*:\/\/*:} |
| 216 | |
Chris Smart | 01d2b96 | 2015-11-11 18:05:30 +1100 | [diff] [blame] | 217 | mkdir -p ${WORKSPACE} |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 218 | |
Chris Smart | 01d2b96 | 2015-11-11 18:05:30 +1100 | [diff] [blame] | 219 | cat > "${WORKSPACE}"/build.sh << EOF_SCRIPT |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 220 | #!/bin/bash |
| 221 | |
Joel Stanley | 38c9d14 | 2016-02-16 12:31:55 +1030 | [diff] [blame] | 222 | set -xeo pipefail |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 223 | |
Alanny Lopez | e687019 | 2017-04-24 15:25:59 -0500 | [diff] [blame] | 224 | # Use the mounted repo cache to make an internal repo not mounted externally |
| 225 | git clone --reference ${ocache} --dissociate https://github.com/openbmc/openbmc ${obmcdir} |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 226 | |
Alanny Lopez | eaa2eae | 2017-04-24 14:55:07 -0500 | [diff] [blame] | 227 | # Go into the OpenBMC directory (the openbmc script will put us in a build subdir) |
Andrew Geissler | c3c3520 | 2016-08-16 08:47:50 -0500 | [diff] [blame] | 228 | cd ${obmcdir} |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 229 | |
| 230 | # Set up proxies |
| 231 | export ftp_proxy=${http_proxy} |
| 232 | export http_proxy=${http_proxy} |
| 233 | export https_proxy=${http_proxy} |
| 234 | |
Chris Smart | 01d2b96 | 2015-11-11 18:05:30 +1100 | [diff] [blame] | 235 | mkdir -p ${WORKSPACE}/bin |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 236 | |
Alanny Lopez | eaa2eae | 2017-04-24 14:55:07 -0500 | [diff] [blame] | 237 | # Configure proxies for BitBake |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 238 | if [[ -n "${http_proxy}" ]]; then |
| 239 | |
Chris Smart | d30c590 | 2016-03-01 15:00:54 +1100 | [diff] [blame] | 240 | cat > ${WORKSPACE}/bin/git-proxy << \EOF_GIT |
Alanny Lopez | eaa2eae | 2017-04-24 14:55:07 -0500 | [diff] [blame] | 241 | #!/bin/bash |
| 242 | # \$1 = hostname, \$2 = port |
| 243 | PROXY=${PROXY_HOST} |
| 244 | PROXY_PORT=${PROXY_PORT} |
| 245 | exec socat STDIO PROXY:\${PROXY}:\${1}:\${2},proxyport=\${PROXY_PORT} |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 246 | EOF_GIT |
| 247 | |
Chris Smart | 01d2b96 | 2015-11-11 18:05:30 +1100 | [diff] [blame] | 248 | chmod a+x ${WORKSPACE}/bin/git-proxy |
| 249 | export PATH=${WORKSPACE}/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:${PATH} |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 250 | git config core.gitProxy git-proxy |
| 251 | |
| 252 | mkdir -p ~/.subversion |
| 253 | |
| 254 | cat > ~/.subversion/servers << EOF_SVN |
Alanny Lopez | eaa2eae | 2017-04-24 14:55:07 -0500 | [diff] [blame] | 255 | [global] |
| 256 | http-proxy-host = ${PROXY_HOST} |
| 257 | http-proxy-port = ${PROXY_PORT} |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 258 | EOF_SVN |
| 259 | fi |
| 260 | |
| 261 | # Source our build env |
| 262 | ${BITBAKE_CMD} |
| 263 | |
Alanny Lopez | eaa2eae | 2017-04-24 14:55:07 -0500 | [diff] [blame] | 264 | # Custom BitBake config settings |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 265 | cat >> conf/local.conf << EOF_CONF |
Chris Smart | c650c20 | 2015-11-25 15:58:53 +1100 | [diff] [blame] | 266 | BB_NUMBER_THREADS = "$(nproc)" |
| 267 | PARALLEL_MAKE = "-j$(nproc)" |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 268 | INHERIT += "rm_work" |
| 269 | BB_GENERATE_MIRROR_TARBALLS = "1" |
Alanny Lopez | 97a7950 | 2017-04-24 16:19:25 -0500 | [diff] [blame] | 270 | DL_DIR="${sscdir}/bitbake_downloads" |
| 271 | SSTATE_DIR="${sscdir}/bitbake_sharedstatecache" |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 272 | USER_CLASSES += "buildstats" |
Andrew Geissler | 931ec67 | 2016-08-11 13:10:05 -0500 | [diff] [blame] | 273 | INHERIT_remove = "uninative" |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 274 | EOF_CONF |
| 275 | |
| 276 | # Kick off a build |
Andrew Geissler | 496a6b0 | 2016-10-03 10:04:49 -0500 | [diff] [blame] | 277 | bitbake ${BITBAKE_OPTS} obmc-phosphor-image |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 278 | |
Alanny Lopez | e687019 | 2017-04-24 15:25:59 -0500 | [diff] [blame] | 279 | # Copy images out of internal obmcdir into workspace directory |
Alanny Lopez | b0a12dd | 2017-04-24 16:21:47 -0500 | [diff] [blame^] | 280 | cp -R ${obmcdir}/build/tmp/deploy ${WORKSPACE}/deploy/ |
Alanny Lopez | e687019 | 2017-04-24 15:25:59 -0500 | [diff] [blame] | 281 | |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 282 | EOF_SCRIPT |
| 283 | |
| 284 | chmod a+x ${WORKSPACE}/build.sh |
| 285 | |
Alanny Lopez | 3fbaa51 | 2017-04-24 15:46:52 -0500 | [diff] [blame] | 286 | # Determine if the build container will be launched with Docker or Kubernetes |
| 287 | if [[ "${launch}" == "" ]]; then |
| 288 | |
| 289 | # Give the Docker image a name based on the distro,tag,arch,and target |
| 290 | imgname=${imgname:-openbmc/${distro}:${imgtag}-${target}-${ARCH}} |
| 291 | |
| 292 | # Build the Docker image |
| 293 | docker build -t ${imgname} - <<< "${Dockerfile}" |
| 294 | |
Alanny Lopez | 97a7950 | 2017-04-24 16:19:25 -0500 | [diff] [blame] | 295 | # If ocache or sscdir are ${HOME} or a subdirectory they will not be mounted |
| 296 | mountocache="-v ""${ocache}"":""${ocache}"" " |
| 297 | mountsscdir="-v ""${sscdir}"":""${sscdir}"" " |
| 298 | if [[ "${ocache}" = "${HOME}/"* || "${ocache}" = "${HOME}" ]];then |
| 299 | mountocache="" |
| 300 | fi |
| 301 | if [[ "${sscdir}" = "${HOME}/"* || "${sscdir}" = "${HOME}" ]];then |
| 302 | mountsscdir="" |
| 303 | fi |
| 304 | |
Alanny Lopez | 3fbaa51 | 2017-04-24 15:46:52 -0500 | [diff] [blame] | 305 | # Run the Docker container, execute the build.sh script |
| 306 | docker run \ |
| 307 | --cap-add=sys_admin \ |
| 308 | --net=host \ |
| 309 | --rm=true \ |
| 310 | -e WORKSPACE=${WORKSPACE} \ |
| 311 | -w "${HOME}" \ |
| 312 | -v "${HOME}":"${HOME}" \ |
Alanny Lopez | 97a7950 | 2017-04-24 16:19:25 -0500 | [diff] [blame] | 313 | ${mountocache} \ |
| 314 | ${mountsscdir} \ |
Alanny Lopez | 3fbaa51 | 2017-04-24 15:46:52 -0500 | [diff] [blame] | 315 | -t ${imgname} \ |
| 316 | ${WORKSPACE}/build.sh |
| 317 | |
| 318 | elif [[ "${launch}" == "job" || "${launch}" == "pod" ]]; then |
| 319 | |
| 320 | # Source and run the helper script to launch the pod or job |
| 321 | . kubernetes/kubernetes-launch.sh |
| 322 | |
| 323 | else |
| 324 | echo "Launch Parameter is invalid" |
| 325 | fi |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 326 | |
| 327 | # Timestamp for build |
Alanny Lopez | b0a12dd | 2017-04-24 16:21:47 -0500 | [diff] [blame^] | 328 | echo "Build completed, $(date)" |