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