Skip to content

Commit a295d3d

Browse files
dmitriplotnikovcopybara-github
authored andcommitted
Fix release scripts for cel-python.
- In release_linux.sh, install git because it is needed to clone the repository but not present in the default ubuntu image. - In release_windows.bat, restructure SCM resolution to avoid using batch labels inside parenthesized if/else blocks, which causes "The system cannot find the batch label specified" errors. PiperOrigin-RevId: 937552241
1 parent ed5fb18 commit a295d3d

2 files changed

Lines changed: 44 additions & 35 deletions

File tree

release/kokoro/release_linux.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515

1616
set -e
1717

18-
if ! command -v pip3 &> /dev/null || ! command -v curl &> /dev/null || ! command -v docker &> /dev/null; then
18+
if ! command -v pip3 &> /dev/null || ! command -v curl &> /dev/null || ! command -v docker &> /dev/null || ! command -v git &> /dev/null; then
1919
echo "Installing basic dependencies..."
20-
apt-get update && apt-get install -y python3-pip curl
20+
apt-get update && apt-get install -y python3-pip curl git
2121

2222
if ! command -v docker &> /dev/null; then
2323
echo "Installing docker CLI..."

release/kokoro/release_windows.bat

Lines changed: 42 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -51,42 +51,51 @@ echo Created temporary directories: %REPO_DIR%, %TMP_DIR%
5151
mkdir "%TMP_DIR%"
5252

5353
echo --- Resolving Repository Source ---
54-
if "%DRY_RUN%" == "true" (
55-
echo [DRY RUN] Using local Kokoro clone instead of cloning main.
56-
set "SRC_DIR=%~dp0..\.."
57-
pushd "!SRC_DIR!"
58-
for /f "tokens=*" %%i in ('git tag --sort=-v:refname 2^>nul') do (
59-
set "VERSION=%%i"
60-
goto :got_local_tag
61-
)
62-
set "VERSION=0.1.2"
63-
:got_local_tag
54+
if "%DRY_RUN%" == "true" goto resolution_dry
55+
goto resolution_real
56+
57+
:resolution_dry
58+
echo [DRY RUN] Using local Kokoro clone instead of cloning main.
59+
set "SRC_DIR=%~dp0..\.."
60+
pushd "!SRC_DIR!"
61+
set "VERSION="
62+
for /f "tokens=*" %%i in ('git tag --sort=-v:refname 2^>nul') do (
63+
set "VERSION=%%i"
64+
goto got_local_tag
65+
)
66+
:got_local_tag
67+
if "%VERSION%" == "" set "VERSION=0.1.2"
68+
popd
69+
goto resolution_done
70+
71+
:resolution_real
72+
mkdir "%REPO_DIR%"
73+
pushd "%REPO_DIR%"
74+
git clone https://github.com/cel-expr/cel-python.git
75+
if !ERRORLEVEL! NEQ 0 (
76+
echo Failed to clone repository!
77+
set "RELEASE_STATUS=1"
6478
popd
65-
) else (
66-
mkdir "%REPO_DIR%"
67-
pushd "%REPO_DIR%"
68-
git clone https://github.com/cel-expr/cel-python.git
69-
if !ERRORLEVEL! NEQ 0 (
70-
echo Failed to clone repository!
71-
set "RELEASE_STATUS=1"
72-
popd
73-
goto cleanup
74-
)
75-
cd cel-python
76-
for /f "tokens=*" %%i in ('git tag --sort=-v:refname') do (
77-
set "VERSION=%%i"
78-
goto :got_tag
79-
)
80-
:got_tag
81-
if "%VERSION%" == "" (
82-
echo Failed to get version tag!
83-
set "RELEASE_STATUS=1"
84-
popd
85-
goto cleanup
86-
)
87-
set "SRC_DIR=%REPO_DIR%\cel-python"
79+
goto cleanup
80+
)
81+
cd cel-python
82+
set "VERSION="
83+
for /f "tokens=*" %%i in ('git tag --sort=-v:refname') do (
84+
set "VERSION=%%i"
85+
goto got_tag
86+
)
87+
:got_tag
88+
if "%VERSION%" == "" (
89+
echo Failed to get version tag!
90+
set "RELEASE_STATUS=1"
8891
popd
92+
goto cleanup
8993
)
94+
set "SRC_DIR=%REPO_DIR%\cel-python"
95+
popd
96+
goto resolution_done
97+
98+
:resolution_done
9099

91100
if "%VERSION:~0,1%" == "v" (
92101
set "VERSION=%VERSION:~1%"

0 commit comments

Comments
 (0)