Bug 1274350 - Update docker image, add GCC 4 and GCC 6 builds r=me
authorTim Taubert <ttaubert@mozilla.com>
Wed, 25 May 2016 19:04:08 +0200
changeset 12202 11d17d39610a826f76a566dcfdca24f1bd675a6e
parent 12201 f644a98674508a6ce5bf8e674fb6ad039a77932f
child 12203 d6d4a4d1e7536283d01fd633a18960b3462bb868
push id1253
push userttaubert@mozilla.com
push dateWed, 25 May 2016 17:06:16 +0000
reviewersme
bugs1274350
Bug 1274350 - Update docker image, add GCC 4 and GCC 6 builds r=me
.taskcluster.yml
automation/taskcluster/docker/setup.sh
automation/taskcluster/graph/graph.yml
automation/taskcluster/scripts/build.sh
--- a/.taskcluster.yml
+++ b/.taskcluster.yml
@@ -59,24 +59,24 @@ tasks:
         # mozilla-taskcluster will append the appropriate assume:repo:<repo>
         # scope here.
 
       routes:
         - "tc-treeherder-stage.nss.{{revision_hash}}"
         - "tc-treeherder.nss.{{revision_hash}}"
 
       payload:
-        image: "ttaubert/nss-ci:0.0.14"
+        image: "ttaubert/nss-ci:0.0.15"
 
         env:
           TC_OWNER: {{owner}}
           TC_SOURCE: {{{source}}}
           TC_REVISION: '{{revision}}'
           TC_REVISION_HASH: '{{revision_hash}}'
-          TC_DOCKER_IMAGE: "ttaubert/nss-ci:0.0.14"
+          TC_DOCKER_IMAGE: "ttaubert/nss-ci:0.0.15"
           TC_PROVISIONER_ID: "aws-provisioner-v1"
           TC_WORKER_TYPE: "hg-worker"
           NSS_HEAD_REPOSITORY: '{{{url}}}'
           NSS_HEAD_REVISION: '{{revision}}'
 
         features:
           taskclusterProxy: true
 
--- a/automation/taskcluster/docker/setup.sh
+++ b/automation/taskcluster/docker/setup.sh
@@ -22,29 +22,44 @@ apt-get -y update
 export DEBIAN_FRONTEND=noninteractive
 apt-get install -y --no-install-recommends curl apt-utils
 
 # clang-format-3.8
 apt_packages+=('clang-format-3.8')
 curl http://llvm.org/apt/llvm-snapshot.gpg.key | apt-key add -
 echo "deb http://llvm.org/apt/xenial/ llvm-toolchain-xenial-3.8 main" > /etc/apt/sources.list.d/docker.list
 
+# Install the first round of packages.
+apt-get -y update
+apt-get install -y --no-install-recommends ${apt_packages[@]}
+
 # gcc 6
+apt_packages=()
 apt_packages+=('g++-6')
+apt_packages+=('g++-4.6')
 apt_packages+=('g++-6-multilib')
+apt_packages+=('g++-4.6-multilib')
 apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 60C317803A41BA51845E371A1E9377A2BA9EF27F
 echo "deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial main" > /etc/apt/sources.list.d/toolchain.list
 
-# Install all other packages.
+# Install the second round of packages.
 apt-get -y update
 apt-get install -y --no-install-recommends ${apt_packages[@]}
 
 # 32-bit builds
 ln -s /usr/include/x86_64-linux-gnu/zconf.h /usr/include
 
+# Compiler options.
+update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 10
+update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.6 10
+update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 20
+update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-6 20
+update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 30
+update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 30
+
 locale-gen en_US.UTF-8
 dpkg-reconfigure locales
 
 # Install required Node modules.
 su -c "npm install flatmap js-yaml merge slugid" worker
 
 # Cleanup.
 rm -rf ~/.ccache ~/.cache
--- a/automation/taskcluster/graph/graph.yml
+++ b/automation/taskcluster/graph/graph.yml
@@ -4,18 +4,39 @@ templates:
   builder:
     artifact: "dist.tar.bz2"
     command:
       - "/bin/bash"
       - "-c"
       - "bin/checkout.sh && nss/automation/taskcluster/scripts/build.sh"
     env:
       NSS_ENABLE_TLS_1_3: 1
+      GCC_VERSION: gcc-5
+      GXX_VERSION: g++-5
     treeherder:
       symbol: B
+
+  builder_gcc4:
+    extends: builder
+    env:
+      GCC_VERSION: gcc-4.6
+      GXX_VERSION: g++-4.6
+    treeherder:
+      symbol: gcc4
+
+  builder_gcc6:
+    extends: builder
+    env:
+      GCC_VERSION: gcc-6
+      GXX_VERSION: g++-6
+    treeherder:
+      symbol: gcc6
+
+  builder_with_tests:
+    extends: builder
     subtasks:
       cert: true
       chains: true
       cipher: true
       crmf: true
       dbtests: true
       ec: true
       fips: true
@@ -249,110 +270,170 @@ templates:
   tools:
     name: "Tools tests"
     extends: test_runner
     env:
       NSS_TESTS: "tools"
     treeherder:
       symbol: Tools
 
+## Task Graph #################################################################
+
 graph:
   build-32-debug:
     name: "Linux 32 (debug)"
-    extends: builder
+    extends: builder_with_tests
     treeherder:
       build:
         platform: linux32
       collection:
         debug: true
 
   build-32-opt:
     name: "Linux 32 (opt)"
-    extends: builder
+    extends: builder_with_tests
     env:
       BUILD_OPT: 1
     treeherder:
       build:
         platform: linux32
       collection:
         opt: true
 
   build-64-debug:
     name: "Linux 64 (debug)"
-    extends: builder
+    extends: builder_with_tests
     env:
       USE_64: 1
     treeherder:
       build:
         platform: linux64
       collection:
         debug: true
     subtasks:
       memleak_server: true
       memleak_client: true
       memleak_chains: true
       memleak_ocsp: true
 
   build-64-asan:
     name: "Linux 64 (ASan)"
-    extends: builder
+    extends: builder_with_tests
     env:
       USE_ASAN: 1
       USE_64: 1
     treeherder:
       build:
         platform: linux64
       collection:
         asan: true
 
   build-64-opt:
     name: "Linux 64 (opt)"
-    extends: builder
+    extends: builder_with_tests
     env:
       BUILD_OPT: 1
       USE_64: 1
     treeherder:
       build:
         platform: linux64
       collection:
         opt: true
 
-# build-32-debug-asan-gcc6:
-#   name: "Linux 32 (gcc6, debug, ASan)"
-#   extends: builder
-#   env:
-#     USE_ASAN: 1
-#     CCC: g++-6
-#     CC: gcc-6
+  ## GCC 4 ####################################################################
+
+  build-32-debug-gcc4:
+    name: "Linux 32 (debug, gcc4)"
+    extends: builder_gcc4
+    treeherder:
+      build:
+        platform: linux32
+      collection:
+        debug: true
+
+  build-32-opt-gcc4:
+    name: "Linux 32 (opt, gcc4)"
+    extends: builder_gcc4
+    env:
+      BUILD_OPT: 1
+    treeherder:
+      build:
+        platform: linux32
+      collection:
+        opt: true
 
-# build-32-opt-gcc6:
-#   name: "Linux 32 (gcc6, opt)"
-#   extends: builder
-#   env:
-#     BUILD_OPT: 1
-#     CCC: g++-6
-#     CC: gcc-6
+  build-64-debug-gcc4:
+    name: "Linux 64 (debug, gcc4)"
+    extends: builder_gcc4
+    env:
+      USE_64: 1
+    treeherder:
+      build:
+        platform: linux64
+      collection:
+        debug: true
+
+  build-64-opt-gcc4:
+    name: "Linux 64 (opt, gcc4)"
+    extends: builder_gcc4
+    env:
+      BUILD_OPT: 1
+      USE_64: 1
+    treeherder:
+      build:
+        platform: linux64
+      collection:
+        opt: true
 
-# build-64-debug-asan-gcc6:
-#   name: "Linux 64 (gcc6, debug, ASan)"
-#   extends: builder
-#   env:
-#     USE_ASAN: 1
-#     USE_64: 1
-#     CCC: g++-6
-#     CC: gcc-6
+  ## GCC 6 ####################################################################
+
+  build-32-debug-gcc6:
+    name: "Linux 32 (debug, gcc6)"
+    extends: builder_gcc6
+    treeherder:
+      build:
+        platform: linux32
+      collection:
+        debug: true
+
+  build-32-opt-gcc6:
+    name: "Linux 32 (opt, gcc6)"
+    extends: builder_gcc6
+    env:
+      BUILD_OPT: 1
+    treeherder:
+      build:
+        platform: linux32
+      collection:
+        opt: true
 
-# build-64-opt-gcc6:
-#   name: "Linux 64 (gcc6, opt)"
-#   extends: builder
-#   env:
-#     BUILD_OPT: 1
-#     USE_64: 1
-#     CCC: g++-6
-#     CC: gcc-6
+  build-64-debug-gcc6:
+    name: "Linux 64 (debug, gcc6)"
+    extends: builder_gcc6
+    env:
+      USE_64: 1
+    treeherder:
+      build:
+        platform: linux64
+      collection:
+        debug: true
+
+  build-64-opt-gcc6:
+    name: "Linux 64 (opt, gcc6)"
+    extends: builder_gcc6
+    env:
+      BUILD_OPT: 1
+      USE_64: 1
+    treeherder:
+      build:
+        platform: linux64
+      collection:
+        opt: true
+
+  ## Tools ####################################################################
 
   clang-format:
     name: "clang-format-3.8"
     command:
       - "/bin/bash"
       - "-c"
       - "bin/checkout.sh && nss/automation/taskcluster/scripts/run_clang_format.sh nss/lib/ssl"
     treeherder:
--- a/automation/taskcluster/scripts/build.sh
+++ b/automation/taskcluster/scripts/build.sh
@@ -1,13 +1,20 @@
 #!/usr/bin/env bash
 
 set -v -e -x
 
 if [ $(id -u) = 0 ]; then
+    # Switch compilers.
+    GCC=${GCC_VERSION:-gcc-5}
+    GXX=${GXX_VERSION:-g++-5}
+
+    update-alternatives --set gcc "/usr/bin/$GCC"
+    update-alternatives --set g++ "/usr/bin/$GXX"
+
     # Drop privileges by re-running this script.
     exec su worker $0
 fi
 
 # Clone NSPR if needed.
 if [ ! -d "nspr" ]; then
     hg clone https://hg.mozilla.org/projects/nspr
 fi