Do not try to add packages to the repository that are already in it.
authorWard Vandewege <ward@curii.com>
Wed, 23 Dec 2020 01:45:43 +0000 (20:45 -0500)
committerWard Vandewege <ward@curii.com>
Wed, 23 Dec 2020 01:45:43 +0000 (20:45 -0500)
refs #17218

Arvados-DCO-1.1-Signed-off-by: Ward Vandewege <ward@curii.com>

jenkins/run_upload_packages.py

index 41f0852854f3e137d9a1822bc752f74a683f3904..cc3217e2f1435571e6f4fdb7dca9dafa465d8c62 100755 (executable)
@@ -188,9 +188,17 @@ class DebianPackageSuite(DistroPackageSuite):
     FREIGHT_SCRIPT = """
 cd "$1"; shift
 DISTNAME=$1; shift
-aptly repo add "$DISTNAME" "$@"
-aptly publish update "$DISTNAME" filesystem:"${DISTNAME%-*}":
-rm "$@"
+set +e
+aptly repo search "$DISTNAME" "${@%.deb}" >/dev/null 2>&1
+RET=$?
+set -e
+if [[ $RET -eq 0 ]]; then
+  echo "Not adding $@, it is already present in repo $DISTNAME"
+  rm "$@"
+else
+  aptly repo add -remove-files "$DISTNAME" "$@"
+  aptly publish update "$DISTNAME" filesystem:"${DISTNAME%-*}":
+fi
 """
 
     def __init__(self, glob_root, rel_globs, target, ssh_host, ssh_opts, repo):