Closed jaimergp closed 3 months ago
This is a reproducer test with current conda and conda-build 24.3.0:
def test_conda_build_errors_without_conda_info_handlers(tmp_path, testing_workdir):
""
recipe = tmp_path / "meta.yaml"
recipe.write_text(
dedent(
"""
package:
name: pkg
version: '1.0'
build:
script: exit 1
"""
)
)
process = subprocess.run(["conda", "build", tmp_path], capture_output=True, text=True, check=False)
assert process.returncode > 0
all_output = process.stdout + "\n" + process.stderr
# These should NOT appear in the report
assert ">>> ERROR REPORT <<<" not in all_output
assert "An unexpected error has occurred." not in all_output
assert "Conda has prepared the above report." not in all_output
# These should appear
assert "CalledProcessError" in all_output
assert "returned non-zero exit status 1" in all_output
After looking into it, I see several ways forward:
conda.exceptions.CondaError
. This will involve a few changes all around the codebase.conda_build.exceptions.CondaBuildError
and then have the conda plugin system recognize that as a known exception type.Something like:
@conda.plugins.hookimpl
def conda_subcommands():
yield conda.plugins.CondaSubcommand(
name="build",
summary="Build conda packages from a conda recipe.",
action=build,
+ base_exception_class=CondaBuildError,
)
Then the plugin manager will be able to collect those and expose them to the exception handler so they can be checked before falling back to handler_unexpected_exception
.
WDYT @conda/conda-core?
Checklist
What happened?
Originally posted by @h-vetinari in https://github.com/conda-forge/conda-forge-ci-setup-feedstock/issues/296
After the switch to conda-build (in v4 of the ci setup), something that happens very regularly on feedstocks -- a failing build script -- will now (occasionally?) cause long error reports from conda, which make it more confusing where the error is coming from. Here's an example. Everything but the first and last two lines should not be there.
CC @jaimergp, who asked me to open this issue after it came up in discussion in last week's core call.
Conda Info
Conda Config
Conda list
Additional Context
@mbargull shared more details in the Element chat: