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

lhotari pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pulsar-site.git


The following commit(s) were added to refs/heads/main by this push:
     new 68df514b6f47 Make sync-team-js.sh work on the command line
68df514b6f47 is described below

commit 68df514b6f478bb4a7d255abc60f0baf88b60ff3
Author: Lari Hotari <[email protected]>
AuthorDate: Tue Mar 19 18:30:15 2024 +0200

    Make sync-team-js.sh work on the command line
---
 scripts/sync-team-js.sh | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/scripts/sync-team-js.sh b/scripts/sync-team-js.sh
index 98ef0765f887..9c045a17a620 100755
--- a/scripts/sync-team-js.sh
+++ b/scripts/sync-team-js.sh
@@ -1,11 +1,18 @@
 #!/bin/bash
 # This script is used to sync the team.js file with the Pulsar PMC and 
committers.
 # Usage:
-# 1. Log in to https://whimsy.apache.org/roster/committee/pulsar with browser
-# 2. Append ".json" to URL so that browser goes to 
https://whimsy.apache.org/roster/committee/pulsar.json
-# 3. Click "Save as..." and store the JSON as ~/Downloads/pulsar.json
-# 4. Run this script with "scripts/sync-team-js.sh"
-PULSAR_JSON="${1:-"$HOME/Downloads/pulsar.json"}"
+#  APACHE_USER=your-apache-id APACHE_PASSWORD='your-apache-password' 
./scripts/sync-team-js.sh
+# add a space as a prefix to the command so that your password doesn't get 
stored in your shell history
+if [ -z "$APACHE_USER" ] || [ -z "$APACHE_PASSWORD" ]; then
+  echo "Please set APACHE_USER and APACHE_PASSWORD environment variables"
+  exit 1
+fi
+COOKIES_FILE=$(mktemp /tmp/sync-team-js-cookies.XXXXXX)
+PULSAR_JSON=$(mktemp /tmp/sync-team-js-pulsar.XXXXXX)
+trap 'rm -f "$COOKIES_FILE" "$PULSAR_JSON"' EXIT
+# for some reason the cookies are needed from the first request
+curl -c "$COOKIES_FILE" -L -u "$APACHE_USER:$APACHE_PASSWORD" -X GET 
https://whimsy.apache.org/roster > /dev/null
+curl -b "$COOKIES_FILE" -L -u "$APACHE_USER:$APACHE_PASSWORD" -X GET 
https://whimsy.apache.org/roster/committee/pulsar.json > "$PULSAR_JSON"
 { 
   echo -n "module.exports = " && cat "$PULSAR_JSON" \
     | jq '{"pmc": [.roster| to_entries | sort_by(.key) | .[] | 
select(.value.role|startswith("PMC")) | {"name":.value.name, "apacheId": .key, 
"githubUsername": (.value.githubUsername|split(", "))}], "committers": 
[.roster| to_entries | sort_by(.key) | .[] | select(.value.role=="Committer") | 
{"name":.value.name, "apacheId": .key, "githubUsername": 
(.value.githubUsername|split(", "))}]}'

Reply via email to