1+ @ echo off
2+ setlocal EnableExtensions EnableDelayedExpansion
3+
4+ REM This script runs from outside the repo to avoid being deleted by git clean
5+
6+ REM set "REPO_ROOT=C:\Users\msmik\Documents\src\catalog-service-node"
7+ REM "SCRIPT_DIR=%REPO_ROOT%\demo\sdlc-e2e"
8+ REM cd /d "%REPO_ROOT%"
9+
10+ for /f " usebackq delims=" %%I in (`powershell -NoProfile -Command " (Get-Date).ToString('yyyyMMdd')" `) do set " DATE_STAMP = %%I "
11+ for /f " usebackq delims=" %%I in (`powershell -NoProfile -Command " $env:USERNAME.ToLower()" `) do set " SAFE_USER = %%I "
12+ set " BRANCH_NAME = demo-%DATE_STAMP% -%SAFE_USER% "
13+
14+
15+
16+ echo ==> Setting up branch a demo branch named %BRANCH_NAME%
17+ git clean -f
18+ git branch -D temp 2 > nul || echo .
19+ git branch -D %BRANCH_NAME% 2 > nul || echo .
20+ git checkout -b temp
21+ git branch -D main 2 > nul || echo .
22+ git checkout main
23+ git branch -D temp 2 > nul || echo .
24+ git pull
25+ git checkout -b %BRANCH_NAME%
26+
27+ echo ==> Applying patch and creating a commit
28+ powershell -NoProfile -Command " (Get-Content '%SCRIPT_DIR% \demo.patch' -Raw) -replace '`n', \" `r`n\" | Set-Content '%TEMP% \demo-windows.patch' -NoNewline"
29+ git apply --whitespace=fix " %TEMP% \demo-windows.patch"
30+ del " %TEMP% \demo-windows.patch" 2 > nul
31+ git commit -am " Demo prep"
32+
33+ echo ==> Installing npm dependencies
34+ call npm install
35+ echo ==> npm install completed
36+
37+ echo ==> Downloading container images
38+ docker compose pull
39+
40+ echo ==> Deleting postgres:17.2 container image
41+ docker image rm postgres:17.2 2 > nul || echo .
42+
43+ echo ==> Configuring DBC (if this fails, ask to be added to the dockerdevrel organization)
44+ docker buildx create --driver cloud dockerdevrel/demo-builder 2 > nul || echo .
45+ docker buildx use cloud-dockerdevrel-demo-builder
46+
47+ echo ==> Configuring Scout
48+ docker scout config organization dockerdevrel
49+
50+ echo ==> Setup complete!
0 commit comments