IGNITE-8172 Update Apache Ignite's release scripts to match new RPM and DEB build... ignite-2.5
authorIvanov Petr <pivanov@gridgain.com>
Mon, 21 May 2018 16:51:59 +0000 (19:51 +0300)
committerAndrey Gura <agura@apache.org>
Mon, 21 May 2018 16:51:59 +0000 (19:51 +0300)
Signed-off-by: Andrey Gura <agura@apache.org>
scripts/release_1[svn]move_artifacts.sh [deleted file]
scripts/release_1[svn]move_binaries.sh [new file with mode: 0644]
scripts/release_2[bintray]upload_packages.sh [new file with mode: 0644]
scripts/release_3[svn]deploy_docs_to_site.sh [moved from scripts/release_2[svn]deploy_docs_to_site.sh with 100% similarity]
scripts/release_4[git]create_release_tag.sh [moved from scripts/release_3[git]create_release_tag.sh with 100% similarity]
scripts/vote_3_step_1[packages]build.sh [new file with mode: 0644]
scripts/vote_3_step_1[rpm]create_repository.sh [deleted file]
scripts/vote_3_step_2[pgp]sign_artifacts.sh
scripts/vote_3_step_3[svn]deploy_artifacts.sh

diff --git a/scripts/release_1[svn]move_artifacts.sh b/scripts/release_1[svn]move_artifacts.sh
deleted file mode 100644 (file)
index 86e1ff4..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/usr/bin/env bash
-
-chmod +x release.properties
-. ./release.properties
-
-echo "Releasing ${ignite_version}${rc_name}"
-
-#uncomment subsequent line in case you want to remove incorrectly released vote
-#svn rm -m "Removing redundant Release" https://dist.apache.org/repos/dist/release/ignite/$ignite_version || true
-svn mv https://dist.apache.org/repos/dist/dev/ignite/${ignite_version}${rc_name} https://dist.apache.org/repos/dist/release/ignite/${ignite_version} -m "Release ${ignite_version}: Binaries"
-svn mv https://dist.apache.org/repos/dist/dev/ignite/rpm_${ignite_version}${rc_name} https://dist.apache.org/repos/dist/release/ignite/rpm -m "Release ${ignite_version}: RPMs"
-
-echo "Please check results..."
-
-echo " "
-echo "======================================================"
-echo "Artifacts should be moved to release repository"
-echo "Please check results at"
-echo "https://dist.apache.org/repos/dist/release/ignite/"
diff --git a/scripts/release_1[svn]move_binaries.sh b/scripts/release_1[svn]move_binaries.sh
new file mode 100644 (file)
index 0000000..1db1bcc
--- /dev/null
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+set -o nounset
+set -o errexit
+set -o pipefail
+set -o errtrace
+set -o functrace
+
+
+chmod +x release.properties
+. ./release.properties
+
+
+echo "# Releasing ${ignite_version}${rc_name} :: Binaries #"
+# Uncomment subsequent line in case you want to remove incorrectly released vote
+#svn rm -m "Removing redundant Release" https://dist.apache.org/repos/dist/release/ignite/$ignite_version || true
+svn mv https://dist.apache.org/repos/dist/dev/ignite/${ignite_version}${rc_name} \
+       https://dist.apache.org/repos/dist/release/ignite/${ignite_version} \
+    -m "Release ${ignite_version}: Binaries"
+echo
+
+
+#
+# Output result and notes
+#
+echo "========================================================="
+echo "Artifacts should be moved to Apache Ignite's release site"
+echo "Please check results at:"
+echo " * binaries: https://apache.org/dist/ignite/${ignite_version}"
+
diff --git a/scripts/release_2[bintray]upload_packages.sh b/scripts/release_2[bintray]upload_packages.sh
new file mode 100644 (file)
index 0000000..711f991
--- /dev/null
@@ -0,0 +1,150 @@
+#!/usr/bin/env bash
+set -o nounset
+set -o errexit
+set -o pipefail
+set -o errtrace
+set -o functrace
+
+
+chmod +x release.properties
+. ./release.properties
+
+
+AUTH=""    # Curl authentication string for accessing Bintray
+
+
+#
+# Function: Check whether target package at Bintray already exists and create new package definition by template if it does not
+#
+checkPackageExistance () {
+    repository="$1"
+    package_name="$2"
+    description="$3"
+
+    check_message="$(curl ${AUTH} -X GET https://api.bintray.com/packages/apache/${repository}/${package_name} 2>/dev/null)"
+    if [ "${check_message}" == "{\"message\":\"Package '${package_name}' was not found\"}" ]; then
+        echo -n "       Package '${package_name}' does not exist, creating... "
+        curl ${AUTH} \
+             -H "Content-Type: application/json" \
+                     -X POST "https://api.bintray.com/packages/apache/${repository}" \
+                     -d "{\"name\": \"${package_name}\",\"desc\": \"${description}\",\"labels\": [],\"licenses\": [\"Apache-2.0\"],\"custom_licenses\": [],\"vcs_url\": \"https://github.com/apache/ignite.git\",\"website_url\": \"https://ignite.apache.org\",\"issue_tracker_url\": \"https://issues/apache.org/jira/browse/IGNITE\",\"github_repo\": \"apache/ignite\",\"github_release_notes_file\": \"RELEASE_NOTES.txt\",\"public_download_numbers\": false,\"public_stats\": false}" 2>/dev/null | grep -q "\"name\":\"${package_name}\"" || { echo "ERROR"; exit 1; }
+        echo "Done"
+    else
+        echo "       Package '${package_name}' already exists, skipping package creation"
+    fi
+}
+
+
+#
+# Function: Upload target package to Bintary (version will be created automatically)
+#
+upload () {
+    repository="${1}"
+    package_name="${2}"
+    file="${3}"
+    path="${4:-}"
+    properties="${5:-};publish=1;override=1"
+
+    echo -n "       Uploading '${file}' to Bintray... "
+    curl -T ${file} ${AUTH} "https://api.bintray.com/content/apache/${repository}/${package_name}/${ignite_version}/${path}${file}${properties}" 2>/dev/null | grep -q '{"warn":"The target repository is configured to auto-sign, but the private key requires a passphrase and none was provided. No files will be signed"}' || { echo "ERROR"; exit 1; }
+    echo "Done"
+}
+
+
+echo "# Releasing ${ignite_version}${rc_name} :: Packages #"
+
+
+#
+# Get credentials for accessing Bintray RPM repository
+#
+i=1
+response=""
+while [ $i -le 3 -a "${response}" != "{\"message\":\"forbidden\"}" ]; do
+    echo "Please, enter credentials for accessing Bintray RPM repository"
+    read -p    "    Username: " user
+    read -s -p "    API key: "  key
+    AUTH="-u${user}:${key}"
+    response=$(curl ${AUTH} -X POST "https://api.bintray.com/usage/apache" 2>/dev/null)
+    i=$((i+1))
+    echo
+done
+if [ $i -gt 3 -a "${response}" != "{\"message\":\"forbidden\"}" ]; then
+    echo "[ERROR] Failed to get valid credentials for Bintray RPM repository"
+    exit 1
+else
+    echo "Successfully authenticated at Bintray"
+    echo
+fi
+
+
+#
+# Release RPM packages:
+#  * upload to Bintray
+#  * publish
+#
+echo "1. Moving RPM packages to Bintray"
+cd packaging/pkg
+for rpm in *.rpm; do
+    package_name=$(echo ${rpm} | \
+                       sed -r "s|(.*)-${ignite_version}.*|\1|")    # Get RPM package name
+    description=$(cat ../rpm/apache-ignite.spec | \
+                      grep -Pzo "(?s)\N*%description.*?%" | \
+                      tail -n +2 | \
+                      head -n -1 | \
+                      grep -v "^$" | \
+                      sed -r ':a;N;$!ba;s/\n/\ /g')                # Get RPM package description
+    repository="ignite-rpm"
+
+    echo "   ${rpm}"
+
+    checkPackageExistance "${repository}" "${package_name}" "${description}"
+    upload "${repository}" "${package_name}" "${rpm}"
+done
+echo
+cd ${OLDPWD}
+
+
+#
+# Release DEB packages:
+#  * upload to Bintray
+#  * publish
+#
+echo "2. Moving DEB packages to Bintray"
+cd packaging/pkg
+for deb in *.deb; do
+    package_name=$(echo ${deb} |\
+                       cut -f1 -d_)                    # Get DEB package name
+    description=$(cat ../deb/control | \
+                      grep -Pzo "(?s)\N*Description.*?Homepage" | \
+                      tail -n +2 | \
+                      head -n -1 | \
+                      sed -r 's|^\s+||' | \
+                      sed -r ':a;N;$!ba;s/\n/\ /g')    # Get DEB package description
+    repository="ignite-deb"
+    component="main"
+    path="pool/${component}/${deb:0:1}/"
+
+    echo "   ${deb}"
+
+    checkPackageExistance "${repository}" "${package_name}" "${description}"
+    upload "${repository}" "${package_name}" "${deb}" "${path}" ";deb_distribution=apache-ignite;deb_component=${component};deb_architecture=all"
+done
+
+
+#
+# Remove packages from DEV
+#
+echo "3. Removing packages from Apache Ignite's DEV site"
+svn del https://dist.apache.org/repos/dist/dev/ignite/packages_${ignite_version}${rc_name} -m "Release ${ignite_version}: Removed moved to Bintray packages"
+echo
+
+
+#
+# Output result and notes
+#
+echo "============================================"
+echo "Packages should be moved to Bintray"
+echo "Please check results at:"
+echo " * rpms: https://apache.org/dist/ignite/rpm/"
+echo " * debs: https://apache.org/dist/ignite/deb/"
+
diff --git a/scripts/vote_3_step_1[packages]build.sh b/scripts/vote_3_step_1[packages]build.sh
new file mode 100644 (file)
index 0000000..872f349
--- /dev/null
@@ -0,0 +1,47 @@
+#!/usr/bin/env bash
+set -o nounset
+set -o errexit
+set -o pipefail
+set -o errtrace
+set -o functrace
+
+
+chmod +x release.properties
+. ./release.properties
+
+
+#
+# Build RPM packages
+#
+if [ -d packaging ]; then
+       rm -rf packaging
+fi
+cp -rfv git/packaging ./
+cp -rfv svn/vote/apache-ignite-fabric-${ignite_version}-bin.zip packaging/
+bash packaging/package.sh --rpm
+
+
+#
+# Build DEB packages
+#
+bash packaging/package.sh --deb
+
+
+#
+# Sign RPM packages
+#
+rpm --define "_gpg_name $(gpg --list-keys | grep uid | sed -r 's|uid\ +(.*)|\1|')" --addsign packaging/*.rpm
+
+
+#
+# Sign DEB packages
+#
+dpkg-sig -k $(gpg --list-keys | grep "^pub" | head -1 | cut -f2 -d / | cut -f1 -d" ") --sign builder packaging/*.deb
+
+
+#
+# Prepare SVN import directory
+#
+mkdir -pv packaging/pkg
+mv -fv packaging/{*.rpm,*.deb} packaging/pkg
+
diff --git a/scripts/vote_3_step_1[rpm]create_repository.sh b/scripts/vote_3_step_1[rpm]create_repository.sh
deleted file mode 100644 (file)
index d284d56..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/usr/bin/env bash
-
-chmod +x release.properties
-. ./release.properties
-
-REPO_ROOT="rpm/$(echo ${ignite_version} | cut -f1 -d.).x"
-
-#
-# Install required packages if necessary
-#
-if [ ! -f /usr/bin/rpm -o \
-     ! -f /usr/bin/rpmsign -o \
-     ! -f /usr/bin/createrepo -o \
-     ! -f /usr/bin/gpg-connect-agent ]
-then
-    echo "# Installing requred packages #"
-    sudo apt-get update
-    sudo apt-get install rpm createrepo gnupg-agent --no-install-recommends -y
-fi
-echo
-
-#
-# Build package
-#
-echo "# Building RPM package #"
-if [ ! -f rpmbuild ]; then rm -rf rpmbuild; fi
-mkdir -pv rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
-cp -rfv git/packaging/rpm/* rpmbuild
-cp -rfv svn/vote/apache-ignite-fabric-${ignite_version}-bin.zip rpmbuild/SOURCES/apache-ignite.zip
-rpmbuild -bb --define "_topdir $(pwd)/rpmbuild" rpmbuild/SPECS/apache-ignite.spec
-echo
-
-#
-# Prepare repository root
-#
-echo "# Preparing repository root #"
-if [ ! -f rpm ]; then rm -rf rpm; fi
-mkdir -pv ${REPO_ROOT}
-mv -v rpmbuild/RPMS/noarch/*.rpm ${REPO_ROOT}
-echo
-
-#
-# Sign RPM
-#
-echo "# Signing RPM #"
-rpm --define "_gpg_name $(gpg --list-keys | grep uid | sed -r 's|uid\ +(.*)|\1|')" --addsign ${REPO_ROOT}/*.rpm
-echo
-
-#
-# Create repository layout
-#
-echo "# Creating repository layout #"
-CREATEREPO=createrepo
-grep -q "Microsoft" /proc/version && CREATEREPO="sudo ${CREATEREPO}"    # Detect Windows 10 WSL
-${CREATEREPO} -v -p -s sha512 --update ${REPO_ROOT}
-
index efda5ee..cba2772 100644 (file)
@@ -1,12 +1,22 @@
 #!/usr/bin/env bash
+set -o nounset
+set -o errexit
+set -o pipefail
+set -o errtrace
+set -o functrace
+
 
 now=$(date +'%H%M%S')
 logname="vote_3_${now}.log"
 
+
+#
+# Sign artifacts
+#
 echo "# Starting GPG Agent #"
 gpg-connect-agent /bye
 
-list=$({ find ./svn/vote -type f -name "*.zip"; find ./rpm -type f -name "*"; })
+list=$(find ./svn/vote -type f -name "*.zip")
 
 for file in $list
 do
@@ -26,9 +36,15 @@ done < ./${logname}
 
 echo ${result}
 
+
+#
+# Output result and notes
+#
 echo " "
-echo "=============================================="
+echo "==============================================="
 echo "Artifacts should be signed"
-echo "Please check results at ./svn/vote and ./rpm"
+echo "Please check results at ./svn/vote"
 echo "Each file should have corresponding *.asc file"
-
+echo
+echo "NOTE: Package files are not signed because they"
+echo "are meant to be stored in Bintray"
index 2662f46..7f48ecd 100644 (file)
@@ -1,19 +1,28 @@
 #!/usr/bin/env bash
+set -o nounset
+set -o errexit
+set -o pipefail
+set -o errtrace
+set -o functrace
+
 
 chmod +x release.properties
 . ./release.properties
 
-echo "RC ${ignite_version}${rc_name}"
 
-#uncomment subsequent line in case you want to remove incorrectly prepared RC
+echo "RC ${ignite_version}${rc_name}"
+# Uncomment subsequent line in case you want to remove incorrectly prepared RC
 #svn rm -m "Removing redundant Release" https://dist.apache.org/repos/dist/dev/ignite/$ignite_version$rc_name || true
 svn import svn/vote https://dist.apache.org/repos/dist/dev/ignite/$ignite_version$rc_name -m "New RC ${ignite_version}${rc_name}: Binaries"
-svn import rpm https://dist.apache.org/repos/dist/dev/ignite/rpm_$ignite_version$rc_name -m "New RC ${ignite_version}${rc_name}: RPMs"
+svn import packaging/pkg https://dist.apache.org/repos/dist/dev/ignite/packages_$ignite_version$rc_name -m "New RC ${ignite_version}${rc_name}: Packages"
 
-echo "Please check results..."
 
-echo " "
-echo "======================================================"
+#
+# Output result and notes
+#
+echo
+echo "============================================================================="
 echo "Artifacts should be moved to RC repository"
-echo "Please check results at"
-echo "https://dist.apache.org/repos/dist/dev/ignite/"
+echo "Please check results at:"
+echo " * binaries: https://dist.apache.org/repos/dist/dev/ignite/${ignite_version}${rc_name}"
+echo " * packages: https://dist.apache.org/repos/dist/dev/ignite/packages_${ignite_version}${rc_name}"