Bug 1428197 - Reject generic channels in rust repack jobs. r=glandium
authorRalph Giles <giles@mozilla.com>
Mon, 26 Feb 2018 16:54:36 -0800
changeset 406492 c41c9cc44d8aa41e536a2fdf977b817dabed42ae
parent 406491 ab959de6ec504f5d84dc95c6a7dcc9ae25d0e728
child 406493 c74a5f3559834991fc6854be0ce82d3f802bc30e
push id33563
push userbtara@mozilla.com
push dateSun, 04 Mar 2018 21:48:18 +0000
treeherdermozilla-central@c74a5f355983 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1428197 - Reject generic channels in rust repack jobs. r=glandium Ensure better determinism when creating rust toolchain packages by rejecting generic channels like 'stable' or 'nightly'. Instead, insist on a specific version or date. The current valid dates for beta and nightly can be obtained with: curl -s https://static.rust-lang.org/dist/channel-rust-beta.toml | grep ^date curl -s https://static.rust-lang.org/dist/channel-rust-nightly.toml | grep ^date MozReview-Commit-ID: I0DXw1KJGZz
--- a/taskcluster/scripts/misc/repack_rust.py
+++ b/taskcluster/scripts/misc/repack_rust.py
@@ -379,38 +379,53 @@ def expand_platform(name):
         'mac32': "i686-apple-darwin",
         'win64': "x86_64-pc-windows-msvc",
         'win32': "i686-pc-windows-msvc",
         'mingw32': "i686-pc-windows-gnu",
     return platforms.get(name, name)
+def validate_channel(channel):
+    '''Require a specific release version.
+    Packaging from meta-channels, like `stable`, `beta`, or `nightly`
+    doesn't give repeatable output. Reject such channels.'''
+    channel_prefixes = ('stable', 'beta', 'nightly')
+    if any([channel.startswith(c) for c in channel_prefixes]):
+        if '-' not in channel:
+            raise ValueError('Generic channel "%s" specified!'
+                             '\nPlease give a specific release version'
+                             ' like "1.24.0" or "beta-2018-02-20".' % channel)
 def args():
     '''Read command line arguments and return options.'''
     parser = argparse.ArgumentParser()
                         help='Release channel to use:'
-                             ' stable, beta, or nightly',
-                        default='stable')
+                             ' 1.xx.y, beta-yyyy-mm-dd,'
+                             ' or nightly-yyyy-mm-dd.',
+                             required=True)
-                        help='Release channel to use for cargo:'
-                             ' stable, beta, or nightly.'
+                        help='Release channel version to use for cargo.'
                              ' Defaults to the same as --channel.')
                         help='Host platform for the toolchain executable:'
                              ' e.g. linux64 or aarch64-linux-android.'
                              ' Defaults to linux64.')
     parser.add_argument('--target', dest='targets', action='append', default=[],
                         help='Additional target platform to support:'
                              ' e.g. linux32 or i686-pc-windows-gnu.'
                              ' can be given more than once.')
     args = parser.parse_args()
     if not args.cargo_channel:
         args.cargo_channel = args.channel
+    validate_channel(args.channel)
+    validate_channel(args.cargo_channel)
     if not args.host:
         args.host = 'linux64'
     args.host = expand_platform(args.host)
     args.targets = map(expand_platform, args.targets)
     return args