← Back to issue list

dotnet-v2 plugin integration tests fail on arm64

View original Github issue

Metadata

Project
craft-parts
Number
#1282
Type
issue
State
open
Author
lengau
Labels
Type: Bug
Created
2025-09-10 04:42:11+00:00
Updated
2025-09-10 04:43:55+00:00
Closed

Current evaluation

No evaluation has been recorded for this issue yet.

Issue body

### Bug Description The integration tests for the dotnet v2 plugin are failing on arm64 ### To Reproduce https://github.com/canonical/craft-parts/actions/runs/17603137845/job/50008812681?pr=1277 ### part yaml ```shell ``` ### Relevant log output ```shell ______________________________ test_dotnet_plugin ______________________________ self = <craft_parts.plugins.dotnet_v2_plugin.DotnetV2PluginEnvironmentValidator object at 0xffc128dae4e0> dependency = 'dotnet', plugin_name = 'dotnet', part_dependencies = None argument = '--version' def validate_dependency( self, dependency: str, plugin_name: str, part_dependencies: list[str] | None, argument: str = "--version", ) -> str: """Validate that the environment has a required dependency. `<dependency-name> --version` is executed to confirm the dependency is valid. :param dependency: name of the dependency to validate. :param plugin_name: used to generate the part name that would satisfy the dependency. :param part_dependencies: A list of the parts this part depends on. :param argument: argument to call with the dependency. Default is `--version`. :raises PluginEnvironmentValidationError: If the environment is invalid. :return: output from executed dependency """ try: command = f"{dependency} {argument}" > output = self._execute(command).strip() ^^^^^^^^^^^^^^^^^^^^^^ /home/runner/work/craft-parts/craft-parts/craft_parts/plugins/validator.py:101: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /home/runner/work/craft-parts/craft-parts/craft_parts/plugins/validator.py:145: in _execute proc = subprocess.run( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ input = None, capture_output = True, timeout = None, check = True popenargs = (['/bin/bash', '/tmp/tmp7p79qoq0'],) kwargs = {'stderr': -1, 'stdout': -1, 'text': True} process = <Popen: returncode: 126 args: ['/bin/bash', '/tmp/tmp7p79qoq0']> stdout = '' stderr = '/tmp/tmp7p79qoq0: line 26: /tmp/pytest-of-runner/pytest-0/test_dotnet_plugin0/stage/sdk/dotnet: cannot execute binary file: Exec format error\n' retcode = 126 def run(*popenargs, input=None, capture_output=False, timeout=None, check=False, **kwargs): """Run command with arguments and return a CompletedProcess instance. The returned instance will have attributes args, returncode, stdout and stderr. By default, stdout and stderr are not captured, and those attributes will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them, or pass capture_output=True to capture both. If check is True and the exit code was non-zero, it raises a CalledProcessError. The CalledProcessError object will have the return code in the returncode attribute, and output & stderr attributes if those streams were captured. If timeout is given, and the process takes too long, a TimeoutExpired exception will be raised. There is an optional argument "input", allowing you to pass bytes or a string to the subprocess's stdin. If you use this argument you may not also use the Popen constructor's "stdin" argument, as it will be used internally. By default, all communication is in bytes, and therefore any "input" should be bytes, and the stdout and stderr will be bytes. If in text mode, any "input" should be a string, and stdout and stderr will be strings decoded according to locale encoding, or by "encoding" if set. Text mode is triggered by setting any of text, encoding, errors or universal_newlines. The other arguments are the same as for the Popen constructor. """ if input is not None: if kwargs.get('stdin') is not None: raise ValueError('stdin and input arguments may not both be used.') kwargs['stdin'] = PIPE if capture_output: if kwargs.get('stdout') is not None or kwargs.get('stderr') is not None: raise ValueError('stdout and stderr arguments may not be used ' 'with capture_output.') kwargs['stdout'] = PIPE kwargs['stderr'] = PIPE with Popen(*popenargs, **kwargs) as process: try: stdout, stderr = process.communicate(input, timeout=timeout) except TimeoutExpired as exc: process.kill() if _mswindows: # Windows accumulates the output in a single blocking # read() call run on child threads, with the timeout # being done in a join() on those threads. communicate() # _after_ kill() is required to collect that and add it # to the exception. exc.stdout, exc.stderr = process.communicate() else: # POSIX _communicate already populated the output so # far into the TimeoutExpired exception. process.wait() raise except: # Including KeyboardInterrupt, communicate handled that. process.kill() # We don't call process.wait() as .__exit__ does that for us. raise retcode = process.poll() if check and retcode: > raise CalledProcessError(retcode, process.args, output=stdout, stderr=stderr) E subprocess.CalledProcessError: Command '['/bin/bash', '/tmp/tmp7p79qoq0']' returned non-zero exit status 126. /usr/lib/python3.12/subprocess.py:571: CalledProcessError The above exception was the direct cause of the following exception: new_dir = local('/tmp/pytest-of-runner/pytest-0/test_dotnet_plugin0') partitions = None @pytest.mark.plugin def test_dotnet_plugin(new_dir, partitions): project_path = Path(__file__).parent / "test_dotnet_v2" with open(project_path / "parts.yaml") as file: # noqa: PTH123 parts = yaml.safe_load(file) parts["parts"]["foo"]["source"] = str(project_path) plugins.unregister("dotnet") plugins.register({"dotnet": dotnet_v2_plugin.DotnetV2Plugin}) lf = LifecycleManager( parts, application_name="test_dotnet_v2", cache_dir=new_dir, partitions=partitions, ) actions = lf.plan(Step.PRIME) with lf.action_executor() as ctx: > ctx.execute(actions) /home/runner/work/craft-parts/craft-parts/tests/integration/plugins/test_dotnet_v2.py:46: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /home/runner/work/craft-parts/craft-parts/craft_parts/executor/executor.py:342: in execute self._executor.execute(actions, stdout=stdout, stderr=stderr) /home/runner/work/craft-parts/craft-parts/craft_parts/executor/executor.py:136: in execute self._run_action(act, stdout=stdout, stderr=stderr) /home/runner/work/craft-parts/craft-parts/craft_parts/executor/executor.py:229: in _run_action handler.run_action(action, stdout=stdout, stderr=stderr) /home/runner/work/craft-parts/craft-parts/craft_parts/executor/part_handler.py:309: in run_action state = handler(step_info, stdout=stdout, stderr=stderr) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ /home/runner/work/craft-parts/craft-parts/craft_parts/executor/part_handler.py:457: in _run_build self._run_step( /home/runner/work/craft-parts/craft-parts/craft_parts/executor/part_handler.py:651: in _run_step validator.validate_environment() /home/runner/work/craft-parts/craft-parts/craft_parts/plugins/dotnet_v2_plugin.py:135: in validate_environment self.validate_dependency( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <craft_parts.plugins.dotnet_v2_plugin.DotnetV2PluginEnvironmentValidator object at 0xffc128dae4e0> dependency = 'dotnet', plugin_name = 'dotnet', part_dependencies = None argument = '--version' def validate_dependency( self, dependency: str, plugin_name: str, part_dependencies: list[str] | None, argument: str = "--version", ) -> str: """Validate that the environment has a required dependency. `<dependency-name> --version` is executed to confirm the dependency is valid. :param dependency: name of the dependency to validate. :param plugin_name: used to generate the part name that would satisfy the dependency. :param part_dependencies: A list of the parts this part depends on. :param argument: argument to call with the dependency. Default is `--version`. :raises PluginEnvironmentValidationError: If the environment is invalid. :return: output from executed dependency """ try: command = f"{dependency} {argument}" output = self._execute(command).strip() logger.debug("executed %s with output %s", command, output) except subprocess.CalledProcessError as err: if err.returncode != COMMAND_NOT_FOUND: > raise errors.PluginEnvironmentValidationError( part_name=self._part_name, reason=f"{dependency!r} failed with error code {err.returncode}", ) from err E craft_parts.errors.PluginEnvironmentValidationError: Environment validation failed for part 'foo': 'dotnet' failed with error code 126. /home/runner/work/craft-parts/craft-parts/craft_parts/plugins/validator.py:105: PluginEnvironmentValidationError ----------------------------- Captured stderr call ----------------------------- + cp --archive --link --no-dereference . /tmp/pytest-of-runner/pytest-0/test_dotnet_plugin0/parts/dotnet-deps/install/sdk _________________________ test_dotnet_plugin_no_dotnet _________________________ self = <craft_parts.plugins.dotnet_v2_plugin.DotnetV2PluginEnvironmentValidator object at 0xffc12b3b0d70> dependency = 'dotnet', plugin_name = 'dotnet', part_dependencies = None argument = '--version' def validate_dependency( self, dependency: str, plugin_name: str, part_dependencies: list[str] | None, argument: str = "--version", ) -> str: """Validate that the environment has a required dependency. `<dependency-name> --version` is executed to confirm the dependency is valid. :param dependency: name of the dependency to validate. :param plugin_name: used to generate the part name that would satisfy the dependency. :param part_dependencies: A list of the parts this part depends on. :param argument: argument to call with the dependency. Default is `--version`. :raises PluginEnvironmentValidationError: If the environment is invalid. :return: output from executed dependency """ try: command = f"{dependency} {argument}" > output = self._execute(command).strip() ^^^^^^^^^^^^^^^^^^^^^^ /home/runner/work/craft-parts/craft-parts/craft_parts/plugins/validator.py:101: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /home/runner/work/craft-parts/craft-parts/craft_parts/plugins/validator.py:145: in _execute proc = subprocess.run( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ input = None, capture_output = True, timeout = None, check = True popenargs = (['/bin/bash', '/tmp/tmpy1fd6t9r'],) kwargs = {'stderr': -1, 'stdout': -1, 'text': True} process = <Popen: returncode: 126 args: ['/bin/bash', '/tmp/tmpy1fd6t9r']> stdout = '' stderr = '/tmp/tmpy1fd6t9r: line 26: /tmp/pytest-of-runner/pytest-0/test_dotnet_plugin_no_dotnet0/stage/sdk/dotnet: cannot execute binary file: Exec format error\n' retcode = 126 def run(*popenargs, input=None, capture_output=False, timeout=None, check=False, **kwargs): """Run command with arguments and return a CompletedProcess instance. The returned instance will have attributes args, returncode, stdout and stderr. By default, stdout and stderr are not captured, and those attributes will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them, or pass capture_output=True to capture both. If check is True and the exit code was non-zero, it raises a CalledProcessError. The CalledProcessError object will have the return code in the returncode attribute, and output & stderr attributes if those streams were captured. If timeout is given, and the process takes too long, a TimeoutExpired exception will be raised. There is an optional argument "input", allowing you to pass bytes or a string to the subprocess's stdin. If you use this argument you may not also use the Popen constructor's "stdin" argument, as it will be used internally. By default, all communication is in bytes, and therefore any "input" should be bytes, and the stdout and stderr will be bytes. If in text mode, any "input" should be a string, and stdout and stderr will be strings decoded according to locale encoding, or by "encoding" if set. Text mode is triggered by setting any of text, encoding, errors or universal_newlines. The other arguments are the same as for the Popen constructor. """ if input is not None: if kwargs.get('stdin') is not None: raise ValueError('stdin and input arguments may not both be used.') kwargs['stdin'] = PIPE if capture_output: if kwargs.get('stdout') is not None or kwargs.get('stderr') is not None: raise ValueError('stdout and stderr arguments may not be used ' 'with capture_output.') kwargs['stdout'] = PIPE kwargs['stderr'] = PIPE with Popen(*popenargs, **kwargs) as process: try: stdout, stderr = process.communicate(input, timeout=timeout) except TimeoutExpired as exc: process.kill() if _mswindows: # Windows accumulates the output in a single blocking # read() call run on child threads, with the timeout # being done in a join() on those threads. communicate() # _after_ kill() is required to collect that and add it # to the exception. exc.stdout, exc.stderr = process.communicate() else: # POSIX _communicate already populated the output so # far into the TimeoutExpired exception. process.wait() raise except: # Including KeyboardInterrupt, communicate handled that. process.kill() # We don't call process.wait() as .__exit__ does that for us. raise retcode = process.poll() if check and retcode: > raise CalledProcessError(retcode, process.args, output=stdout, stderr=stderr) E subprocess.CalledProcessError: Command '['/bin/bash', '/tmp/tmpy1fd6t9r']' returned non-zero exit status 126. /usr/lib/python3.12/subprocess.py:571: CalledProcessError The above exception was the direct cause of the following exception: new_dir = local('/tmp/pytest-of-runner/pytest-0/test_dotnet_plugin_no_dotnet0') partitions = None fp = <pytest_subprocess.fake_process.FakeProcess object at 0xffc124e99b80> @pytest.mark.plugin def test_dotnet_plugin_no_dotnet(new_dir, partitions, fp): """Test the dotnet plugin while pretending dotnet isn't installed.""" fp.allow_unregistered(allow=True) fp.register_subprocess(["dotnet", "--version"], returncode=127) > test_dotnet_plugin(new_dir, partitions) /home/runner/work/craft-parts/craft-parts/tests/integration/plugins/test_dotnet_v2.py:59: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /home/runner/work/craft-parts/craft-parts/tests/integration/plugins/test_dotnet_v2.py:46: in test_dotnet_plugin ctx.execute(actions) /home/runner/work/craft-parts/craft-parts/craft_parts/executor/executor.py:342: in execute self._executor.execute(actions, stdout=stdout, stderr=stderr) /home/runner/work/craft-parts/craft-parts/craft_parts/executor/executor.py:136: in execute self._run_action(act, stdout=stdout, stderr=stderr) /home/runner/work/craft-parts/craft-parts/craft_parts/executor/executor.py:229: in _run_action handler.run_action(action, stdout=stdout, stderr=stderr) /home/runner/work/craft-parts/craft-parts/craft_parts/executor/part_handler.py:309: in run_action state = handler(step_info, stdout=stdout, stderr=stderr) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ /home/runner/work/craft-parts/craft-parts/craft_parts/executor/part_handler.py:457: in _run_build self._run_step( /home/runner/work/craft-parts/craft-parts/craft_parts/executor/part_handler.py:651: in _run_step validator.validate_environment() /home/runner/work/craft-parts/craft-parts/craft_parts/plugins/dotnet_v2_plugin.py:135: in validate_environment self.validate_dependency( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <craft_parts.plugins.dotnet_v2_plugin.DotnetV2PluginEnvironmentValidator object at 0xffc12b3b0d70> dependency = 'dotnet', plugin_name = 'dotnet', part_dependencies = None argument = '--version' def validate_dependency( self, dependency: str, plugin_name: str, part_dependencies: list[str] | None, argument: str = "--version", ) -> str: """Validate that the environment has a required dependency. `<dependency-name> --version` is executed to confirm the dependency is valid. :param dependency: name of the dependency to validate. :param plugin_name: used to generate the part name that would satisfy the dependency. :param part_dependencies: A list of the parts this part depends on. :param argument: argument to call with the dependency. Default is `--version`. :raises PluginEnvironmentValidationError: If the environment is invalid. :return: output from executed dependency /home/runner/work/craft-parts/craft-parts/craft_parts/plugins/validator.py:105: PluginEnvironmentValidationError ----------------------------- Captured stderr call ----------------------------- + cp --archive --link --no-dereference . /tmp/pytest-of-runner/pytest-0/test_dotnet_plugin_fake_dotnet0/parts/dotnet-deps/install/sdk ```

Evaluation history

No evaluation history available.