automation: support and use Debian Buster by default
authorGregory Szorc <gregory.szorc@gmail.com>
Sun, 29 Sep 2019 11:29:25 -0700
changeset 43018 d1d919f679f7
parent 43017 6952d42f9158
child 43019 2cc453284d5c
automation: support and use Debian Buster by default While Debian Buster (Debian 10) was released in July, the AWS AMIs were not published until mid September. This commit teaches the automation system to create AMIs for Debian Buster. Since Debian Buster is the new stable Debian release, we make it the default distribution for automation. Differential Revision: https://phab.mercurial-scm.org/D6917
contrib/automation/hgautomation/aws.py
contrib/automation/hgautomation/cli.py
contrib/automation/hgautomation/linux.py
--- a/contrib/automation/hgautomation/aws.py	Sun Sep 29 11:24:14 2019 -0700
+++ b/contrib/automation/hgautomation/aws.py	Sun Sep 29 11:29:25 2019 -0700
@@ -54,6 +54,7 @@
 
 AMAZON_ACCOUNT_ID = '801119661308'
 DEBIAN_ACCOUNT_ID = '379101102735'
+DEBIAN_ACCOUNT_ID_2 = '136693071363'
 UBUNTU_ACCOUNT_ID = '099720109477'
 
 
@@ -807,7 +808,7 @@
     return image
 
 
-def ensure_linux_dev_ami(c: AWSConnection, distro='debian9', prefix='hg-'):
+def ensure_linux_dev_ami(c: AWSConnection, distro='debian10', prefix='hg-'):
     """Ensures a Linux development AMI is available and up-to-date.
 
     Returns an ``ec2.Image`` of either an existing AMI or a newly-built one.
@@ -824,6 +825,13 @@
             'debian-stretch-hvm-x86_64-gp2-2019-09-08-17994',
         )
         ssh_username = 'admin'
+    elif distro == 'debian10':
+        image = find_image(
+            ec2resource,
+            DEBIAN_ACCOUNT_ID_2,
+            'debian-10-amd64-20190909-10',
+        )
+        ssh_username = 'admin'
     elif distro == 'ubuntu18.04':
         image = find_image(
             ec2resource,
--- a/contrib/automation/hgautomation/cli.py	Sun Sep 29 11:24:14 2019 -0700
+++ b/contrib/automation/hgautomation/cli.py	Sun Sep 29 11:29:25 2019 -0700
@@ -352,7 +352,7 @@
         '--distro',
         help='Linux distribution to run tests on',
         choices=linux.DISTROS,
-        default='debian9',
+        default='debian10',
     )
     sp.add_argument(
         '--filesystem',
--- a/contrib/automation/hgautomation/linux.py	Sun Sep 29 11:24:14 2019 -0700
+++ b/contrib/automation/hgautomation/linux.py	Sun Sep 29 11:29:25 2019 -0700
@@ -21,6 +21,7 @@
 # Linux distributions that are supported.
 DISTROS = {
     'debian9',
+    'debian10',
     'ubuntu18.04',
     'ubuntu19.04',
 }
@@ -190,14 +191,18 @@
 cat << EOF | sudo tee -a /etc/apt/sources.list
 # Need backports for clang-format-6.0
 deb http://deb.debian.org/debian stretch-backports main
+EOF
+fi
 
+if [ "$LSB_RELEASE" = "stretch" -o "$LSB_RELEASE" = "buster" ]; then
+cat << EOF | sudo tee -a /etc/apt/sources.list
 # Sources are useful if we want to compile things locally.
-deb-src http://deb.debian.org/debian stretch main
-deb-src http://security.debian.org/debian-security stretch/updates main
-deb-src http://deb.debian.org/debian stretch-updates main
-deb-src http://deb.debian.org/debian stretch-backports main
+deb-src http://deb.debian.org/debian $LSB_RELEASE main
+deb-src http://security.debian.org/debian-security $LSB_RELEASE/updates main
+deb-src http://deb.debian.org/debian $LSB_RELEASE-updates main
+deb-src http://deb.debian.org/debian $LSB_RELEASE-backports main
 
-deb [arch=amd64] https://download.docker.com/linux/debian stretch stable
+deb [arch=amd64] https://download.docker.com/linux/debian $LSB_RELEASE stable
 EOF
 
 elif [ "$DISTRO" = "Ubuntu" ]; then
@@ -279,8 +284,8 @@
     PACKAGES="$PACKAGES linux-tools-common"
 fi
 
-# Ubuntu 19.04 removes monotone.
-if [ "$LSB_RELEASE" != "disco" ]; then
+# Monotone only available in older releases.
+if [ "$LSB_RELEASE" = "stretch" -o "$LSB_RELEASE" = "xenial" ]; then
     PACKAGES="$PACKAGES monotone"
 fi