Skip to content

Commit

Permalink
Merge pull request #1763 from jaimergp/fix-conda-build-error-handling
Browse files Browse the repository at this point in the history
Windows: Catch all non-zero exit codes (negative values too)
  • Loading branch information
xhochy authored Sep 19, 2023
2 parents 753143e + 62ff6ab commit 9395c07
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 8 deletions.
16 changes: 8 additions & 8 deletions conda_smithy/templates/run_win_build.bat.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,25 @@ call activate base
:: Provision the necessary dependencies to build the recipe later
echo Installing dependencies
{{ conda_install_tool }}.exe install "python=3.10" pip {{ conda_install_tool_deps }} {{ conda_build_tool_deps }} {{ " ".join(remote_ci_setup) }} -c conda-forge --strict-channel-priority --yes
if errorlevel 1 exit 1
if !errorlevel! neq 0 exit /b !errorlevel!

{%- if local_ci_setup %}
echo Overriding conda-forge-ci-setup with local version
{{ conda_install_tool }}.exe uninstall --quiet --yes --force {{ " ".join(remote_ci_setup) }}"
if errorlevel 1 exit 1
if !errorlevel! neq 0 exit /b !errorlevel!
pip install --no-deps ".\{{ recipe_dir }}\."
if errorlevel 1 exit 1
if !errorlevel! neq 0 exit /b !errorlevel!
{%- endif %}

:: Set basic configuration
echo Setting up configuration
setup_conda_rc .\ ".\{{ recipe_dir }}" .\.ci_support\%CONFIG%.yaml
if errorlevel 1 exit 1
if !errorlevel! neq 0 exit /b !errorlevel!

{%- if build_setup %}
echo Running build setup
{{ build_setup }}
if errorlevel 1 exit 1
if !errorlevel! neq 0 exit /b !errorlevel!
{%- endif %}

if EXIST LICENSE.txt (
Expand Down Expand Up @@ -68,7 +68,7 @@ conda.exe build "{{ recipe_dir }}" -m .ci_support\%CONFIG%.yaml --suppress-varia
{%- elif conda_build_tool == "conda-build" %}
conda.exe build "{{ recipe_dir }}" -m .ci_support\%CONFIG%.yaml --suppress-variables %EXTRA_CB_OPTIONS%
{%- endif %}
if errorlevel 1 exit 1
if !errorlevel! neq 0 exit /b !errorlevel!

:: Prepare some environment variables for the upload step
if /i "%CI%" == "github_actions" (
Expand Down Expand Up @@ -100,7 +100,7 @@ set "UPLOAD_ON_BRANCH={{ upload_on_branch }}"
{%- if conda_forge_output_validation %}
call :start_group "Validating outputs"
validate_recipe_outputs "%FEEDSTOCK_NAME%"
if errorlevel 1 exit 1
if !errorlevel! neq 0 exit /b !errorlevel!
call :end_group
{%- endif %}

Expand All @@ -110,7 +110,7 @@ if /i "%UPLOAD_PACKAGES%" == "true" (
if not exist "%TEMP%\" md "%TEMP%"
set "TMP=%TEMP%"
upload_package {% if conda_forge_output_validation %}--validate --feedstock-name="%FEEDSTOCK_NAME%"{% endif %}{% if private_upload %} --private{% endif %} .\ ".\{{ recipe_dir }}" .ci_support\%CONFIG%.yaml
if errorlevel 1 exit 1
if !errorlevel! neq 0 exit /b !errorlevel!
call :end_group
)
)
Expand Down
23 changes: 23 additions & 0 deletions news/1763-catch-negative-exit-code
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
**Added:**

* <news item>

**Changed:**

* <news item>

**Deprecated:**

* <news item>

**Removed:**

* <news item>

**Fixed:**

* Catch negative exit codes on Windows. (#1763)

**Security:**

* <news item>

0 comments on commit 9395c07

Please sign in to comment.