This is an automated email from the ASF dual-hosted git repository. radu pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/sling-tooling-release.git
commit e9f1f4c3b640fe70083b99659085de0c0b2f1541 Author: Radu Cotescu <[email protected]> AuthorDate: Mon Jan 28 17:10:44 2019 +0100 added a simple script to update the Apache Reporter service after a release --- update_reporter.config | 2 ++ update_reporter.sh | 45 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/update_reporter.config b/update_reporter.config new file mode 100644 index 0000000..9b3c689 --- /dev/null +++ b/update_reporter.config @@ -0,0 +1,2 @@ +APACHE_USER="<your user goes here>" +APACHE_PASSWORD="<your password goes here>" diff --git a/update_reporter.sh b/update_reporter.sh new file mode 100755 index 0000000..94bed0c --- /dev/null +++ b/update_reporter.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +function display_usage() { + echo "$0 <path_to_file_containing_release_names>" +} + +source update_reporter.config +if [[ -z "${APACHE_USER}" ]]; then + echo "Please set the APACHE_USER variable in the update_reporter.config file." + exit 1 +fi +if [[ -z "${APACHE_PASSWORD}" ]]; then + echo "Please set the APACHE_PASSWORD variable in the update_reporter.config file." + exit 1 +fi +if [[ -z "$1" ]]; then + echo "Please provide a file with the release names, one release name per line." + display_usage + exit 1 +fi +BASIC="$(echo -n "$APACHE_USER:$APACHE_PASSWORD" | base64)" +DATE="`date '+%Y-%m-%d'`" +EPOCH="`date '+%s'`" +while IFS='' read -r line || [[ -n "$line" ]]; do + release=${line// /+} + status=`curl -s -o /dev/null -w "%{http_code}" 'https://reporter.apache.org/addrelease.py' \ + -H 'Connection: keep-alive' \ + -H 'Cache-Control: max-age=0' \ + -H "Authorization: Basic ${BASIC}" \ + -H 'Origin: https://reporter.apache.org' \ + -H 'Upgrade-Insecure-Requests: 1' \ + -H 'Content-Type: application/x-www-form-urlencoded' \ + -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.20 Safari/537.36' \ + -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8' \ + -H 'Referer: https://reporter.apache.org/addrelease.html?sling' \ + -H 'Accept-Encoding: gzip, deflate, br' \ + --data "date=${EPOCH}&committee=sling&version=${release}&xdate=${DATE}" --compressed` + if [[ "$status" -ne 200 ]]; then + echo "Failed to update ${line}: got status code ${status}" + exit 1 + fi +done < "$1" + + +
