Skip to content

Commit 3469581

Browse files
authored
chore(workflow): sync docsearch preview full workflow (#678)
1 parent 1602c6a commit 3469581

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

.github/workflows/docsearch-all-stable-full-preview.yml

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ on:
1717
- both
1818
- en
1919
- zh
20-
preview_runlist:
21-
description: 'Preview runlist file under all-stable/configs'
20+
preview_sitemap_url:
21+
description: 'Preview sitemap index URL'
2222
required: true
23-
default: runlist-preview-full.json
23+
default: 'https://docs.tidb.io/sitemap/sitemap-index.xml'
2424
type: string
2525
scraper_repo:
2626
description: 'Docsearch-scraper repo used to patch workflow image'
@@ -69,10 +69,10 @@ jobs:
6969
export CRAWL_LANG="${{ inputs.language }}"
7070
PREVIEW_BASE_URL="${{ inputs.preview_base_url }}"
7171
export CRAWL_LOCAL_URL="${PREVIEW_BASE_URL%/}/"
72-
export PREVIEW_RUNLIST_FILE="${{ inputs.preview_runlist }}"
72+
export PREVIEW_SITEMAP_URL="${{ inputs.preview_sitemap_url }}"
7373
7474
echo "Run preview full prewarm against: $CRAWL_LOCAL_URL"
75-
echo "Use preview runlist file: $PREVIEW_RUNLIST_FILE"
75+
echo "Use preview sitemap URL: $PREVIEW_SITEMAP_URL"
7676
7777
preview_home_status="$(curl -sS -o /dev/null -w "%{http_code}" "$CRAWL_LOCAL_URL")"
7878
if [ "$preview_home_status" != "200" ]; then
@@ -85,6 +85,19 @@ jobs:
8585
exit 1
8686
fi
8787
88+
preview_sitemap_probe="$(curl -sS -L -o /dev/null -w "%{http_code} %{url_effective}" "$PREVIEW_SITEMAP_URL")"
89+
preview_sitemap_status="${preview_sitemap_probe%% *}"
90+
preview_sitemap_effective_url="${preview_sitemap_probe#* }"
91+
if [ "$preview_sitemap_status" != "200" ]; then
92+
echo "Preview sitemap probe failed: $PREVIEW_SITEMAP_URL (status=$preview_sitemap_status, effective=$preview_sitemap_effective_url)"
93+
exit 1
94+
fi
95+
96+
if ! curl -sS -L "$PREVIEW_SITEMAP_URL" | grep -Eqi '<(urlset|sitemapindex)'; then
97+
echo "Preview sitemap does not look like XML sitemap: $PREVIEW_SITEMAP_URL"
98+
exit 1
99+
fi
100+
88101
export BASE_DOCKER_REGISTRY="${{ secrets.DOCKER_REGISTRY }}"
89102
export PATCH_SCRAPER_REPO="${{ inputs.scraper_repo }}"
90103
export PATCH_SCRAPER_REF="${{ inputs.scraper_ref }}"
@@ -94,9 +107,8 @@ jobs:
94107
./all-stable/scripts/prepare-patched-scraper-image.sh "$(pwd)/all-stable"
95108
. "$PATCH_IMAGE_ENV_FILE"
96109
export DOCKER_REGISTRY="$PATCHED_DOCKER_REGISTRY"
97-
export ENABLE_CONTAINER_SOURCE_PROBE=true
98110
99111
echo "Run preview full prewarm with patched image: $PATCHED_SCRAPER_IMAGE"
100-
./all-stable/scripts/crawl-preview-full.sh "$(pwd)/all-stable" 2>&1 | tee /tmp/docsearch-all-stable-full-preview.log
112+
./all-stable/scripts/crawl-full-preview.sh "$(pwd)/all-stable" 2>&1 | tee /tmp/docsearch-all-stable-full-preview.log
101113
102114
./all-stable/scripts/check-crawl-errors.sh /tmp/docsearch-all-stable-full-preview.log

0 commit comments

Comments
 (0)