Bug 1389435 - Forbid toolchain dependencies on aliases. r?dustin draft
authorMike Hommey <mh+mozilla@glandium.org>
Tue, 15 Aug 2017 09:39:48 +0900
changeset 647249 c3d0b7e8cc68b0d8597dc60e875c2f6d25c93326
parent 647248 d4dcedfa27db1122ff97f145e3fd8f67e5c5f0d2
child 647250 3b63e623cf6be3cbbdbfe50ad2edaf366de68f0f
push id74339
push userbmo:mh+mozilla@glandium.org
push dateWed, 16 Aug 2017 04:52:45 +0000
reviewersdustin
bugs1389435, 1386920
milestone57.0a1
Bug 1389435 - Forbid toolchain dependencies on aliases. r?dustin This extends bug 1386920 in a more general way on toolchain jobs.
taskcluster/ci/toolchain/linux.yml
taskcluster/ci/toolchain/macosx.yml
taskcluster/taskgraph/transforms/toolchain.py
--- a/taskcluster/ci/toolchain/linux.yml
+++ b/taskcluster/ci/toolchain/linux.yml
@@ -141,17 +141,17 @@ linux64-cctools-port:
         max-run-time: 36000
     run:
         using: toolchain-script
         script: build-cctools-port.sh
         resources:
             - 'taskcluster/scripts/misc/tooltool-download.sh'
         toolchain-artifact: public/build/cctools.tar.xz
     toolchains:
-        - linux64-clang
+        - linux64-clang-3.9
 
 linux64-hfsplus:
     description: "hfsplus toolchain build"
     treeherder:
         kind: build
         platform: toolchains/opt
         symbol: TL(hfs+)
         tier: 1
@@ -162,17 +162,17 @@ linux64-hfsplus:
     run:
         using: toolchain-script
         script: build-hfsplus-linux.sh
         resources:
             - 'build/unix/build-hfsplus/build-hfsplus.sh'
             - 'taskcluster/scripts/misc/tooltool-download.sh'
         toolchain-artifact: public/build/hfsplus-tools.tar.xz
     toolchains:
-        - linux64-clang
+        - linux64-clang-3.9
 
 linux64-libdmg:
     description: "libdmg-hfsplus toolchain build"
     treeherder:
         kind: build
         platform: toolchains/opt
         symbol: TL(libdmg-hfs+)
         tier: 1
@@ -200,9 +200,9 @@ linux64-sccache:
             TOOLTOOL_MANIFEST: "browser/config/tooltool-manifests/linux64/releng.manifest"
     run:
         using: toolchain-script
         script: build-sccache.sh
         resources:
             - 'taskcluster/scripts/misc/tooltool-download.sh'
         toolchain-artifact: public/build/sccache2.tar.xz
     toolchains:
-        - linux64-clang
+        - linux64-clang-3.9
--- a/taskcluster/ci/toolchain/macosx.yml
+++ b/taskcluster/ci/toolchain/macosx.yml
@@ -21,18 +21,18 @@ macosx64-clang:
         tooltool-downloads: internal
         resources:
             - 'build/build-clang/build-clang.py'
             - 'build/build-clang/clang-macosx64.json'
             - 'taskcluster/scripts/misc/tooltool-download.sh'
         toolchain-artifact: public/build/clang.tar.xz
     toolchains:
         - linux64-cctools-port
-        - linux64-clang
-        - linux64-gcc
+        - linux64-clang-3.9
+        - linux64-gcc-4.9
 
 macosx64-clang-tidy:
     description: "Clang-tidy build"
     index:
         product: static-analysis
         job-name: macosx64-clang-tidy
     treeherder:
         kind: build
@@ -52,18 +52,18 @@ macosx64-clang-tidy:
         resources:
             - 'build/clang-plugin/**'
             - 'build/build-clang/build-clang.py'
             - 'build/build-clang/clang-tidy-macosx64.json'
             - 'taskcluster/scripts/misc/tooltool-download.sh'
         toolchain-artifact: public/build/clang-tidy.tar.xz
     toolchains:
         - linux64-cctools-port
-        - linux64-clang
-        - linux64-gcc
+        - linux64-clang-3.9
+        - linux64-gcc-4.9
 
 macosx64-cctools-port:
     description: "cctools-port toolchain build"
     treeherder:
         kind: build
         platform: toolchains/opt
         symbol: TM(cctools)
         tier: 1
@@ -77,9 +77,9 @@ macosx64-cctools-port:
         using: toolchain-script
         script: build-cctools-port-macosx.sh
         tooltool-downloads: internal
         resources:
             - 'taskcluster/scripts/misc/tooltool-download.sh'
         toolchain-artifact: public/build/cctools.tar.bz2
     toolchains:
         - linux64-cctools-port
-        - linux64-clang
+        - linux64-clang-3.9
--- a/taskcluster/taskgraph/transforms/toolchain.py
+++ b/taskcluster/taskgraph/transforms/toolchain.py
@@ -49,20 +49,33 @@ def use_toolchains(config, jobs):
                 "Cannot use the alias %s for %s, it's already used for %s"
                 % (alias, job, aliases[alias]))
         if alias in artifacts:
             raise Exception(
                 "Cannot use the alias %s for %s, it's already a toolchain job"
                 % (alias, job))
         aliases[alias] = job
 
+    if config.kind == 'toolchain':
+        def get_alias(key):
+            if key in aliases:
+                raise Exception(
+                    "Toolchain job %s can't use the alias %s as dependency. "
+                    "Please use %s instead."
+                    % (job['name'], key, aliases[key])
+                )
+            return key
+    else:
+        def get_alias(key):
+            return aliases.get(key, key)
+
     for job in jobs:
         env = job.setdefault('worker', {}).setdefault('env', {})
 
-        toolchains = [aliases.get(t, t)
+        toolchains = [get_alias(t)
                       for t in job.pop('toolchains', [])]
 
         if config.kind == 'toolchain' and job['name'] in toolchains:
             raise Exception("Toolchain job %s can't use itself as toolchain"
                             % job['name'])
 
         filenames = {}
         for t in toolchains: