2 # Copyright (C) The Arvados Authors. All rights reserved.
4 # SPDX-License-Identifier: AGPL-3.0
6 # This script publishes packages from our dev repo to the prod repo (#11572)
7 # Parameters: list of packages, space separated, to move from *-testing to *
8 # under /var/lib/freight/apt/ in host public.curoverse.com
10 APT_REPO_SERVER="apt.arvados.org"
11 RPM_REPO_SERVER="rpm.arvados.org"
17 # Convert package list into a regex for publising
18 # Make sure the variables are set or provide an example of how to use them
19 if [ -z "${PACKAGES_TO_PUBLISH}" ]; then
20 echo "You must provide a list of packages to publish, as obtained with https://dev.arvados.org/projects/ops/wiki/Updating_clusters#Gathering-package-versions."
23 if [ -z "${LSB_DISTRIB_CODENAMES}" ]; then
24 echo "You must provide a space-separated list of LSB distribution codenames to which you want to publish to, ie."
25 echo "* Debian: jessie, xenial, stretch, etc."
26 echo "* Centos: centos7 (the only one currently supported.)"
30 # Only numbered package versions are supposed to go into the stable repositories
31 TMP=$(echo "$PACKAGES_TO_PUBLISH" | sed 's/versions://g;')
32 VALIDATED_PACKAGES_TO_PUBLISH=`echo "$TMP" | sed -nE '/^.*: [0-9].[0-9].[0-9]-[0-9]$/p'`
34 if [[ "$TMP" != "$VALIDATED_PACKAGES_TO_PUBLISH" ]]; then
35 echo "The list of packages has invalid syntax. each line must be of the format:"
37 echo "packagename: [0-9].[0-9].[0-9]-[0-9]"
42 # Sanitize the vars in a way suitable to be used by the remote 'publish_packages.sh' script
43 # Just to make copying a single line, and not having to loop over it
44 PACKAGES_LIST=$(echo ${PACKAGES_TO_PUBLISH} | sed 's/versions://g; s/\([a-z-]*\):[[:blank:]]*\([0-9.-]*\)/\1*\2*,/g; s/[[:blank:]]//g; s/,$//g;')
46 DISTROS=$(echo "${LSB_DISTRIB_CODENAMES}"|sed s/[[:space:]]/,/g |tr '[:upper:]' '[:lower:]')
48 if ( echo ${LSB_DISTRIB_CODENAMES} |grep -q centos ); then
49 REPO_SERVER=${RPM_REPO_SERVER}
51 REPO_SERVER=${APT_REPO_SERVER}
54 REMOTE_CMD="/usr/local/bin/testing_to_stable_publish_packages.sh --distros ${DISTROS} --packages ${PACKAGES_LIST}"
56 # Now we execute it remotely
62 -o "StrictHostKeyChecking no" \
63 -o "ConnectTimeout 5" \
65 "${REMOTE_CMD}" | tee ${TMP_FILE}
68 grep -q "FAILED TO PUBLISH" ${TMP_FILE}