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 | RUN apt-get update && apt-get install -yy \ |
| 179 | build-essential \ |
| 180 | chrpath \ |
| 181 | debianutils \ |
| 182 | diffstat \ |
| 183 | gawk \ |
| 184 | git \ |
| 185 | libdata-dumper-simple-perl \ |
| 186 | libsdl1.2-dev \ |
| 187 | libthread-queue-any-perl \ |
Alanny Lopez | 27af3a0 | 2017-05-26 10:49:06 -0500 | [diff] [blame] | 188 | locales \ |
Alanny Lopez | eaa2eae | 2017-04-24 14:55:07 -0500 | [diff] [blame] | 189 | python \ |
| 190 | python3 \ |
| 191 | socat \ |
| 192 | subversion \ |
| 193 | texinfo \ |
| 194 | cpio \ |
| 195 | wget |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 196 | |
Alanny Lopez | 27af3a0 | 2017-05-26 10:49:06 -0500 | [diff] [blame] | 197 | # Set the locale |
| 198 | RUN locale-gen en_US.UTF-8 |
| 199 | ENV LANG en_US.UTF-8 |
| 200 | ENV LANGUAGE en_US:en |
| 201 | ENV LC_ALL en_US.UTF-8 |
| 202 | |
Alanny Lopez | eaa2eae | 2017-04-24 14:55:07 -0500 | [diff] [blame] | 203 | RUN grep -q ${GROUPS} /etc/group || groupadd -g ${GROUPS} ${USER} |
| 204 | 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] | 205 | |
Alanny Lopez | eaa2eae | 2017-04-24 14:55:07 -0500 | [diff] [blame] | 206 | USER ${USER} |
| 207 | ENV HOME ${HOME} |
| 208 | RUN /bin/bash |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 209 | EOF |
| 210 | ) |
| 211 | fi |
| 212 | |
Alanny Lopez | eaa2eae | 2017-04-24 14:55:07 -0500 | [diff] [blame] | 213 | # Create the Docker run script |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 214 | export PROXY_HOST=${http_proxy/#http*:\/\/} |
| 215 | export PROXY_HOST=${PROXY_HOST/%:[0-9]*} |
| 216 | export PROXY_PORT=${http_proxy/#http*:\/\/*:} |
| 217 | |
Chris Smart | 01d2b96 | 2015-11-11 18:05:30 +1100 | [diff] [blame] | 218 | mkdir -p ${WORKSPACE} |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 219 | |
Chris Smart | 01d2b96 | 2015-11-11 18:05:30 +1100 | [diff] [blame] | 220 | cat > "${WORKSPACE}"/build.sh << EOF_SCRIPT |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 221 | #!/bin/bash |
| 222 | |
Joel Stanley | 38c9d14 | 2016-02-16 12:31:55 +1030 | [diff] [blame] | 223 | set -xeo pipefail |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 224 | |
Alanny Lopez | e687019 | 2017-04-24 15:25:59 -0500 | [diff] [blame] | 225 | # Use the mounted repo cache to make an internal repo not mounted externally |
| 226 | git clone --reference ${ocache} --dissociate https://github.com/openbmc/openbmc ${obmcdir} |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 227 | |
Alanny Lopez | eaa2eae | 2017-04-24 14:55:07 -0500 | [diff] [blame] | 228 | # 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] | 229 | cd ${obmcdir} |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 230 | |
| 231 | # Set up proxies |
| 232 | export ftp_proxy=${http_proxy} |
| 233 | export http_proxy=${http_proxy} |
| 234 | export https_proxy=${http_proxy} |
| 235 | |
Chris Smart | 01d2b96 | 2015-11-11 18:05:30 +1100 | [diff] [blame] | 236 | mkdir -p ${WORKSPACE}/bin |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 237 | |
Alanny Lopez | eaa2eae | 2017-04-24 14:55:07 -0500 | [diff] [blame] | 238 | # Configure proxies for BitBake |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 239 | if [[ -n "${http_proxy}" ]]; then |
| 240 | |
Chris Smart | d30c590 | 2016-03-01 15:00:54 +1100 | [diff] [blame] | 241 | cat > ${WORKSPACE}/bin/git-proxy << \EOF_GIT |
Alanny Lopez | eaa2eae | 2017-04-24 14:55:07 -0500 | [diff] [blame] | 242 | #!/bin/bash |
| 243 | # \$1 = hostname, \$2 = port |
| 244 | PROXY=${PROXY_HOST} |
| 245 | PROXY_PORT=${PROXY_PORT} |
| 246 | exec socat STDIO PROXY:\${PROXY}:\${1}:\${2},proxyport=\${PROXY_PORT} |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 247 | EOF_GIT |
| 248 | |
Chris Smart | 01d2b96 | 2015-11-11 18:05:30 +1100 | [diff] [blame] | 249 | chmod a+x ${WORKSPACE}/bin/git-proxy |
| 250 | 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] | 251 | git config core.gitProxy git-proxy |
| 252 | |
| 253 | mkdir -p ~/.subversion |
| 254 | |
| 255 | cat > ~/.subversion/servers << EOF_SVN |
Alanny Lopez | eaa2eae | 2017-04-24 14:55:07 -0500 | [diff] [blame] | 256 | [global] |
| 257 | http-proxy-host = ${PROXY_HOST} |
| 258 | http-proxy-port = ${PROXY_PORT} |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 259 | EOF_SVN |
| 260 | fi |
| 261 | |
| 262 | # Source our build env |
| 263 | ${BITBAKE_CMD} |
| 264 | |
Alanny Lopez | eaa2eae | 2017-04-24 14:55:07 -0500 | [diff] [blame] | 265 | # Custom BitBake config settings |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 266 | cat >> conf/local.conf << EOF_CONF |
Chris Smart | c650c20 | 2015-11-25 15:58:53 +1100 | [diff] [blame] | 267 | BB_NUMBER_THREADS = "$(nproc)" |
| 268 | PARALLEL_MAKE = "-j$(nproc)" |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 269 | INHERIT += "rm_work" |
| 270 | BB_GENERATE_MIRROR_TARBALLS = "1" |
Alanny Lopez | 97a7950 | 2017-04-24 16:19:25 -0500 | [diff] [blame] | 271 | DL_DIR="${sscdir}/bitbake_downloads" |
| 272 | SSTATE_DIR="${sscdir}/bitbake_sharedstatecache" |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 273 | USER_CLASSES += "buildstats" |
Andrew Geissler | 931ec67 | 2016-08-11 13:10:05 -0500 | [diff] [blame] | 274 | INHERIT_remove = "uninative" |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 275 | EOF_CONF |
| 276 | |
| 277 | # Kick off a build |
Andrew Geissler | 496a6b0 | 2016-10-03 10:04:49 -0500 | [diff] [blame] | 278 | bitbake ${BITBAKE_OPTS} obmc-phosphor-image |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 279 | |
Alanny Lopez | e687019 | 2017-04-24 15:25:59 -0500 | [diff] [blame] | 280 | # Copy images out of internal obmcdir into workspace directory |
Alanny Lopez | b0a12dd | 2017-04-24 16:21:47 -0500 | [diff] [blame] | 281 | cp -R ${obmcdir}/build/tmp/deploy ${WORKSPACE}/deploy/ |
Alanny Lopez | e687019 | 2017-04-24 15:25:59 -0500 | [diff] [blame] | 282 | |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 283 | EOF_SCRIPT |
| 284 | |
| 285 | chmod a+x ${WORKSPACE}/build.sh |
| 286 | |
Alanny Lopez | 3fbaa51 | 2017-04-24 15:46:52 -0500 | [diff] [blame] | 287 | # Determine if the build container will be launched with Docker or Kubernetes |
| 288 | if [[ "${launch}" == "" ]]; then |
| 289 | |
| 290 | # Give the Docker image a name based on the distro,tag,arch,and target |
| 291 | imgname=${imgname:-openbmc/${distro}:${imgtag}-${target}-${ARCH}} |
| 292 | |
| 293 | # Build the Docker image |
| 294 | docker build -t ${imgname} - <<< "${Dockerfile}" |
| 295 | |
Alanny Lopez | 97a7950 | 2017-04-24 16:19:25 -0500 | [diff] [blame] | 296 | # If ocache or sscdir are ${HOME} or a subdirectory they will not be mounted |
| 297 | mountocache="-v ""${ocache}"":""${ocache}"" " |
| 298 | mountsscdir="-v ""${sscdir}"":""${sscdir}"" " |
| 299 | if [[ "${ocache}" = "${HOME}/"* || "${ocache}" = "${HOME}" ]];then |
| 300 | mountocache="" |
| 301 | fi |
| 302 | if [[ "${sscdir}" = "${HOME}/"* || "${sscdir}" = "${HOME}" ]];then |
| 303 | mountsscdir="" |
| 304 | fi |
| 305 | |
Alanny Lopez | 3fbaa51 | 2017-04-24 15:46:52 -0500 | [diff] [blame] | 306 | # Run the Docker container, execute the build.sh script |
| 307 | docker run \ |
| 308 | --cap-add=sys_admin \ |
| 309 | --net=host \ |
| 310 | --rm=true \ |
| 311 | -e WORKSPACE=${WORKSPACE} \ |
| 312 | -w "${HOME}" \ |
| 313 | -v "${HOME}":"${HOME}" \ |
Alanny Lopez | 97a7950 | 2017-04-24 16:19:25 -0500 | [diff] [blame] | 314 | ${mountocache} \ |
| 315 | ${mountsscdir} \ |
Alanny Lopez | 3fbaa51 | 2017-04-24 15:46:52 -0500 | [diff] [blame] | 316 | -t ${imgname} \ |
| 317 | ${WORKSPACE}/build.sh |
| 318 | |
| 319 | elif [[ "${launch}" == "job" || "${launch}" == "pod" ]]; then |
| 320 | |
| 321 | # Source and run the helper script to launch the pod or job |
| 322 | . kubernetes/kubernetes-launch.sh |
| 323 | |
| 324 | else |
| 325 | echo "Launch Parameter is invalid" |
| 326 | fi |
Chris Smart | 0265171 | 2015-11-11 11:09:00 +1100 | [diff] [blame] | 327 | |
| 328 | # Timestamp for build |
Alanny Lopez | 27af3a0 | 2017-05-26 10:49:06 -0500 | [diff] [blame] | 329 | echo "Build completed, $(date)" |