]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-build.git/commitdiff
ceph-website-pr: Support '/' and '.' in branch names for website pr builds 2579/head
authorJoseph Mundackal <joseph.j.mundackal@gmail.com>
Tue, 12 May 2026 15:10:07 +0000 (11:10 -0400)
committerJoseph Mundackal <joseph.j.mundackal@gmail.com>
Tue, 12 May 2026 15:17:31 +0000 (11:17 -0400)
ceph-website-prs/build/build

index 85fb6086032c2884730e738bc0c61d94352eb3f0..eb6d494358909512728d43af7687bf41433122f1 100755 (executable)
@@ -4,6 +4,10 @@ set -ex
 env
 
 BRANCH=$(echo $GIT_BRANCH | sed 's:.*/::')
+if [ "$BRANCH" = "main" ]; then
+  echo "branch must not be named 'main', exiting"
+  exit 1
+fi
 
 set +e
 export NVM_DIR="$HOME/.nvm"
@@ -18,16 +22,14 @@ npm ci
 
 npm run build:development
 
-if [ "$BRANCH" = "main" ]; then
-  echo "branch must not be named 'main', exiting"
-  exit 1
-fi
+# This will support "/" and "." in branch names - specific usecase being depadabot branches
+OUTPUT_DIR=$(echo "$BRANCH" | tr '/.' '-')
 
-if [ ! -d /opt/www/${BRANCH} ]; then
-  mkdir -p /opt/www/${BRANCH}
+if [ ! -d /opt/www/${OUTPUT_DIR} ]; then
+  mkdir -p /opt/www/${OUTPUT_DIR}
 fi
 
-rsync -av --delete-after dist/ /opt/www/${BRANCH}/
+rsync -av --delete-after dist/ /opt/www/${OUTPUT_DIR}/
 
 echo "===== Begin pruning old builds ====="
 old_builds=$(find /opt/www/ -maxdepth 1 -not -path "/opt/www/main" -type d -mtime +90 | sed 's:.*/::')
@@ -42,4 +44,4 @@ echo "===== Done pruning old builds ====="
 # This just makes the last `echo` line not repeat
 { set +x; } 2>/dev/null
 
-echo "Success!  This site is available at https://${BRANCH}.ceph.io."
+echo "Success!  This site is available at https://${OUTPUT_DIR}.ceph.io."