Merge branch '21521-aptly-flock'
[arvados-dev.git] / jenkins / run_upload_packages.py
index bc4f4ffc6ae11096fcb742333ab6aa9c077941a4..216b56b14958d10773ec74ad0b0f566b8beceb86 100755 (executable)
@@ -205,14 +205,17 @@ class DistroPackageSuite(PackageSuite):
 
 class DebianPackageSuite(DistroPackageSuite):
     APT_SCRIPT = """
+set -e
 cd "$1"; shift
 DISTNAME=$1; shift
+# aptly implements its own locking, but its wait strategy as of April 2024 is
+# not patient enough to accommodate multiple simultaneous uploads.
+APTLY_LOCK="${XDG_RUNTIME_DIR:-/tmp}/aptly-upload.lock"
+aptly() {
+  flock --wait=300 "$APTLY_LOCK" aptly "$@"
+}
 for package in "$@"; do
-  set +e
-  aptly repo search "$DISTNAME" "${package%.deb}" >/dev/null 2>&1
-  RET=$?
-  set -e
-  if [[ $RET -eq 0 ]]; then
+  if aptly repo search "$DISTNAME" "${package%.deb}" >/dev/null 2>&1; then
     echo "Not adding $package, it is already present in repo $DISTNAME"
     rm "$package"
   else
@@ -225,13 +228,12 @@ aptly publish update "$DISTNAME" filesystem:"${DISTNAME%-*}":
     def __init__(self, glob_root, rel_globs, target, ssh_host, ssh_opts, repo):
         super().__init__(glob_root, rel_globs, target, ssh_host, ssh_opts)
         self.TARGET_DISTNAMES = {
-            'debian8': 'jessie-'+repo,
-            'debian9': 'stretch-'+repo,
             'debian10': 'buster-'+repo,
-            'ubuntu1404': 'trusty-'+repo,
-            'ubuntu1604': 'xenial-'+repo,
+            'debian11': 'bullseye-'+repo,
+            'debian12': 'bookworm-'+repo,
             'ubuntu1804': 'bionic-'+repo,
             'ubuntu2004': 'focal-'+repo,
+            'ubuntu2204': 'jammy-'+repo,
             }
 
     def post_uploads(self, paths):
@@ -246,7 +248,7 @@ cd "$1"; shift
 REPODIR=$1; shift
 rpmsign --addsign "$@" </dev/null
 mv "$@" "$REPODIR"
-createrepo -c ~/.createrepo-cache --update "$REPODIR"
+createrepo_c -c ~/.createrepo-cache --update "$REPODIR"
 """
     REPO_ROOT = '/var/www/rpm.arvados.org/'
 
@@ -254,6 +256,7 @@ createrepo -c ~/.createrepo-cache --update "$REPODIR"
         super().__init__(glob_root, rel_globs, target, ssh_host, ssh_opts)
         self.TARGET_REPODIRS = {
             'centos7': 'CentOS/7/%s/x86_64/' % repo,
+            'rocky8': 'CentOS/8/%s/x86_64/' % repo,
         }
 
     def post_uploads(self, paths):
@@ -271,6 +274,7 @@ PACKAGE_SUITES = {
                             'sdk/python/dist/*.tar.gz',
                             'sdk/cwl/dist/*.tar.gz',
                             'services/fuse/dist/*.tar.gz',
+                            'tools/crunchstat-summary/dist/*.tar.gz',
                         ),
     'gems': _define_suite(GemPackageSuite,
                           'sdk/ruby/*.gem',
@@ -307,11 +311,14 @@ def parse_arguments(arguments):
     if args.workspace is None:
         parser.error("workspace not set from command line or environment")
 
-    for target in ['debian8', 'debian9', 'debian10', 'ubuntu1404', 'ubuntu1604', 'ubuntu1804', 'ubuntu2004']:
+    for target in [
+            'debian10', 'debian11', 'debian12',
+            'ubuntu1804', 'ubuntu2004', 'ubuntu2204',
+    ]:
         PACKAGE_SUITES[target] = _define_suite(
             DebianPackageSuite, os.path.join('packages', target, '*.deb'),
             target=target, repo=args.repo)
-    for target in ['centos7']:
+    for target in ['centos7', 'rocky8']:
         PACKAGE_SUITES[target] = _define_suite(
             RedHatPackageSuite, os.path.join('packages', target, '*.rpm'),
             target=target, repo=args.repo)