This is an automated email from the ASF dual-hosted git repository. vterentev pushed a commit to branch download-looks in repository https://gitbox.apache.org/repos/asf/beam.git
commit b1d6c22ab8d12619b698f1dfd397a5cf654b53cd Author: Vitaly Terentyev <[email protected]> AuthorDate: Tue Feb 10 16:26:40 2026 +0400 Download performance looks to static while building website --- website/build.gradle | 38 ++++++++++++++++++++++ website/www/site/data/performance.yaml | 1 + .../site/layouts/shortcodes/performance_looks.html | 21 ++++++------ 3 files changed, 50 insertions(+), 10 deletions(-) diff --git a/website/build.gradle b/website/build.gradle index 6aa88a2c7fe..4a1cc342e27 100644 --- a/website/build.gradle +++ b/website/build.gradle @@ -128,6 +128,43 @@ task setupDockerContainer(type: Exec) { """echo '[params]\n branch_repo = "${getBranchRepo()}"' > /tmp/_config_branch_repo.toml""" } +def performanceLooksOutDir = "$dockerSourceDir/site/static/images/performance/looks" + +task downloadPerformanceLooks(type: Exec) { + dependsOn setupDockerContainer + commandLine 'docker', 'exec', + "${->setupDockerContainer.containerId()}", '/bin/bash', '-c', + """ + set -u # fail-open, без -e + + SRC="gs://public_looker_explores_us_a3853f40" + OUT_DIR="${performanceLooksOutDir}" + + mkdir -p "\$OUT_DIR" + + echo "[performance_looks] Checking for updates in GCS..." + + if DRY_RUN_OUTPUT=\$(gsutil -m rsync -n -r "\$SRC" "\$OUT_DIR" 2>/dev/null); then + if [ -z "\$DRY_RUN_OUTPUT" ]; then + echo "[performance_looks] Looks already up to date, skipping download" + exit 0 + fi + else + echo "[performance_looks][WARNING] Dry-run rsync failed, skipping download" + exit 0 + fi + + echo "[performance_looks] Updates detected, syncing looks..." + + if gsutil -m rsync -r "\$SRC" "\$OUT_DIR"; then + echo "[performance_looks] Download completed successfully" + else + echo "[performance_looks][WARNING] Failed to sync looks from GCS" + echo "[performance_looks][WARNING] Website build will continue without updated images" + fi + """ +} + task stopAndRemoveDockerContainer(type: Exec) { commandLine 'docker', 'rm', '-f', "${->createDockerContainer.containerId()}" } @@ -147,6 +184,7 @@ def createBuildTask = { BuildTaskConfiguration config = it as BuildTaskConfiguration task "build${config.name}Website" (type:Exec) { dependsOn setupDockerContainer + dependsOn downloadPerformanceLooks finalizedBy stopAndRemoveDockerContainer def configs = "$dockerSourceDir/site/config.toml" diff --git a/website/www/site/data/performance.yaml b/website/www/site/data/performance.yaml index 17a6612160c..c388b501ea4 100644 --- a/website/www/site/data/performance.yaml +++ b/website/www/site/data/performance.yaml @@ -12,6 +12,7 @@ host: https://storage.googleapis.com path: public_looker_explores_us_a3853f40 +static_base: /images/performance/looks looks: bigquery: read: diff --git a/website/www/site/layouts/shortcodes/performance_looks.html b/website/www/site/layouts/shortcodes/performance_looks.html index 1a4f1d0a578..fc807fecf7f 100644 --- a/website/www/site/layouts/shortcodes/performance_looks.html +++ b/website/www/site/layouts/shortcodes/performance_looks.html @@ -11,20 +11,21 @@ limitations under the License. See accompanying LICENSE file. */}} <div> - {{ $host := .Site.Data.performance.host }} - {{ $path := .Site.Data.performance.path }} + {{ $staticBase := .Site.Data.performance.static_base | default "/images/performance/looks" }} {{ $looks := .Site.Data.performance.looks }} {{ $io := index $looks (.Get "io") }} {{ $rw := index $io (.Get "read_or_write") }} {{ $section := index $rw (.Get "section") }} - {{ range $section }} {{ $folder := index $rw "folder" }} - <h4>{{.title}}</h4> - <div class="performance"> - <img - src="{{$host}}/{{$path}}/{{$folder}}/{{.id}}.png" - alt="{{.title}}" - > - </div> + + {{ range $section }} + <h4>{{ .title }}</h4> + <div class="performance"> + <img + src="{{ $staticBase }}/{{ $folder }}/{{ .id }}.png" + alt="{{ .title }}" + loading="lazy" + > + </div> {{ end }} </div>
