You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2019/05/17 16:51:15 UTC

[mesos] 01/02: Updated bintray upload scripts to remove hard-coded accounts.

This is an automated email from the ASF dual-hosted git repository.

bennoe pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git

commit 35fa8420762f1e8cf8df211ddcdaa0cc77104bc2
Author: Benno Evers <be...@mesosphere.com>
AuthorDate: Fri May 17 11:24:23 2019 +0200

    Updated bintray upload scripts to remove hard-coded accounts.
    
    This updates the Jenkinsfile used in the ASF Jenkins as well
    as the associated upload script for bintray to make the
    used credential id configurable and to upload the built packages
    to the official `apache/mesos` bintray account.
    
    Review: https://reviews.apache.org/r/70573/
---
 support/packaging/Jenkinsfile | 10 +-------
 support/packaging/bintray.sh  | 54 ++++++++++++++++---------------------------
 2 files changed, 21 insertions(+), 43 deletions(-)

diff --git a/support/packaging/Jenkinsfile b/support/packaging/Jenkinsfile
index 7446b2b..d2b70ab 100644
--- a/support/packaging/Jenkinsfile
+++ b/support/packaging/Jenkinsfile
@@ -24,16 +24,8 @@ def dockerArgs() {
 }
 
 def uploadToBintray(def pattern) {
-  withCredentials([string(credentialsId: 'karya_bintray_credentials', variable: 'BINTRAY_CREDS')]) {
-    // Do not upload debug packages yet as they are larger than the max file
-    // upload size imposed by bintray for the mesos org (250 MB). Once the mesos
-    // repos are moved under the apache org, we'll probably be able to upload
-    // larger files. An alternative would be to split mesos package into smaller
-    // packages such as mesos-sched, mesos-modules, etc., and then have the
-    // mesos meta package declare a dependency on these sub packages. That way
-    // we can have much smaller debug files.
+  withCredentials([string(credentialsId: params.BINTRAY_CREDENTIALS_ID, variable: 'BINTRAY_CREDS')]) {
     sh 'find . -name ' + pattern ' | ' +
-       'grep -v debug | ' +
        'while read rpm ; do support/packaging/bintray.sh $rpm; done'
   }
 }
diff --git a/support/packaging/bintray.sh b/support/packaging/bintray.sh
index 4f1795f..c84ab97 100755
--- a/support/packaging/bintray.sh
+++ b/support/packaging/bintray.sh
@@ -4,34 +4,21 @@
 # The following environment variables must be set:
 #   BINTRAY_CREDS (In the form <username>:<api-key>)
 #   MESOS_TAG (1.4.0-rc1, 1.4.0, etc.)
-
-# The following default to "mesos" if not specified.
+#
+# The following default to "apache" if not specified.
 #   BINTRAY_ORG
+#
+# The following default to "mesos" if not specified.
 #   BINTRAY_PKG
+#   BINTRAY_REPO
 
 
-# Sample yum repo file:
-# #bintray-mesos-el - packages by mesos from Bintray
-# [bintray-mesos-el]
-# name=bintray-mesos-el
-# baseurl=https://dl.bintray.com/mesos/el/7/x86_64
-# gpgcheck=0
-# repo_gpgcheck=0
-# enabled=1
-#
-# #bintray-mesos-el-srpm - source rpm packages by mesos from Bintray
-# [bintray-mesos-el-srpm]
-# name=bintray-mesos-el-srpm
-# baseurl=https://dl.bintray.com/mesos/el/7/SRPMS
-# gpgcheck=0
-# repo_gpgcheck=0
-# enabled=1
-
 set -o errexit -o nounset
 
 API=https://api.bintray.com
 
-BINTRAY_ORG=${BINTRAY_ORG:-mesos}
+BINTRAY_ORG=${BINTRAY_ORG:-apache}
+BINTRAY_REPO=${BINTRAY_REPO:-mesos}
 BINTRAY_PKG=${BINTRAY_PKG:-mesos}
 
 PKG_PATH=$1
@@ -44,18 +31,15 @@ case "$PKG_FILENAME" in
   *-rc*)       REPO_SUFFIX="-testing" ;;
 esac
 
-REPO_BASE=""
-if [ "${PKG_PATH##*.}" = "rpm" ]; then
-  REPO="el${REPO_SUFFIX}"
-fi
-
 REPO_PATH=""
-case "$PKG_PATH" in
-  *.el7.src.rpm)    REPO_PATH=7/SRPMS ;;
-  *.el6.src.rpm)    REPO_PATH=6/SRPMS ;;
+case "$PKG_FILENAME" in
+  *.el7.src.rpm)    REPO_PATH=el7${REPO_SUFFIX}/SRPMS ;;
+  *.el6.src.rpm)    REPO_PATH=el6${REPO_SUFFIX}/SRPMS ;;
+
+  *.el7.x86_64.rpm) REPO_PATH=el7${REPO_SUFFIX}/x86_64 ;;
+  *.el6.x86_64.rpm) REPO_PATH=el6${REPO_SUFFIX}/x86_64 ;;
 
-  *.el7.x86_64.rpm) REPO_PATH=7/x86_64 ;;
-  *.el6.x86_64.rpm) REPO_PATH=6/x86_64 ;;
+  *) echo "Do not know how to handle file ${PKG_PATH}."; exit 1 ;;
 esac
 
 
@@ -63,7 +47,7 @@ esac
 # The following command is inspired from an example script provided by bintray:
 #  https://github.com/bintray/bintray-examples/blob/master/bash-example/pushToBintray.sh
 
-echo "Uploading ${PKG_FILENAME} to ${API}/content/${BINTRAY_ORG}/${REPO}/${REPO_PATH}/${PKG_FILENAME}..."
+echo "Uploading ${PKG_FILENAME} to ${API}/content/${BINTRAY_ORG}/${BINTRAY_REPO}/${REPO_PATH}/${PKG_FILENAME}..."
 
 result=$(curl                           \
   -u${BINTRAY_CREDS}                    \
@@ -74,10 +58,12 @@ result=$(curl                           \
   -T ${PKG_PATH}                        \
   -H X-Bintray-Package:${BINTRAY_PKG}   \
   -H X-Bintray-Version:${MESOS_VERSION} \
-  -H X-Bintray-Publish:1                \
-  ${API}/content/${BINTRAY_ORG}/${REPO}/${REPO_PATH}/${PKG_FILENAME})
+  -H X-Bintray-Publish:0                \
+  ${API}/content/${BINTRAY_ORG}/${BINTRAY_REPO}/${REPO_PATH}/${PKG_FILENAME})
 
 if [ $result -ne 201 ]; then
-  echo "Package ${PKG_FILENAME} upload to ${API}/content/${BINTRAY_ORG}/${REPO}/${REPO_PATH}/${PKG_FILENAME} failed with status ${result}"
+  echo "Package ${PKG_FILENAME} upload to ${API}/content/${BINTRAY_ORG}/${BINTRAY_REPO}/${REPO_PATH}/${PKG_FILENAME} failed with status ${result}"
   exit 1
+else
+  echo "Package ${PKG_FILEAME} uploaded successfully, don't forget to head over to bintray to publish the uploaded artifacts."
 fi