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

sbp pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-releases.git


The following commit(s) were added to refs/heads/main by this push:
     new ffc0c99  Improve the Bootstrap build process
ffc0c99 is described below

commit ffc0c99eee142e21fe73b927dab96041cfd6189c
Author: Sean B. Palmer <[email protected]>
AuthorDate: Mon Dec 15 20:35:34 2025 +0000

    Improve the Bootstrap build process
---
 .gitignore                              |  2 +
 Makefile                                | 23 ++++++++--
 bootstrap/context/.npmrc                |  4 ++
 bootstrap/context/Dockerfile            | 24 +++++++++++
 bootstrap/context/build.sh              | 75 +++++++++++++++++++++++++++++++++
 bootstrap/context/bump.sh               | 47 +++++++++++++++++++++
 bootstrap/make.sh                       | 26 ------------
 bootstrap/{ => source}/custom.scss      |  0
 bootstrap/{ => source}/reboot-shim.scss |  0
 9 files changed, 171 insertions(+), 30 deletions(-)

diff --git a/.gitignore b/.gitignore
index f2a2641..7518006 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,6 +12,8 @@ __pycache__/
 apptoken.txt
 atr/_version.py
 bootstrap/build/
+bootstrap/source/css/
+bootstrap/source/scss/
 dev/
 /docs/
 node_modules/
diff --git a/Makefile b/Makefile
index b57090b..1c3beed 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
-.PHONY: build build-alpine build-playwright build-ts build-ubuntu certs \
-  check check-extra check-light commit docs generate-version ipython \
-  manual run-alpine run-playwright run-playwright-slow serve serve-local \
-  sync sync-all update-deps
+.PHONY: build build-alpine build-bootstrap build-playwright build-ts \
+  build-ubuntu bump-bootstrap certs check check-extra check-light commit \
+  docs generate-version ipython manual run-alpine run-playwright \
+  run-playwright-slow serve serve-local sync sync-all update-deps
 
 BIND ?= 127.0.0.1:8080
 IMAGE ?= tooling-trusted-release
@@ -11,6 +11,13 @@ build: build-alpine
 build-alpine:
        scripts/build Dockerfile.alpine $(IMAGE)
 
+build-bootstrap:
+       docker build -t atr-bootstrap bootstrap/context
+       docker run --rm \
+         -v "$$PWD/bootstrap/source:/opt/bootstrap/source" \
+         -v "$$PWD/atr/static:/run/bootstrap-output" \
+         atr-bootstrap
+
 build-playwright:
        docker build -t atr-playwright -f tests/Dockerfile.playwright playwright
 
@@ -20,6 +27,14 @@ build-ts:
 build-ubuntu:
        scripts/build Dockerfile.ubuntu $(IMAGE)
 
+bump-bootstrap:
+       @test -n "$(BOOTSTRAP_VERSION)" \
+         || { echo "usage: make bump-bootstrap BOOTSTRAP_VERSION=X.Y.Z"; exit 
1; }
+       docker build -t atr-bootstrap bootstrap/context
+       docker run --rm \
+         -v "$$PWD/bootstrap/source:/opt/bootstrap/source" \
+         atr-bootstrap /opt/bootstrap/bump.sh $(BOOTSTRAP_VERSION)
+
 certs:
        if test ! -f state/cert.pem || test ! -f state/key.pem; \
        then uv run scripts/generate-certificates; \
diff --git a/bootstrap/context/.npmrc b/bootstrap/context/.npmrc
new file mode 100644
index 0000000..6e81516
--- /dev/null
+++ b/bootstrap/context/.npmrc
@@ -0,0 +1,4 @@
+ignore-scripts=true
+fund=false
+save-exact=true
+save-prefix=''
diff --git a/bootstrap/context/Dockerfile b/bootstrap/context/Dockerfile
new file mode 100644
index 0000000..61638a1
--- /dev/null
+++ b/bootstrap/context/Dockerfile
@@ -0,0 +1,24 @@
+FROM alpine:3.23.0
+
+RUN apk add --no-cache npm \
+  && apk add --no-cache \
+       --repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing \
+       dart-sass
+
+RUN adduser -D -h /home/build build
+
+WORKDIR /opt/bootstrap
+
+COPY .npmrc /opt/bootstrap/.npmrc
+COPY build.sh /opt/bootstrap/build.sh
+COPY bump.sh /opt/bootstrap/bump.sh
+
+RUN chmod +x /opt/bootstrap/build.sh /opt/bootstrap/bump.sh
+RUN chown -R build:build /opt/bootstrap
+
+USER build
+
+ENV HOME=/opt/bootstrap
+ENV NPM_CONFIG_USERCONFIG=/opt/bootstrap/.npmrc
+
+CMD ["/opt/bootstrap/build.sh"]
diff --git a/bootstrap/context/build.sh b/bootstrap/context/build.sh
new file mode 100755
index 0000000..18f4b0e
--- /dev/null
+++ b/bootstrap/context/build.sh
@@ -0,0 +1,75 @@
+#!/bin/sh
+set -eux
+
+SOURCE="${SOURCE:-/opt/bootstrap/source}"
+OUTPUT="${OUTPUT:-/run/bootstrap-output}"
+
+cd "$SOURCE"
+
+if ! command -v npm >/dev/null 2>&1
+then
+  echo "error: npm not found" >&2
+  exit 1
+fi
+
+if ! command -v sass >/dev/null 2>&1
+then
+  echo "error: sass not found" >&2
+  exit 1
+fi
+
+if [ ! -f package.json ]
+then
+  echo "error: package.json not found" >&2
+  exit 1
+fi
+
+if [ ! -f package-lock.json ]
+then
+  echo "error: package-lock.json not found" >&2
+  exit 1
+fi
+
+if [ ! -d "$OUTPUT" ]
+then
+  echo "error: output directory not found at $OUTPUT" >&2
+  exit 1
+fi
+
+echo "Installing dependencies with npm ci..."
+npm ci
+
+echo "Checking for known vulnerabilities..."
+npm audit
+
+echo "Verifying registry signatures..."
+npm audit signatures
+
+echo "Setting up SCSS build..."
+mkdir -p scss css
+
+cp custom.scss scss/custom.scss
+cp reboot-shim.scss scss/reboot-shim.scss
+
+echo "Compiling SCSS to CSS..."
+sass -q scss/custom.scss css/custom.css
+
+echo "Processing output files..."
+mkdir -p "$OUTPUT/css" "$OUTPUT/js/min"
+
+sed 's/custom.css.map/bootstrap.custom.css.map/g' css/custom.css \
+  > "$OUTPUT/css/bootstrap.custom.css"
+
+sed 's/custom.css/bootstrap.custom.css/g' css/custom.css.map \
+  > "$OUTPUT/css/bootstrap.custom.css.map"
+
+cp node_modules/bootstrap/dist/js/bootstrap.bundle.min.js \
+  "$OUTPUT/js/min/bootstrap.bundle.min.js"
+
+cp node_modules/bootstrap/dist/js/bootstrap.bundle.min.js.map \
+  "$OUTPUT/js/min/bootstrap.bundle.min.js.map"
+
+echo "Cleaning up intermediate files..."
+rm -rf css node_modules scss
+
+echo "Bootstrap assets built successfully"
diff --git a/bootstrap/context/bump.sh b/bootstrap/context/bump.sh
new file mode 100755
index 0000000..30ef417
--- /dev/null
+++ b/bootstrap/context/bump.sh
@@ -0,0 +1,47 @@
+#!/bin/sh
+set -eux
+
+if [ $# -ne 1 ]
+then
+  echo "usage: bump.sh VERSION" >&2
+  echo "example: bump.sh 5.4.0" >&2
+  exit 1
+fi
+
+VERSION="$1"
+SOURCE="${SOURCE:-/opt/bootstrap/source}"
+
+cd "$SOURCE"
+
+if ! command -v npm >/dev/null 2>&1
+then
+  echo "error: npm not found" >&2
+  exit 1
+fi
+
+# Alternative: use Bootstrap publish date as cutoff
+# PUBLISH_DATE=$(npm view "bootstrap@$VERSION" time)
+# if [ -z "$PUBLISH_DATE" ]
+# then
+#   echo "error: could not determine publish date for bootstrap@$VERSION" >&2
+#   exit 1
+# fi
+# npm install "bootstrap@$VERSION" --before="$PUBLISH_DATE"
+
+SECONDS_AGO=$((14 * 24 * 60 * 60))
+CUTOFF=$(date -u -d "@$(($(date +%s) - SECONDS_AGO))" +%Y-%m-%dT%H:%M:%SZ)
+
+echo "Using 14-day cooldown: --before=$CUTOFF"
+
+rm -rf node_modules package-lock.json
+
+npm install "bootstrap@$VERSION" --before="$CUTOFF"
+
+echo "Checking for known vulnerabilities..."
+npm audit
+
+echo "Verifying registry signatures..."
+npm audit signatures
+
+echo "Bootstrap updated to version $VERSION"
+echo "Please commit the updated package.json and package-lock.json"
diff --git a/bootstrap/make.sh b/bootstrap/make.sh
deleted file mode 100755
index 7420e48..0000000
--- a/bootstrap/make.sh
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/sh
-set -eu
-
-if ! which npm
-then
-  echo requires npm
-  exit 1
-fi
-
-if ! which sass
-then
-  echo requires sass
-  exit 1
-fi
-
-test -d build || mkdir build
-cd build
-npm install bootstrap
-test -d scss || mkdir scss
-cp ../custom.scss scss/custom.scss
-cp ../reboot-shim.scss scss/reboot-shim.scss
-sass -q scss/custom.scss css/custom.css
-sed 's/custom.css.map/bootstrap.custom.css.map/g' css/custom.css > 
../../atr/static/css/bootstrap.custom.css
-sed 's/custom.css/bootstrap.custom.css/g' css/custom.css.map > 
../../atr/static/css/bootstrap.custom.css.map
-cp node_modules/bootstrap/dist/js/bootstrap.bundle.min.js 
../../atr/static/js/min/bootstrap.bundle.min.js
-cp node_modules/bootstrap/dist/js/bootstrap.bundle.min.js.map 
../../atr/static/js/min/bootstrap.bundle.min.js.map
diff --git a/bootstrap/custom.scss b/bootstrap/source/custom.scss
similarity index 100%
rename from bootstrap/custom.scss
rename to bootstrap/source/custom.scss
diff --git a/bootstrap/reboot-shim.scss b/bootstrap/source/reboot-shim.scss
similarity index 100%
rename from bootstrap/reboot-shim.scss
rename to bootstrap/source/reboot-shim.scss


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to