nixbot

builds

failed pytest-impure x86_64-linux.pytest-impure · build #9 · raw

1tribuchet: building on jamie2....FF...........FFFF.F [100%]3=================================== FAILURES ===================================4___________________ TestFlakeService.test_update_flake_input ___________________56self = <update_flake_inputs.flake_service.FlakeService object at 0x7ffff66062c0>7input_name = 'flake-utils', flake_file = 'flake.nix'8work_dir = '/build/tmpuygeiqki'910 def update_flake_input(11 self,12 input_name: str,13 flake_file: str,14 work_dir: str | None = None,15 ) -> None:16 """Update a specific flake input.17 18 Args:19 input_name: Name of the input to update20 flake_file: Path to the flake file21 work_dir: Optional working directory to resolve flake file path from22 23 """24 try:25 logger.info("Updating flake input: %s in %s", input_name, flake_file)26 27 # If work_dir is provided, resolve the flake file relative to it28 absolute_flake_path = Path(work_dir) / flake_file if work_dir else Path(flake_file)29 30 flake_dir = absolute_flake_path.parent or Path()31 absolute_flake_dir = flake_dir.resolve()32 33 # Use a shallow URL because worktrees may not have the full history.34 # For subflakes, nix needs the URL to point to the git root35 # with a dir= parameter rather than the subdirectory directly.36 if work_dir:37 git_root = Path(work_dir).resolve()38 relative_dir = absolute_flake_dir.relative_to(git_root)39 flake_url = f"git+file://{git_root}?shallow=1"40 if str(relative_dir) != ".":41 flake_url += f"&dir={relative_dir}"42 else:43 flake_url = f"git+file://{absolute_flake_dir}?shallow=1"44 45> result = subprocess.run(46 [47 "nix",48 "flake",49 "update",50 "--flake",51 flake_url,52 input_name,53 ],54 cwd=str(flake_dir),55 capture_output=True,56 text=True,57 check=True,58 )5960src/update_flake_inputs/flake_service.py:191: 61_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 6263input = None, capture_output = True, timeout = None, check = True64popenargs = (['nix', 'flake', 'update', '--flake', 'git+file:///build/tmpuygeiqki?shallow=1', 'flake-utils'],)65kwargs = {'cwd': '/build/tmpuygeiqki', 'stderr': -1, 'stdout': -1, 'text': True}66process = <Popen: returncode: 1 args: ['nix', 'flake', 'update', '--flake', 'git+file:...>67stdout = ''68stderr = "warning: you don't have Internet access; disabling some network-dependent features\nerror:\n … while updating t...b.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com\n"69retcode = 17071 def run(*popenargs,72 input=None, capture_output=False, timeout=None, check=False, **kwargs):73 """Run command with arguments and return a CompletedProcess instance.74 75 The returned instance will have attributes args, returncode, stdout and76 stderr. By default, stdout and stderr are not captured, and those attributes77 will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them,78 or pass capture_output=True to capture both.79 80 If check is True and the exit code was non-zero, it raises a81 CalledProcessError. The CalledProcessError object will have the return code82 in the returncode attribute, and output & stderr attributes if those streams83 were captured.84 85 If timeout (seconds) is given and the process takes too long,86 a TimeoutExpired exception will be raised.87 88 There is an optional argument "input", allowing you to89 pass bytes or a string to the subprocess's stdin. If you use this argument90 you may not also use the Popen constructor's "stdin" argument, as91 it will be used internally.92 93 By default, all communication is in bytes, and therefore any "input" should94 be bytes, and the stdout and stderr will be bytes. If in text mode, any95 "input" should be a string, and stdout and stderr will be strings decoded96 according to locale encoding, or by "encoding" if set. Text mode is97 triggered by setting any of text, encoding, errors or universal_newlines.98 99 The other arguments are the same as for the Popen constructor.100 """101 if input is not None:102 if kwargs.get('stdin') is not None:103 raise ValueError('stdin and input arguments may not both be used.')104 kwargs['stdin'] = PIPE105 106 if capture_output:107 if kwargs.get('stdout') is not None or kwargs.get('stderr') is not None:108 raise ValueError('stdout and stderr arguments may not be used '109 'with capture_output.')110 kwargs['stdout'] = PIPE111 kwargs['stderr'] = PIPE112 113 with Popen(*popenargs, **kwargs) as process:114 try:115 stdout, stderr = process.communicate(input, timeout=timeout)116 except TimeoutExpired as exc:117 process.kill()118 if _mswindows:119 # Windows accumulates the output in a single blocking120 # read() call run on child threads, with the timeout121 # being done in a join() on those threads. communicate()122 # _after_ kill() is required to collect that and add it123 # to the exception.124 exc.stdout, exc.stderr = process.communicate()125 else:126 # POSIX _communicate already populated the output so127 # far into the TimeoutExpired exception.128 process.wait()129 raise130 except: # Including KeyboardInterrupt, communicate handled that.131 process.kill()132 # We don't call process.wait() as .__exit__ does that for us.133 raise134 retcode = process.poll()135 if check and retcode:136> raise CalledProcessError(retcode, process.args,137 output=stdout, stderr=stderr)138E subprocess.CalledProcessError: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/tmpuygeiqki?shallow=1', 'flake-utils']' returned non-zero exit status 1.139140/nix/store/n2fvjv22hixzfbqj1cm6cgl44nwz9z1n-python3-3.13.14-env/lib/python3.13/subprocess.py:577: CalledProcessError141142The above exception was the direct cause of the following exception:143144self = <tests.test_flake_service.TestFlakeService object at 0x7ffff6646d50>145flake_service = <update_flake_inputs.flake_service.FlakeService object at 0x7ffff66062c0>146fixtures_path = PosixPath('/build/src/tests/fixtures')147148 @pytest.mark.impure149 def test_update_flake_input(150 self,151 flake_service: FlakeService,152 fixtures_path: Path,153 ) -> None:154 """Test updating a flake input and modifying the lock file."""155 # Create a temporary directory for the test156 with tempfile.TemporaryDirectory() as temp_dir:157 temp_path = Path(temp_dir)158 159 # Copy minimal flake to temp directory160 shutil.copy(161 fixtures_path / "minimal" / "flake.nix",162 temp_path / "flake.nix",163 )164 shutil.copy(165 fixtures_path / "minimal" / "flake.lock",166 temp_path / "flake.lock",167 )168 169 # Initialize git repo in temp directory170 subprocess.run(["git", "init"], cwd=temp_path, check=True)171 subprocess.run(["git", "add", "."], cwd=temp_path, check=True)172 subprocess.run(173 ["git", "commit", "-m", "Initial commit"],174 cwd=temp_path,175 check=True,176 env={177 **os.environ,178 "GIT_AUTHOR_NAME": "Test User",179 "GIT_AUTHOR_EMAIL": "test@example.com",180 "GIT_COMMITTER_NAME": "Test User",181 "GIT_COMMITTER_EMAIL": "test@example.com",182 },183 )184 185 # Get the original lock file content186 original_lock_content = (temp_path / "flake.lock").read_text()187 original_lock = json.loads(original_lock_content)188 original_flake_utils_rev = original_lock["nodes"]["flake-utils"]["locked"]["rev"]189 190 # Update flake-utils input191> flake_service.update_flake_input("flake-utils", "flake.nix", str(temp_path))192193tests/test_flake_service.py:198: 194_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 195196self = <update_flake_inputs.flake_service.FlakeService object at 0x7ffff66062c0>197input_name = 'flake-utils', flake_file = 'flake.nix'198work_dir = '/build/tmpuygeiqki'199200 def update_flake_input(201 self,202 input_name: str,203 flake_file: str,204 work_dir: str | None = None,205 ) -> None:206 """Update a specific flake input.207 208 Args:209 input_name: Name of the input to update210 flake_file: Path to the flake file211 work_dir: Optional working directory to resolve flake file path from212 213 """214 try:215 logger.info("Updating flake input: %s in %s", input_name, flake_file)216 217 # If work_dir is provided, resolve the flake file relative to it218 absolute_flake_path = Path(work_dir) / flake_file if work_dir else Path(flake_file)219 220 flake_dir = absolute_flake_path.parent or Path()221 absolute_flake_dir = flake_dir.resolve()222 223 # Use a shallow URL because worktrees may not have the full history.224 # For subflakes, nix needs the URL to point to the git root225 # with a dir= parameter rather than the subdirectory directly.226 if work_dir:227 git_root = Path(work_dir).resolve()228 relative_dir = absolute_flake_dir.relative_to(git_root)229 flake_url = f"git+file://{git_root}?shallow=1"230 if str(relative_dir) != ".":231 flake_url += f"&dir={relative_dir}"232 else:233 flake_url = f"git+file://{absolute_flake_dir}?shallow=1"234 235 result = subprocess.run(236 [237 "nix",238 "flake",239 "update",240 "--flake",241 flake_url,242 input_name,243 ],244 cwd=str(flake_dir),245 capture_output=True,246 text=True,247 check=True,248 )249 250 # Check if there was a warning about non-existent input251 if result.stderr and "does not match any input" in result.stderr:252 logger.warning(253 "Failed to update input %s in %s: %s",254 input_name,255 flake_file,256 result.stderr.strip(),257 )258 259 logger.info(260 "Successfully updated flake input: %s in %s",261 input_name,262 flake_file,263 )264 except subprocess.CalledProcessError as e:265 stderr_output = e.stderr.strip() if e.stderr else "No stderr output"266 stdout_output = e.stdout.strip() if e.stdout else "No stdout output"267 logger.exception(268 "Failed to update flake input %s in %s. Exit code: %d\nStdout: %s\nStderr: %s",269 input_name,270 flake_file,271 e.returncode,272 stdout_output,273 stderr_output,274 )275 msg = (276 f"Failed to update flake input {input_name} in {flake_file}: {e}\n"277 f"Stderr: {stderr_output}"278 )279> raise FlakeServiceError(msg) from e280E update_flake_inputs.exceptions.FlakeServiceError: Failed to update flake input flake-utils in flake.nix: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/tmpuygeiqki?shallow=1', 'flake-utils']' returned non-zero exit status 1.281E Stderr: warning: you don't have Internet access; disabling some network-dependent features282E error:283E … while updating the lock file of flake 'git+file:///build/tmpuygeiqki?ref=refs/heads/master&rev=721eff2888829a15c0f7d7d0969caffc809ad8be&shallow=1'284E 285E … while updating the flake input 'flake-utils'286E 287E … while fetching the input 'github:numtide/flake-utils'288E 289E error: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com290291src/update_flake_inputs/flake_service.py:235: FlakeServiceError292----------------------------- Captured stdout call -----------------------------293Initialized empty Git repository in /build/tmpuygeiqki/.git/294[master (root-commit) 721eff2] Initial commit295 2 files changed, 55 insertions(+)296 create mode 100644 flake.lock297 create mode 100644 flake.nix298----------------------------- Captured stderr call -----------------------------299hint: Using 'master' as the name for the initial branch. This default branch name300hint: will change to "main" in Git 3.0. To configure the initial branch name301hint: to use in all of your new repositories, which will suppress this warning,302hint: call:303hint:304hint: git config --global init.defaultBranch <name>305hint:306hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and307hint: 'development'. The just-created branch can be renamed via this command:308hint:309hint: git branch -m <name>310hint:311hint: Disable this message with "git config set advice.defaultBranchName false"312------------------------------ Captured log call -------------------------------313ERROR update_flake_inputs.flake_service:flake_service.py:223 Failed to update flake input flake-utils in flake.nix. Exit code: 1314Stdout: No stdout output315Stderr: warning: you don't have Internet access; disabling some network-dependent features316error:317 … while updating the lock file of flake 'git+file:///build/tmpuygeiqki?ref=refs/heads/master&rev=721eff2888829a15c0f7d7d0969caffc809ad8be&shallow=1'318319 … while updating the flake input 'flake-utils'320321 … while fetching the input 'github:numtide/flake-utils'322323 error: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com324Traceback (most recent call last):325 File "/build/src/src/update_flake_inputs/flake_service.py", line 191, in update_flake_input326 result = subprocess.run(327 [328 ...<10 lines>...329 check=True,330 )331 File "/nix/store/n2fvjv22hixzfbqj1cm6cgl44nwz9z1n-python3-3.13.14-env/lib/python3.13/subprocess.py", line 577, in run332 raise CalledProcessError(retcode, process.args,333 output=stdout, stderr=stderr)334subprocess.CalledProcessError: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/tmpuygeiqki?shallow=1', 'flake-utils']' returned non-zero exit status 1.335_________________ TestFlakeService.test_update_subflake_input __________________336337self = <update_flake_inputs.flake_service.FlakeService object at 0x7ffff639bbf0>338input_name = 'flake-utils', flake_file = 'flake.nix'339work_dir = '/build/tmp76gvthtc'340341 def update_flake_input(342 self,343 input_name: str,344 flake_file: str,345 work_dir: str | None = None,346 ) -> None:347 """Update a specific flake input.348 349 Args:350 input_name: Name of the input to update351 flake_file: Path to the flake file352 work_dir: Optional working directory to resolve flake file path from353 354 """355 try:356 logger.info("Updating flake input: %s in %s", input_name, flake_file)357 358 # If work_dir is provided, resolve the flake file relative to it359 absolute_flake_path = Path(work_dir) / flake_file if work_dir else Path(flake_file)360 361 flake_dir = absolute_flake_path.parent or Path()362 absolute_flake_dir = flake_dir.resolve()363 364 # Use a shallow URL because worktrees may not have the full history.365 # For subflakes, nix needs the URL to point to the git root366 # with a dir= parameter rather than the subdirectory directly.367 if work_dir:368 git_root = Path(work_dir).resolve()369 relative_dir = absolute_flake_dir.relative_to(git_root)370 flake_url = f"git+file://{git_root}?shallow=1"371 if str(relative_dir) != ".":372 flake_url += f"&dir={relative_dir}"373 else:374 flake_url = f"git+file://{absolute_flake_dir}?shallow=1"375 376> result = subprocess.run(377 [378 "nix",379 "flake",380 "update",381 "--flake",382 flake_url,383 input_name,384 ],385 cwd=str(flake_dir),386 capture_output=True,387 text=True,388 check=True,389 )390391src/update_flake_inputs/flake_service.py:191: 392_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 393394input = None, capture_output = True, timeout = None, check = True395popenargs = (['nix', 'flake', 'update', '--flake', 'git+file:///build/tmp76gvthtc?shallow=1', 'flake-utils'],)396kwargs = {'cwd': '/build/tmp76gvthtc', 'stderr': -1, 'stdout': -1, 'text': True}397process = <Popen: returncode: 1 args: ['nix', 'flake', 'update', '--flake', 'git+file:...>398stdout = ''399stderr = "warning: you don't have Internet access; disabling some network-dependent features\nerror:\n … while updating t...b.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com\n"400retcode = 1401402 def run(*popenargs,403 input=None, capture_output=False, timeout=None, check=False, **kwargs):404 """Run command with arguments and return a CompletedProcess instance.405 406 The returned instance will have attributes args, returncode, stdout and407 stderr. By default, stdout and stderr are not captured, and those attributes408 will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them,409 or pass capture_output=True to capture both.410 411 If check is True and the exit code was non-zero, it raises a412 CalledProcessError. The CalledProcessError object will have the return code413 in the returncode attribute, and output & stderr attributes if those streams414 were captured.415 416 If timeout (seconds) is given and the process takes too long,417 a TimeoutExpired exception will be raised.418 419 There is an optional argument "input", allowing you to420 pass bytes or a string to the subprocess's stdin. If you use this argument421 you may not also use the Popen constructor's "stdin" argument, as422 it will be used internally.423 424 By default, all communication is in bytes, and therefore any "input" should425 be bytes, and the stdout and stderr will be bytes. If in text mode, any426 "input" should be a string, and stdout and stderr will be strings decoded427 according to locale encoding, or by "encoding" if set. Text mode is428 triggered by setting any of text, encoding, errors or universal_newlines.429 430 The other arguments are the same as for the Popen constructor.431 """432 if input is not None:433 if kwargs.get('stdin') is not None:434 raise ValueError('stdin and input arguments may not both be used.')435 kwargs['stdin'] = PIPE436 437 if capture_output:438 if kwargs.get('stdout') is not None or kwargs.get('stderr') is not None:439 raise ValueError('stdout and stderr arguments may not be used '440 'with capture_output.')441 kwargs['stdout'] = PIPE442 kwargs['stderr'] = PIPE443 444 with Popen(*popenargs, **kwargs) as process:445 try:446 stdout, stderr = process.communicate(input, timeout=timeout)447 except TimeoutExpired as exc:448 process.kill()449 if _mswindows:450 # Windows accumulates the output in a single blocking451 # read() call run on child threads, with the timeout452 # being done in a join() on those threads. communicate()453 # _after_ kill() is required to collect that and add it454 # to the exception.455 exc.stdout, exc.stderr = process.communicate()456 else:457 # POSIX _communicate already populated the output so458 # far into the TimeoutExpired exception.459 process.wait()460 raise461 except: # Including KeyboardInterrupt, communicate handled that.462 process.kill()463 # We don't call process.wait() as .__exit__ does that for us.464 raise465 retcode = process.poll()466 if check and retcode:467> raise CalledProcessError(retcode, process.args,468 output=stdout, stderr=stderr)469E subprocess.CalledProcessError: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/tmp76gvthtc?shallow=1', 'flake-utils']' returned non-zero exit status 1.470471/nix/store/n2fvjv22hixzfbqj1cm6cgl44nwz9z1n-python3-3.13.14-env/lib/python3.13/subprocess.py:577: CalledProcessError472473The above exception was the direct cause of the following exception:474475self = <tests.test_flake_service.TestFlakeService object at 0x7ffff6661ae0>476flake_service = <update_flake_inputs.flake_service.FlakeService object at 0x7ffff639bbf0>477fixtures_path = PosixPath('/build/src/tests/fixtures')478479 @pytest.mark.impure480 def test_update_subflake_input(481 self,482 flake_service: FlakeService,483 fixtures_path: Path,484 ) -> None:485 """Test updating a flake input in a subdirectory (subflake)."""486 with tempfile.TemporaryDirectory() as temp_dir:487 temp_path = Path(temp_dir)488 489 # Copy minimal flake to a subdirectory490 sub_dir = temp_path / "sub"491 sub_dir.mkdir()492 shutil.copy(493 fixtures_path / "minimal" / "flake.nix",494 sub_dir / "flake.nix",495 )496 shutil.copy(497 fixtures_path / "minimal" / "flake.lock",498 sub_dir / "flake.lock",499 )500 501 # Copy minimal flake to root502 shutil.copy(503 fixtures_path / "minimal" / "flake.nix",504 temp_path / "flake.nix",505 )506 shutil.copy(507 fixtures_path / "minimal" / "flake.lock",508 temp_path / "flake.lock",509 )510 511 # Initialize git repo in temp directory512 subprocess.run(["git", "init"], cwd=temp_path, check=True)513 subprocess.run(["git", "add", "."], cwd=temp_path, check=True)514 subprocess.run(515 ["git", "commit", "-m", "Initial commit"],516 cwd=temp_path,517 check=True,518 env={519 **os.environ,520 "GIT_AUTHOR_NAME": "Test User",521 "GIT_AUTHOR_EMAIL": "test@example.com",522 "GIT_COMMITTER_NAME": "Test User",523 "GIT_COMMITTER_EMAIL": "test@example.com",524 },525 )526 527 original_root_lock = json.loads((temp_path / "flake.lock").read_text())528 original_root_rev = original_root_lock["nodes"]["flake-utils"]["locked"]["rev"]529 530 original_sub_lock = json.loads((sub_dir / "flake.lock").read_text())531 original_sub_rev = original_sub_lock["nodes"]["flake-utils"]["locked"]["rev"]532 533 # Update flake-utils in the root flake534> flake_service.update_flake_input("flake-utils", "flake.nix", str(temp_path))535536tests/test_flake_service.py:272: 537_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 538539self = <update_flake_inputs.flake_service.FlakeService object at 0x7ffff639bbf0>540input_name = 'flake-utils', flake_file = 'flake.nix'541work_dir = '/build/tmp76gvthtc'542543 def update_flake_input(544 self,545 input_name: str,546 flake_file: str,547 work_dir: str | None = None,548 ) -> None:549 """Update a specific flake input.550 551 Args:552 input_name: Name of the input to update553 flake_file: Path to the flake file554 work_dir: Optional working directory to resolve flake file path from555 556 """557 try:558 logger.info("Updating flake input: %s in %s", input_name, flake_file)559 560 # If work_dir is provided, resolve the flake file relative to it561 absolute_flake_path = Path(work_dir) / flake_file if work_dir else Path(flake_file)562 563 flake_dir = absolute_flake_path.parent or Path()564 absolute_flake_dir = flake_dir.resolve()565 566 # Use a shallow URL because worktrees may not have the full history.567 # For subflakes, nix needs the URL to point to the git root568 # with a dir= parameter rather than the subdirectory directly.569 if work_dir:570 git_root = Path(work_dir).resolve()571 relative_dir = absolute_flake_dir.relative_to(git_root)572 flake_url = f"git+file://{git_root}?shallow=1"573 if str(relative_dir) != ".":574 flake_url += f"&dir={relative_dir}"575 else:576 flake_url = f"git+file://{absolute_flake_dir}?shallow=1"577 578 result = subprocess.run(579 [580 "nix",581 "flake",582 "update",583 "--flake",584 flake_url,585 input_name,586 ],587 cwd=str(flake_dir),588 capture_output=True,589 text=True,590 check=True,591 )592 593 # Check if there was a warning about non-existent input594 if result.stderr and "does not match any input" in result.stderr:595 logger.warning(596 "Failed to update input %s in %s: %s",597 input_name,598 flake_file,599 result.stderr.strip(),600 )601 602 logger.info(603 "Successfully updated flake input: %s in %s",604 input_name,605 flake_file,606 )607 except subprocess.CalledProcessError as e:608 stderr_output = e.stderr.strip() if e.stderr else "No stderr output"609 stdout_output = e.stdout.strip() if e.stdout else "No stdout output"610 logger.exception(611 "Failed to update flake input %s in %s. Exit code: %d\nStdout: %s\nStderr: %s",612 input_name,613 flake_file,614 e.returncode,615 stdout_output,616 stderr_output,617 )618 msg = (619 f"Failed to update flake input {input_name} in {flake_file}: {e}\n"620 f"Stderr: {stderr_output}"621 )622> raise FlakeServiceError(msg) from e623E update_flake_inputs.exceptions.FlakeServiceError: Failed to update flake input flake-utils in flake.nix: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/tmp76gvthtc?shallow=1', 'flake-utils']' returned non-zero exit status 1.624E Stderr: warning: you don't have Internet access; disabling some network-dependent features625E error:626E … while updating the lock file of flake 'git+file:///build/tmp76gvthtc?ref=refs/heads/master&rev=8fada045f6b2d769caa44dcc7c95909ff2f4892c&shallow=1'627E 628E … while updating the flake input 'flake-utils'629E 630E … while fetching the input 'github:numtide/flake-utils'631E 632E error: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com633634src/update_flake_inputs/flake_service.py:235: FlakeServiceError635----------------------------- Captured stdout call -----------------------------636Initialized empty Git repository in /build/tmp76gvthtc/.git/637[master (root-commit) 8fada04] Initial commit638 4 files changed, 110 insertions(+)639 create mode 100644 flake.lock640 create mode 100644 flake.nix641 create mode 100644 sub/flake.lock642 create mode 100644 sub/flake.nix643----------------------------- Captured stderr call -----------------------------644hint: Using 'master' as the name for the initial branch. This default branch name645hint: will change to "main" in Git 3.0. To configure the initial branch name646hint: to use in all of your new repositories, which will suppress this warning,647hint: call:648hint:649hint: git config --global init.defaultBranch <name>650hint:651hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and652hint: 'development'. The just-created branch can be renamed via this command:653hint:654hint: git branch -m <name>655hint:656hint: Disable this message with "git config set advice.defaultBranchName false"657------------------------------ Captured log call -------------------------------658ERROR update_flake_inputs.flake_service:flake_service.py:223 Failed to update flake input flake-utils in flake.nix. Exit code: 1659Stdout: No stdout output660Stderr: warning: you don't have Internet access; disabling some network-dependent features661error:662 … while updating the lock file of flake 'git+file:///build/tmp76gvthtc?ref=refs/heads/master&rev=8fada045f6b2d769caa44dcc7c95909ff2f4892c&shallow=1'663664 … while updating the flake input 'flake-utils'665666 … while fetching the input 'github:numtide/flake-utils'667668 error: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com669Traceback (most recent call last):670 File "/build/src/src/update_flake_inputs/flake_service.py", line 191, in update_flake_input671 result = subprocess.run(672 [673 ...<10 lines>...674 check=True,675 )676 File "/nix/store/n2fvjv22hixzfbqj1cm6cgl44nwz9z1n-python3-3.13.14-env/lib/python3.13/subprocess.py", line 577, in run677 raise CalledProcessError(retcode, process.args,678 output=stdout, stderr=stderr)679subprocess.CalledProcessError: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/tmp76gvthtc?shallow=1', 'flake-utils']' returned non-zero exit status 1.680___________ TestProcessFlakeUpdates.test_with_updatable_flake_input ____________681682self = <tests.test_process_flake_updates.TestProcessFlakeUpdates object at 0x7ffff6369310>683tmp_path = PosixPath('/build/pytest-of-nixbld/pytest-0/test_with_updatable_flake_inpu0')684fixtures_path = PosixPath('/build/src/tests/fixtures')685686 @pytest.mark.impure687 def test_with_updatable_flake_input(688 self,689 tmp_path: Path,690 fixtures_path: Path,691 ) -> None:692 """Test PR creation when flake input has available updates."""693 # Create a flake with flake-utils that can be updated694 flake_content = """{695 inputs = {696 flake-utils.url = "github:numtide/flake-utils";697 };698 699 outputs = { self, flake-utils }: {700 # Test flake with updatable input701 };702 }"""703 704 (tmp_path / "flake.nix").write_text(flake_content)705 706 # Copy old lock file from minimal fixture707 shutil.copy(708 fixtures_path / "minimal" / "flake.lock",709 tmp_path / "flake.lock",710 )711 712 _setup_git_repo(tmp_path)713 714 # Change to test directory715 original_cwd = Path.cwd()716 os.chdir(tmp_path)717 718 try:719 # Create test services720 flake_service = FlakeService()721 test_gitea_service = MockGiteaService()722 723 # Process updates724> process_flake_updates(725 flake_service,726 test_gitea_service,727 "",728 "main",729 "",730 auto_merge=False,731 )732733tests/test_process_flake_updates.py:222: 734_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 735736flake_service = <update_flake_inputs.flake_service.FlakeService object at 0x7ffff62f2750>737gitea_service = MockGiteaService(api_url='https://gitea.example.com', token='test-token', owner='test-owner', repo='test-repo', git_au...tions[bot]', git_committer_email='gitea-actions[bot]@noreply.gitea.io', merge_style='default', pr_creation_attempts=[])738exclude_patterns = '', base_branch = 'main', branch_suffix = ''739740 def process_flake_updates( # noqa: PLR0913741 flake_service: FlakeService,742 gitea_service: GiteaService,743 exclude_patterns: str,744 base_branch: str,745 branch_suffix: str,746 *,747 auto_merge: bool,748 ) -> None:749 """Process all flake updates.750 751 Args:752 flake_service: Flake service instance753 gitea_service: Gitea service instance754 exclude_patterns: Patterns to exclude755 base_branch: Base branch for PRs756 branch_suffix: Optional suffix to append to branch names757 auto_merge: Whether to automatically merge PRs758 759 """760 # Discover flake files761 flakes = flake_service.discover_flake_files(exclude_patterns)762 if not flakes:763 logger.info("No flake files found")764 return765 766 logger.info("Found %d flake files to process", len(flakes))767 768 failed_inputs: list[str] = []769 770 # Process each flake771 for flake in flakes:772 logger.info("Processing flake: %s", flake.file_path)773 logger.info("Inputs to update: %s", ", ".join(flake.inputs))774 775 # Don't include '.' for root directory776 parent_path = Path(flake.file_path).parent777 parent_suffix = "" if parent_path == Path() else f" in {parent_path}"778 parent_branch = "" if parent_path == Path() else f"-{parent_path}"779 suffix = branch_suffix.strip().replace("/", "-").strip("-")780 781 # Update each input782 for input_name in flake.inputs:783 try:784 branch_name = f"update{parent_branch}-{input_name}"785 branch_name = branch_name.replace("/", "-").strip("-")786 if suffix:787 branch_name = f"{branch_name}-{suffix}"788 789 logger.info(790 "Updating input %s in %s (branch: %s)",791 input_name,792 flake.file_path,793 branch_name,794 )795 796 # Create worktree and update input797 with gitea_service.worktree(branch_name, base_branch) as worktree_path:798 # Update the input799 flake_service.update_flake_input(800 input_name,801 flake.file_path,802 str(worktree_path),803 )804 805 # Commit changes806 commit_message = f"Update {input_name}{parent_suffix}"807 if gitea_service.commit_changes(808 branch_name,809 commit_message,810 worktree_path,811 ):812 # Create pull request813 pr_title = commit_message814 pr_body = (815 f"This PR updates the `{input_name}` input "816 f"in `{flake.file_path}`.\n\n"817 "Generated by update-flake-inputs action."818 )819 gitea_service.create_pull_request(820 branch_name,821 base_branch,822 pr_title,823 pr_body,824 auto_merge=auto_merge,825 )826 else:827 logger.info(828 "No changes for input %s in %s",829 input_name,830 flake.file_path,831 )832 gitea_service.delete_branch(branch_name)833 834 except Exception:835 logger.exception(836 "Failed to update input %s in %s",837 input_name,838 flake.file_path,839 )840 failed_inputs.append(f"{input_name} in {flake.file_path}")841 842 if failed_inputs:843 msg = f"Failed to process {len(failed_inputs)} input(s): {', '.join(failed_inputs)}"844> raise UpdateFlakeInputsError(msg)845E update_flake_inputs.exceptions.UpdateFlakeInputsError: Failed to process 1 input(s): flake-utils in flake.nix846847src/update_flake_inputs/cli.py:268: UpdateFlakeInputsError848----------------------------- Captured stdout call -----------------------------849Initialized empty Git repository in /build/pytest-of-nixbld/pytest-0/test_with_updatable_flake_inpu0/.git/850[main (root-commit) 34f3b5d] Initial commit851 2 files changed, 53 insertions(+)852 create mode 100644 flake.lock853 create mode 100644 flake.nix854Initialized empty Git repository in /build/pytest-of-nixbld/pytest-0/remote-test_with_updatable_flake_inpu0.git/855branch 'main' set up to track 'origin/main'.856branch 'update-flake-utils' set up to track 'origin/main'.857HEAD is now at 34f3b5d Initial commit858----------------------------- Captured stderr call -----------------------------859hint: Using 'master' as the name for the initial branch. This default branch name860hint: will change to "main" in Git 3.0. To configure the initial branch name861hint: to use in all of your new repositories, which will suppress this warning,862hint: call:863hint:864hint: git config --global init.defaultBranch <name>865hint:866hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and867hint: 'development'. The just-created branch can be renamed via this command:868hint:869hint: git branch -m <name>870hint:871hint: Disable this message with "git config set advice.defaultBranchName false"872To /build/pytest-of-nixbld/pytest-0/remote-test_with_updatable_flake_inpu0.git873 * [new branch] main -> main874From /build/pytest-of-nixbld/pytest-0/remote-test_with_updatable_flake_inpu0875 * branch main -> FETCH_HEAD876Preparing worktree (new branch 'update-flake-utils')877------------------------------ Captured log call -------------------------------878ERROR update_flake_inputs.flake_service:flake_service.py:223 Failed to update flake input flake-utils in flake.nix. Exit code: 1879Stdout: No stdout output880Stderr: warning: you don't have Internet access; disabling some network-dependent features881error:882 … while updating the lock file of flake 'git+file:///build/flake-update-22bxkhlz/update-flake-utils?ref=refs/heads/update-flake-utils&rev=34f3b5d3bed31994daedc4f9d1129a343bf3e5a2&shallow=1'883884 … while updating the flake input 'flake-utils'885886 … while fetching the input 'github:numtide/flake-utils'887888 error: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com889Traceback (most recent call last):890 File "/build/src/src/update_flake_inputs/flake_service.py", line 191, in update_flake_input891 result = subprocess.run(892 [893 ...<10 lines>...894 check=True,895 )896 File "/nix/store/n2fvjv22hixzfbqj1cm6cgl44nwz9z1n-python3-3.13.14-env/lib/python3.13/subprocess.py", line 577, in run897 raise CalledProcessError(retcode, process.args,898 output=stdout, stderr=stderr)899subprocess.CalledProcessError: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/flake-update-22bxkhlz/update-flake-utils?shallow=1', 'flake-utils']' returned non-zero exit status 1.900ERROR update_flake_inputs.cli:cli.py:259 Failed to update input flake-utils in flake.nix901Traceback (most recent call last):902 File "/build/src/src/update_flake_inputs/flake_service.py", line 191, in update_flake_input903 result = subprocess.run(904 [905 ...<10 lines>...906 check=True,907 )908 File "/nix/store/n2fvjv22hixzfbqj1cm6cgl44nwz9z1n-python3-3.13.14-env/lib/python3.13/subprocess.py", line 577, in run909 raise CalledProcessError(retcode, process.args,910 output=stdout, stderr=stderr)911subprocess.CalledProcessError: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/flake-update-22bxkhlz/update-flake-utils?shallow=1', 'flake-utils']' returned non-zero exit status 1.912913The above exception was the direct cause of the following exception:914915Traceback (most recent call last):916 File "/build/src/src/update_flake_inputs/cli.py", line 223, in process_flake_updates917 flake_service.update_flake_input(918 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^919 input_name,920 ^^^^^^^^^^^921 flake.file_path,922 ^^^^^^^^^^^^^^^^923 str(worktree_path),924 ^^^^^^^^^^^^^^^^^^^925 )926 ^927 File "/build/src/src/update_flake_inputs/flake_service.py", line 235, in update_flake_input928 raise FlakeServiceError(msg) from e929update_flake_inputs.exceptions.FlakeServiceError: Failed to update flake input flake-utils in flake.nix: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/flake-update-22bxkhlz/update-flake-utils?shallow=1', 'flake-utils']' returned non-zero exit status 1.930Stderr: warning: you don't have Internet access; disabling some network-dependent features931error:932 … while updating the lock file of flake 'git+file:///build/flake-update-22bxkhlz/update-flake-utils?ref=refs/heads/update-flake-utils&rev=34f3b5d3bed31994daedc4f9d1129a343bf3e5a2&shallow=1'933934 … while updating the flake input 'flake-utils'935936 … while fetching the input 'github:numtide/flake-utils'937938 error: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com939_____ TestProcessFlakeUpdates.test_worktree_based_on_base_branch_not_head ______940941self = <tests.test_process_flake_updates.TestProcessFlakeUpdates object at 0x7ffff62d1a70>942tmp_path = PosixPath('/build/pytest-of-nixbld/pytest-0/test_worktree_based_on_base_br0')943fixtures_path = PosixPath('/build/src/tests/fixtures')944945 @pytest.mark.impure946 def test_worktree_based_on_base_branch_not_head(947 self,948 tmp_path: Path,949 fixtures_path: Path,950 ) -> None:951 """Test that update branches are based on base_branch, not current HEAD.952 953 When the action is triggered from a non-main branch, the worktree954 should still be based on origin/<base_branch> so that commits from955 the triggering branch don't leak into the update branch.956 """957 flake_content = """{958 inputs = {959 flake-utils.url = "github:numtide/flake-utils";960 };961 962 outputs = { self, flake-utils }: {963 # Test flake with updatable input964 };965 }"""966 967 (tmp_path / "flake.nix").write_text(flake_content)968 969 shutil.copy(970 fixtures_path / "minimal" / "flake.lock",971 tmp_path / "flake.lock",972 )973 974 _setup_git_repo(tmp_path)975 976 # Create a feature branch with an extra commit977 git_env = {978 **os.environ,979 "GIT_AUTHOR_NAME": "Test User",980 "GIT_AUTHOR_EMAIL": "test@example.com",981 "GIT_COMMITTER_NAME": "Test User",982 "GIT_COMMITTER_EMAIL": "test@example.com",983 }984 subprocess.run(985 ["git", "checkout", "-b", "feature-branch"],986 cwd=tmp_path,987 check=True,988 )989 (tmp_path / "extra-file.txt").write_text("feature branch content")990 subprocess.run(["git", "add", "."], cwd=tmp_path, check=True)991 subprocess.run(992 ["git", "commit", "-m", "Feature branch commit"],993 cwd=tmp_path,994 check=True,995 env=git_env,996 )997 998 # Stay on feature-branch (simulating action triggered from non-main branch)999 original_cwd = Path.cwd()1000 os.chdir(tmp_path)1001 1002 try:1003 flake_service = FlakeService()1004 test_gitea_service = MockGiteaService()1005 1006> process_flake_updates(1007 flake_service,1008 test_gitea_service,1009 "",1010 "main",1011 "",1012 auto_merge=False,1013 )10141015tests/test_process_flake_updates.py:328: 1016_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 10171018flake_service = <update_flake_inputs.flake_service.FlakeService object at 0x7ffff6371350>1019gitea_service = MockGiteaService(api_url='https://gitea.example.com', token='test-token', owner='test-owner', repo='test-repo', git_au...tions[bot]', git_committer_email='gitea-actions[bot]@noreply.gitea.io', merge_style='default', pr_creation_attempts=[])1020exclude_patterns = '', base_branch = 'main', branch_suffix = ''10211022 def process_flake_updates( # noqa: PLR09131023 flake_service: FlakeService,1024 gitea_service: GiteaService,1025 exclude_patterns: str,1026 base_branch: str,1027 branch_suffix: str,1028 *,1029 auto_merge: bool,1030 ) -> None:1031 """Process all flake updates.1032 1033 Args:1034 flake_service: Flake service instance1035 gitea_service: Gitea service instance1036 exclude_patterns: Patterns to exclude1037 base_branch: Base branch for PRs1038 branch_suffix: Optional suffix to append to branch names1039 auto_merge: Whether to automatically merge PRs1040 1041 """1042 # Discover flake files1043 flakes = flake_service.discover_flake_files(exclude_patterns)1044 if not flakes:1045 logger.info("No flake files found")1046 return1047 1048 logger.info("Found %d flake files to process", len(flakes))1049 1050 failed_inputs: list[str] = []1051 1052 # Process each flake1053 for flake in flakes:1054 logger.info("Processing flake: %s", flake.file_path)1055 logger.info("Inputs to update: %s", ", ".join(flake.inputs))1056 1057 # Don't include '.' for root directory1058 parent_path = Path(flake.file_path).parent1059 parent_suffix = "" if parent_path == Path() else f" in {parent_path}"1060 parent_branch = "" if parent_path == Path() else f"-{parent_path}"1061 suffix = branch_suffix.strip().replace("/", "-").strip("-")1062 1063 # Update each input1064 for input_name in flake.inputs:1065 try:1066 branch_name = f"update{parent_branch}-{input_name}"1067 branch_name = branch_name.replace("/", "-").strip("-")1068 if suffix:1069 branch_name = f"{branch_name}-{suffix}"1070 1071 logger.info(1072 "Updating input %s in %s (branch: %s)",1073 input_name,1074 flake.file_path,1075 branch_name,1076 )1077 1078 # Create worktree and update input1079 with gitea_service.worktree(branch_name, base_branch) as worktree_path:1080 # Update the input1081 flake_service.update_flake_input(1082 input_name,1083 flake.file_path,1084 str(worktree_path),1085 )1086 1087 # Commit changes1088 commit_message = f"Update {input_name}{parent_suffix}"1089 if gitea_service.commit_changes(1090 branch_name,1091 commit_message,1092 worktree_path,1093 ):1094 # Create pull request1095 pr_title = commit_message1096 pr_body = (1097 f"This PR updates the `{input_name}` input "1098 f"in `{flake.file_path}`.\n\n"1099 "Generated by update-flake-inputs action."1100 )1101 gitea_service.create_pull_request(1102 branch_name,1103 base_branch,1104 pr_title,1105 pr_body,1106 auto_merge=auto_merge,1107 )1108 else:1109 logger.info(1110 "No changes for input %s in %s",1111 input_name,1112 flake.file_path,1113 )1114 gitea_service.delete_branch(branch_name)1115 1116 except Exception:1117 logger.exception(1118 "Failed to update input %s in %s",1119 input_name,1120 flake.file_path,1121 )1122 failed_inputs.append(f"{input_name} in {flake.file_path}")1123 1124 if failed_inputs:1125 msg = f"Failed to process {len(failed_inputs)} input(s): {', '.join(failed_inputs)}"1126> raise UpdateFlakeInputsError(msg)1127E update_flake_inputs.exceptions.UpdateFlakeInputsError: Failed to process 1 input(s): flake-utils in flake.nix11281129src/update_flake_inputs/cli.py:268: UpdateFlakeInputsError1130----------------------------- Captured stdout call -----------------------------1131Initialized empty Git repository in /build/pytest-of-nixbld/pytest-0/test_worktree_based_on_base_br0/.git/1132[main (root-commit) 128d589] Initial commit1133 2 files changed, 53 insertions(+)1134 create mode 100644 flake.lock1135 create mode 100644 flake.nix1136Initialized empty Git repository in /build/pytest-of-nixbld/pytest-0/remote-test_worktree_based_on_base_br0.git/1137branch 'main' set up to track 'origin/main'.1138[feature-branch 5e36fee] Feature branch commit1139 1 file changed, 1 insertion(+)1140 create mode 100644 extra-file.txt1141branch 'update-flake-utils' set up to track 'origin/main'.1142HEAD is now at 128d589 Initial commit1143----------------------------- Captured stderr call -----------------------------1144hint: Using 'master' as the name for the initial branch. This default branch name1145hint: will change to "main" in Git 3.0. To configure the initial branch name1146hint: to use in all of your new repositories, which will suppress this warning,1147hint: call:1148hint:1149hint: git config --global init.defaultBranch <name>1150hint:1151hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and1152hint: 'development'. The just-created branch can be renamed via this command:1153hint:1154hint: git branch -m <name>1155hint:1156hint: Disable this message with "git config set advice.defaultBranchName false"1157To /build/pytest-of-nixbld/pytest-0/remote-test_worktree_based_on_base_br0.git1158 * [new branch] main -> main1159Switched to a new branch 'feature-branch'1160From /build/pytest-of-nixbld/pytest-0/remote-test_worktree_based_on_base_br01161 * branch main -> FETCH_HEAD1162Preparing worktree (new branch 'update-flake-utils')1163------------------------------ Captured log call -------------------------------1164ERROR update_flake_inputs.flake_service:flake_service.py:223 Failed to update flake input flake-utils in flake.nix. Exit code: 11165Stdout: No stdout output1166Stderr: warning: you don't have Internet access; disabling some network-dependent features1167error:1168 … while updating the lock file of flake 'git+file:///build/flake-update-k6bv4v78/update-flake-utils?ref=refs/heads/update-flake-utils&rev=128d58975676dc1e10a7712534bbb32d56ff1125&shallow=1'11691170 … while updating the flake input 'flake-utils'11711172 … while fetching the input 'github:numtide/flake-utils'11731174 error: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com1175Traceback (most recent call last):1176 File "/build/src/src/update_flake_inputs/flake_service.py", line 191, in update_flake_input1177 result = subprocess.run(1178 [1179 ...<10 lines>...1180 check=True,1181 )1182 File "/nix/store/n2fvjv22hixzfbqj1cm6cgl44nwz9z1n-python3-3.13.14-env/lib/python3.13/subprocess.py", line 577, in run1183 raise CalledProcessError(retcode, process.args,1184 output=stdout, stderr=stderr)1185subprocess.CalledProcessError: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/flake-update-k6bv4v78/update-flake-utils?shallow=1', 'flake-utils']' returned non-zero exit status 1.1186ERROR update_flake_inputs.cli:cli.py:259 Failed to update input flake-utils in flake.nix1187Traceback (most recent call last):1188 File "/build/src/src/update_flake_inputs/flake_service.py", line 191, in update_flake_input1189 result = subprocess.run(1190 [1191 ...<10 lines>...1192 check=True,1193 )1194 File "/nix/store/n2fvjv22hixzfbqj1cm6cgl44nwz9z1n-python3-3.13.14-env/lib/python3.13/subprocess.py", line 577, in run1195 raise CalledProcessError(retcode, process.args,1196 output=stdout, stderr=stderr)1197subprocess.CalledProcessError: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/flake-update-k6bv4v78/update-flake-utils?shallow=1', 'flake-utils']' returned non-zero exit status 1.11981199The above exception was the direct cause of the following exception:12001201Traceback (most recent call last):1202 File "/build/src/src/update_flake_inputs/cli.py", line 223, in process_flake_updates1203 flake_service.update_flake_input(1204 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^1205 input_name,1206 ^^^^^^^^^^^1207 flake.file_path,1208 ^^^^^^^^^^^^^^^^1209 str(worktree_path),1210 ^^^^^^^^^^^^^^^^^^^1211 )1212 ^1213 File "/build/src/src/update_flake_inputs/flake_service.py", line 235, in update_flake_input1214 raise FlakeServiceError(msg) from e1215update_flake_inputs.exceptions.FlakeServiceError: Failed to update flake input flake-utils in flake.nix: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/flake-update-k6bv4v78/update-flake-utils?shallow=1', 'flake-utils']' returned non-zero exit status 1.1216Stderr: warning: you don't have Internet access; disabling some network-dependent features1217error:1218 … while updating the lock file of flake 'git+file:///build/flake-update-k6bv4v78/update-flake-utils?ref=refs/heads/update-flake-utils&rev=128d58975676dc1e10a7712534bbb32d56ff1125&shallow=1'12191220 … while updating the flake input 'flake-utils'12211222 … while fetching the input 'github:numtide/flake-utils'12231224 error: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com1225___________ TestProcessFlakeUpdates.test_custom_git_author_committer ___________12261227self = <tests.test_process_flake_updates.TestProcessFlakeUpdates object at 0x7ffff62d1e00>1228tmp_path = PosixPath('/build/pytest-of-nixbld/pytest-0/test_custom_git_author_committ0')1229fixtures_path = PosixPath('/build/src/tests/fixtures')12301231 @pytest.mark.impure1232 def test_custom_git_author_committer(1233 self,1234 tmp_path: Path,1235 fixtures_path: Path,1236 ) -> None:1237 """Test that custom git author/committer configuration is used."""1238 # Create a flake with flake-utils1239 flake_content = """{1240 inputs = {1241 flake-utils.url = "github:numtide/flake-utils";1242 };1243 1244 outputs = { self, flake-utils }: {1245 # Test flake1246 };1247 }"""1248 1249 (tmp_path / "flake.nix").write_text(flake_content)1250 1251 # Copy old lock file from minimal fixture1252 shutil.copy(1253 fixtures_path / "minimal" / "flake.lock",1254 tmp_path / "flake.lock",1255 )1256 1257 _setup_git_repo(tmp_path)1258 1259 # Change to test directory1260 original_cwd = Path.cwd()1261 os.chdir(tmp_path)1262 1263 try:1264 # Create test services with custom git author/committer1265 flake_service = FlakeService()1266 test_gitea_service = MockGiteaService()1267 test_gitea_service.git_author_name = "Custom Bot"1268 test_gitea_service.git_author_email = "custom@bot.com"1269 test_gitea_service.git_committer_name = "Custom Committer"1270 test_gitea_service.git_committer_email = "committer@bot.com"1271 1272 # Process updates1273> process_flake_updates(1274 flake_service,1275 test_gitea_service,1276 "",1277 "main",1278 "",1279 auto_merge=False,1280 )12811282tests/test_process_flake_updates.py:398: 1283_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 12841285flake_service = <update_flake_inputs.flake_service.FlakeService object at 0x7ffff65b3b60>1286gitea_service = MockGiteaService(api_url='https://gitea.example.com', token='test-token', owner='test-owner', repo='test-repo', git_au...itter_name='Custom Committer', git_committer_email='committer@bot.com', merge_style='default', pr_creation_attempts=[])1287exclude_patterns = '', base_branch = 'main', branch_suffix = ''12881289 def process_flake_updates( # noqa: PLR09131290 flake_service: FlakeService,1291 gitea_service: GiteaService,1292 exclude_patterns: str,1293 base_branch: str,1294 branch_suffix: str,1295 *,1296 auto_merge: bool,1297 ) -> None:1298 """Process all flake updates.1299 1300 Args:1301 flake_service: Flake service instance1302 gitea_service: Gitea service instance1303 exclude_patterns: Patterns to exclude1304 base_branch: Base branch for PRs1305 branch_suffix: Optional suffix to append to branch names1306 auto_merge: Whether to automatically merge PRs1307 1308 """1309 # Discover flake files1310 flakes = flake_service.discover_flake_files(exclude_patterns)1311 if not flakes:1312 logger.info("No flake files found")1313 return1314 1315 logger.info("Found %d flake files to process", len(flakes))1316 1317 failed_inputs: list[str] = []1318 1319 # Process each flake1320 for flake in flakes:1321 logger.info("Processing flake: %s", flake.file_path)1322 logger.info("Inputs to update: %s", ", ".join(flake.inputs))1323 1324 # Don't include '.' for root directory1325 parent_path = Path(flake.file_path).parent1326 parent_suffix = "" if parent_path == Path() else f" in {parent_path}"1327 parent_branch = "" if parent_path == Path() else f"-{parent_path}"1328 suffix = branch_suffix.strip().replace("/", "-").strip("-")1329 1330 # Update each input1331 for input_name in flake.inputs:1332 try:1333 branch_name = f"update{parent_branch}-{input_name}"1334 branch_name = branch_name.replace("/", "-").strip("-")1335 if suffix:1336 branch_name = f"{branch_name}-{suffix}"1337 1338 logger.info(1339 "Updating input %s in %s (branch: %s)",1340 input_name,1341 flake.file_path,1342 branch_name,1343 )1344 1345 # Create worktree and update input1346 with gitea_service.worktree(branch_name, base_branch) as worktree_path:1347 # Update the input1348 flake_service.update_flake_input(1349 input_name,1350 flake.file_path,1351 str(worktree_path),1352 )1353 1354 # Commit changes1355 commit_message = f"Update {input_name}{parent_suffix}"1356 if gitea_service.commit_changes(1357 branch_name,1358 commit_message,1359 worktree_path,1360 ):1361 # Create pull request1362 pr_title = commit_message1363 pr_body = (1364 f"This PR updates the `{input_name}` input "1365 f"in `{flake.file_path}`.\n\n"1366 "Generated by update-flake-inputs action."1367 )1368 gitea_service.create_pull_request(1369 branch_name,1370 base_branch,1371 pr_title,1372 pr_body,1373 auto_merge=auto_merge,1374 )1375 else:1376 logger.info(1377 "No changes for input %s in %s",1378 input_name,1379 flake.file_path,1380 )1381 gitea_service.delete_branch(branch_name)1382 1383 except Exception:1384 logger.exception(1385 "Failed to update input %s in %s",1386 input_name,1387 flake.file_path,1388 )1389 failed_inputs.append(f"{input_name} in {flake.file_path}")1390 1391 if failed_inputs:1392 msg = f"Failed to process {len(failed_inputs)} input(s): {', '.join(failed_inputs)}"1393> raise UpdateFlakeInputsError(msg)1394E update_flake_inputs.exceptions.UpdateFlakeInputsError: Failed to process 1 input(s): flake-utils in flake.nix13951396src/update_flake_inputs/cli.py:268: UpdateFlakeInputsError1397----------------------------- Captured stdout call -----------------------------1398Initialized empty Git repository in /build/pytest-of-nixbld/pytest-0/test_custom_git_author_committ0/.git/1399[main (root-commit) d52a311] Initial commit1400 2 files changed, 53 insertions(+)1401 create mode 100644 flake.lock1402 create mode 100644 flake.nix1403Initialized empty Git repository in /build/pytest-of-nixbld/pytest-0/remote-test_custom_git_author_committ0.git/1404branch 'main' set up to track 'origin/main'.1405branch 'update-flake-utils' set up to track 'origin/main'.1406HEAD is now at d52a311 Initial commit1407----------------------------- Captured stderr call -----------------------------1408hint: Using 'master' as the name for the initial branch. This default branch name1409hint: will change to "main" in Git 3.0. To configure the initial branch name1410hint: to use in all of your new repositories, which will suppress this warning,1411hint: call:1412hint:1413hint: git config --global init.defaultBranch <name>1414hint:1415hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and1416hint: 'development'. The just-created branch can be renamed via this command:1417hint:1418hint: git branch -m <name>1419hint:1420hint: Disable this message with "git config set advice.defaultBranchName false"1421To /build/pytest-of-nixbld/pytest-0/remote-test_custom_git_author_committ0.git1422 * [new branch] main -> main1423From /build/pytest-of-nixbld/pytest-0/remote-test_custom_git_author_committ01424 * branch main -> FETCH_HEAD1425Preparing worktree (new branch 'update-flake-utils')1426------------------------------ Captured log call -------------------------------1427ERROR update_flake_inputs.flake_service:flake_service.py:223 Failed to update flake input flake-utils in flake.nix. Exit code: 11428Stdout: No stdout output1429Stderr: warning: you don't have Internet access; disabling some network-dependent features1430error:1431 … while updating the lock file of flake 'git+file:///build/flake-update-as3clar2/update-flake-utils?ref=refs/heads/update-flake-utils&rev=d52a311ccbe5385d0b1ef0ae2df6704da9d2aae2&shallow=1'14321433 … while updating the flake input 'flake-utils'14341435 … while fetching the input 'github:numtide/flake-utils'14361437 error: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com1438Traceback (most recent call last):1439 File "/build/src/src/update_flake_inputs/flake_service.py", line 191, in update_flake_input1440 result = subprocess.run(1441 [1442 ...<10 lines>...1443 check=True,1444 )1445 File "/nix/store/n2fvjv22hixzfbqj1cm6cgl44nwz9z1n-python3-3.13.14-env/lib/python3.13/subprocess.py", line 577, in run1446 raise CalledProcessError(retcode, process.args,1447 output=stdout, stderr=stderr)1448subprocess.CalledProcessError: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/flake-update-as3clar2/update-flake-utils?shallow=1', 'flake-utils']' returned non-zero exit status 1.1449ERROR update_flake_inputs.cli:cli.py:259 Failed to update input flake-utils in flake.nix1450Traceback (most recent call last):1451 File "/build/src/src/update_flake_inputs/flake_service.py", line 191, in update_flake_input1452 result = subprocess.run(1453 [1454 ...<10 lines>...1455 check=True,1456 )1457 File "/nix/store/n2fvjv22hixzfbqj1cm6cgl44nwz9z1n-python3-3.13.14-env/lib/python3.13/subprocess.py", line 577, in run1458 raise CalledProcessError(retcode, process.args,1459 output=stdout, stderr=stderr)1460subprocess.CalledProcessError: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/flake-update-as3clar2/update-flake-utils?shallow=1', 'flake-utils']' returned non-zero exit status 1.14611462The above exception was the direct cause of the following exception:14631464Traceback (most recent call last):1465 File "/build/src/src/update_flake_inputs/cli.py", line 223, in process_flake_updates1466 flake_service.update_flake_input(1467 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^1468 input_name,1469 ^^^^^^^^^^^1470 flake.file_path,1471 ^^^^^^^^^^^^^^^^1472 str(worktree_path),1473 ^^^^^^^^^^^^^^^^^^^1474 )1475 ^1476 File "/build/src/src/update_flake_inputs/flake_service.py", line 235, in update_flake_input1477 raise FlakeServiceError(msg) from e1478update_flake_inputs.exceptions.FlakeServiceError: Failed to update flake input flake-utils in flake.nix: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/flake-update-as3clar2/update-flake-utils?shallow=1', 'flake-utils']' returned non-zero exit status 1.1479Stderr: warning: you don't have Internet access; disabling some network-dependent features1480error:1481 … while updating the lock file of flake 'git+file:///build/flake-update-as3clar2/update-flake-utils?ref=refs/heads/update-flake-utils&rev=d52a311ccbe5385d0b1ef0ae2df6704da9d2aae2&shallow=1'14821483 … while updating the flake input 'flake-utils'14841485 … while fetching the input 'github:numtide/flake-utils'14861487 error: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com1488__________________ TestProcessFlakeUpdates.test_branch_suffix __________________14891490self = <tests.test_process_flake_updates.TestProcessFlakeUpdates object at 0x7ffff5a283b0>1491tmp_path = PosixPath('/build/pytest-of-nixbld/pytest-0/test_branch_suffix0')1492fixtures_path = PosixPath('/build/src/tests/fixtures')14931494 @pytest.mark.impure1495 def test_branch_suffix(1496 self,1497 tmp_path: Path,1498 fixtures_path: Path,1499 ) -> None:1500 """Test that branch suffix is properly appended to branch names."""1501 # Create a flake with flake-utils1502 flake_content = """{1503 inputs = {1504 flake-utils.url = "github:numtide/flake-utils";1505 };1506 1507 outputs = { self, flake-utils }: {1508 # Test flake1509 };1510 }"""1511 1512 (tmp_path / "flake.nix").write_text(flake_content)1513 1514 # Copy old lock file from minimal fixture1515 shutil.copy(1516 fixtures_path / "minimal" / "flake.lock",1517 tmp_path / "flake.lock",1518 )1519 1520 _setup_git_repo(tmp_path)1521 1522 # Change to test directory1523 original_cwd = Path.cwd()1524 os.chdir(tmp_path)1525 1526 try:1527 # Create test services1528 flake_service = FlakeService()1529 test_gitea_service = MockGiteaService()1530 1531 # Process updates with branch suffix1532> process_flake_updates(1533 flake_service,1534 test_gitea_service,1535 "",1536 "main",1537 "my-suffix",1538 auto_merge=False,1539 )15401541tests/test_process_flake_updates.py:465: 1542_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 15431544flake_service = <update_flake_inputs.flake_service.FlakeService object at 0x7ffff63746e0>1545gitea_service = MockGiteaService(api_url='https://gitea.example.com', token='test-token', owner='test-owner', repo='test-repo', git_au...tions[bot]', git_committer_email='gitea-actions[bot]@noreply.gitea.io', merge_style='default', pr_creation_attempts=[])1546exclude_patterns = '', base_branch = 'main', branch_suffix = 'my-suffix'15471548 def process_flake_updates( # noqa: PLR09131549 flake_service: FlakeService,1550 gitea_service: GiteaService,1551 exclude_patterns: str,1552 base_branch: str,1553 branch_suffix: str,1554 *,1555 auto_merge: bool,1556 ) -> None:1557 """Process all flake updates.1558 1559 Args:1560 flake_service: Flake service instance1561 gitea_service: Gitea service instance1562 exclude_patterns: Patterns to exclude1563 base_branch: Base branch for PRs1564 branch_suffix: Optional suffix to append to branch names1565 auto_merge: Whether to automatically merge PRs1566 1567 """1568 # Discover flake files1569 flakes = flake_service.discover_flake_files(exclude_patterns)1570 if not flakes:1571 logger.info("No flake files found")1572 return1573 1574 logger.info("Found %d flake files to process", len(flakes))1575 1576 failed_inputs: list[str] = []1577 1578 # Process each flake1579 for flake in flakes:1580 logger.info("Processing flake: %s", flake.file_path)1581 logger.info("Inputs to update: %s", ", ".join(flake.inputs))1582 1583 # Don't include '.' for root directory1584 parent_path = Path(flake.file_path).parent1585 parent_suffix = "" if parent_path == Path() else f" in {parent_path}"1586 parent_branch = "" if parent_path == Path() else f"-{parent_path}"1587 suffix = branch_suffix.strip().replace("/", "-").strip("-")1588 1589 # Update each input1590 for input_name in flake.inputs:1591 try:1592 branch_name = f"update{parent_branch}-{input_name}"1593 branch_name = branch_name.replace("/", "-").strip("-")1594 if suffix:1595 branch_name = f"{branch_name}-{suffix}"1596 1597 logger.info(1598 "Updating input %s in %s (branch: %s)",1599 input_name,1600 flake.file_path,1601 branch_name,1602 )1603 1604 # Create worktree and update input1605 with gitea_service.worktree(branch_name, base_branch) as worktree_path:1606 # Update the input1607 flake_service.update_flake_input(1608 input_name,1609 flake.file_path,1610 str(worktree_path),1611 )1612 1613 # Commit changes1614 commit_message = f"Update {input_name}{parent_suffix}"1615 if gitea_service.commit_changes(1616 branch_name,1617 commit_message,1618 worktree_path,1619 ):1620 # Create pull request1621 pr_title = commit_message1622 pr_body = (1623 f"This PR updates the `{input_name}` input "1624 f"in `{flake.file_path}`.\n\n"1625 "Generated by update-flake-inputs action."1626 )1627 gitea_service.create_pull_request(1628 branch_name,1629 base_branch,1630 pr_title,1631 pr_body,1632 auto_merge=auto_merge,1633 )1634 else:1635 logger.info(1636 "No changes for input %s in %s",1637 input_name,1638 flake.file_path,1639 )1640 gitea_service.delete_branch(branch_name)1641 1642 except Exception:1643 logger.exception(1644 "Failed to update input %s in %s",1645 input_name,1646 flake.file_path,1647 )1648 failed_inputs.append(f"{input_name} in {flake.file_path}")1649 1650 if failed_inputs:1651 msg = f"Failed to process {len(failed_inputs)} input(s): {', '.join(failed_inputs)}"1652> raise UpdateFlakeInputsError(msg)1653E update_flake_inputs.exceptions.UpdateFlakeInputsError: Failed to process 1 input(s): flake-utils in flake.nix16541655src/update_flake_inputs/cli.py:268: UpdateFlakeInputsError1656----------------------------- Captured stdout call -----------------------------1657Initialized empty Git repository in /build/pytest-of-nixbld/pytest-0/test_branch_suffix0/.git/1658[main (root-commit) d52a311] Initial commit1659 2 files changed, 53 insertions(+)1660 create mode 100644 flake.lock1661 create mode 100644 flake.nix1662Initialized empty Git repository in /build/pytest-of-nixbld/pytest-0/remote-test_branch_suffix0.git/1663branch 'main' set up to track 'origin/main'.1664branch 'update-flake-utils-my-suffix' set up to track 'origin/main'.1665HEAD is now at d52a311 Initial commit1666----------------------------- Captured stderr call -----------------------------1667hint: Using 'master' as the name for the initial branch. This default branch name1668hint: will change to "main" in Git 3.0. To configure the initial branch name1669hint: to use in all of your new repositories, which will suppress this warning,1670hint: call:1671hint:1672hint: git config --global init.defaultBranch <name>1673hint:1674hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and1675hint: 'development'. The just-created branch can be renamed via this command:1676hint:1677hint: git branch -m <name>1678hint:1679hint: Disable this message with "git config set advice.defaultBranchName false"1680To /build/pytest-of-nixbld/pytest-0/remote-test_branch_suffix0.git1681 * [new branch] main -> main1682From /build/pytest-of-nixbld/pytest-0/remote-test_branch_suffix01683 * branch main -> FETCH_HEAD1684Preparing worktree (new branch 'update-flake-utils-my-suffix')1685------------------------------ Captured log call -------------------------------1686ERROR update_flake_inputs.flake_service:flake_service.py:223 Failed to update flake input flake-utils in flake.nix. Exit code: 11687Stdout: No stdout output1688Stderr: warning: you don't have Internet access; disabling some network-dependent features1689error:1690 … while updating the lock file of flake 'git+file:///build/flake-update-9g2ky390/update-flake-utils-my-suffix?ref=refs/heads/update-flake-utils-my-suffix&rev=d52a311ccbe5385d0b1ef0ae2df6704da9d2aae2&shallow=1'16911692 … while updating the flake input 'flake-utils'16931694 … while fetching the input 'github:numtide/flake-utils'16951696 error: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com1697Traceback (most recent call last):1698 File "/build/src/src/update_flake_inputs/flake_service.py", line 191, in update_flake_input1699 result = subprocess.run(1700 [1701 ...<10 lines>...1702 check=True,1703 )1704 File "/nix/store/n2fvjv22hixzfbqj1cm6cgl44nwz9z1n-python3-3.13.14-env/lib/python3.13/subprocess.py", line 577, in run1705 raise CalledProcessError(retcode, process.args,1706 output=stdout, stderr=stderr)1707subprocess.CalledProcessError: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/flake-update-9g2ky390/update-flake-utils-my-suffix?shallow=1', 'flake-utils']' returned non-zero exit status 1.1708ERROR update_flake_inputs.cli:cli.py:259 Failed to update input flake-utils in flake.nix1709Traceback (most recent call last):1710 File "/build/src/src/update_flake_inputs/flake_service.py", line 191, in update_flake_input1711 result = subprocess.run(1712 [1713 ...<10 lines>...1714 check=True,1715 )1716 File "/nix/store/n2fvjv22hixzfbqj1cm6cgl44nwz9z1n-python3-3.13.14-env/lib/python3.13/subprocess.py", line 577, in run1717 raise CalledProcessError(retcode, process.args,1718 output=stdout, stderr=stderr)1719subprocess.CalledProcessError: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/flake-update-9g2ky390/update-flake-utils-my-suffix?shallow=1', 'flake-utils']' returned non-zero exit status 1.17201721The above exception was the direct cause of the following exception:17221723Traceback (most recent call last):1724 File "/build/src/src/update_flake_inputs/cli.py", line 223, in process_flake_updates1725 flake_service.update_flake_input(1726 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^1727 input_name,1728 ^^^^^^^^^^^1729 flake.file_path,1730 ^^^^^^^^^^^^^^^^1731 str(worktree_path),1732 ^^^^^^^^^^^^^^^^^^^1733 )1734 ^1735 File "/build/src/src/update_flake_inputs/flake_service.py", line 235, in update_flake_input1736 raise FlakeServiceError(msg) from e1737update_flake_inputs.exceptions.FlakeServiceError: Failed to update flake input flake-utils in flake.nix: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/flake-update-9g2ky390/update-flake-utils-my-suffix?shallow=1', 'flake-utils']' returned non-zero exit status 1.1738Stderr: warning: you don't have Internet access; disabling some network-dependent features1739error:1740 … while updating the lock file of flake 'git+file:///build/flake-update-9g2ky390/update-flake-utils-my-suffix?ref=refs/heads/update-flake-utils-my-suffix&rev=d52a311ccbe5385d0b1ef0ae2df6704da9d2aae2&shallow=1'17411742 … while updating the flake input 'flake-utils'17431744 … while fetching the input 'github:numtide/flake-utils'17451746 error: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com1747____ TestProcessFlakeUpdates.test_fails_at_end_when_individual_input_fails _____17481749self = <tests.test_process_flake_updates.TestProcessFlakeUpdates object at 0x7ffff62fead0>1750tmp_path = PosixPath('/build/pytest-of-nixbld/pytest-0/test_fails_at_end_when_individ0')1751fixtures_path = PosixPath('/build/src/tests/fixtures')17521753 @pytest.mark.impure1754 def test_fails_at_end_when_individual_input_fails(1755 self,1756 tmp_path: Path,1757 fixtures_path: Path,1758 ) -> None:1759 """Test that the action continues updating other inputs but fails at the end."""1760 flake_content = """{1761 inputs = {1762 flake-utils.url = "github:numtide/flake-utils";1763 };1764 1765 outputs = { self, flake-utils }: {1766 # Test flake with updatable input1767 };1768 }"""1769 1770 (tmp_path / "flake.nix").write_text(flake_content)1771 1772 shutil.copy(1773 fixtures_path / "minimal" / "flake.lock",1774 tmp_path / "flake.lock",1775 )1776 1777 _setup_git_repo(tmp_path)1778 1779 original_cwd = Path.cwd()1780 os.chdir(tmp_path)1781 1782 try:1783 # FailingFlakeService injects "bad-input" during discovery and1784 # raises when asked to update it, simulating a 403 or dead ref1785 flake_service = FailingFlakeService(fail_inputs=["bad-input"])1786 test_gitea_service = MockGiteaService()1787 1788 with pytest.raises(UpdateFlakeInputsError, match="Failed to process 1 input"):1789> process_flake_updates(1790 flake_service,1791 test_gitea_service,1792 "",1793 "main",1794 "",1795 auto_merge=False,1796 )17971798tests/test_process_flake_updates.py:597: 1799_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 18001801flake_service = <tests.test_process_flake_updates.FailingFlakeService object at 0x7ffff6632cf0>1802gitea_service = MockGiteaService(api_url='https://gitea.example.com', token='test-token', owner='test-owner', repo='test-repo', git_au...tions[bot]', git_committer_email='gitea-actions[bot]@noreply.gitea.io', merge_style='default', pr_creation_attempts=[])1803exclude_patterns = '', base_branch = 'main', branch_suffix = ''18041805 def process_flake_updates( # noqa: PLR09131806 flake_service: FlakeService,1807 gitea_service: GiteaService,1808 exclude_patterns: str,1809 base_branch: str,1810 branch_suffix: str,1811 *,1812 auto_merge: bool,1813 ) -> None:1814 """Process all flake updates.1815 1816 Args:1817 flake_service: Flake service instance1818 gitea_service: Gitea service instance1819 exclude_patterns: Patterns to exclude1820 base_branch: Base branch for PRs1821 branch_suffix: Optional suffix to append to branch names1822 auto_merge: Whether to automatically merge PRs1823 1824 """1825 # Discover flake files1826 flakes = flake_service.discover_flake_files(exclude_patterns)1827 if not flakes:1828 logger.info("No flake files found")1829 return1830 1831 logger.info("Found %d flake files to process", len(flakes))1832 1833 failed_inputs: list[str] = []1834 1835 # Process each flake1836 for flake in flakes:1837 logger.info("Processing flake: %s", flake.file_path)1838 logger.info("Inputs to update: %s", ", ".join(flake.inputs))1839 1840 # Don't include '.' for root directory1841 parent_path = Path(flake.file_path).parent1842 parent_suffix = "" if parent_path == Path() else f" in {parent_path}"1843 parent_branch = "" if parent_path == Path() else f"-{parent_path}"1844 suffix = branch_suffix.strip().replace("/", "-").strip("-")1845 1846 # Update each input1847 for input_name in flake.inputs:1848 try:1849 branch_name = f"update{parent_branch}-{input_name}"1850 branch_name = branch_name.replace("/", "-").strip("-")1851 if suffix:1852 branch_name = f"{branch_name}-{suffix}"1853 1854 logger.info(1855 "Updating input %s in %s (branch: %s)",1856 input_name,1857 flake.file_path,1858 branch_name,1859 )1860 1861 # Create worktree and update input1862 with gitea_service.worktree(branch_name, base_branch) as worktree_path:1863 # Update the input1864 flake_service.update_flake_input(1865 input_name,1866 flake.file_path,1867 str(worktree_path),1868 )1869 1870 # Commit changes1871 commit_message = f"Update {input_name}{parent_suffix}"1872 if gitea_service.commit_changes(1873 branch_name,1874 commit_message,1875 worktree_path,1876 ):1877 # Create pull request1878 pr_title = commit_message1879 pr_body = (1880 f"This PR updates the `{input_name}` input "1881 f"in `{flake.file_path}`.\n\n"1882 "Generated by update-flake-inputs action."1883 )1884 gitea_service.create_pull_request(1885 branch_name,1886 base_branch,1887 pr_title,1888 pr_body,1889 auto_merge=auto_merge,1890 )1891 else:1892 logger.info(1893 "No changes for input %s in %s",1894 input_name,1895 flake.file_path,1896 )1897 gitea_service.delete_branch(branch_name)1898 1899 except Exception:1900 logger.exception(1901 "Failed to update input %s in %s",1902 input_name,1903 flake.file_path,1904 )1905 failed_inputs.append(f"{input_name} in {flake.file_path}")1906 1907 if failed_inputs:1908 msg = f"Failed to process {len(failed_inputs)} input(s): {', '.join(failed_inputs)}"1909> raise UpdateFlakeInputsError(msg)1910E update_flake_inputs.exceptions.UpdateFlakeInputsError: Failed to process 2 input(s): bad-input in flake.nix, flake-utils in flake.nix19111912src/update_flake_inputs/cli.py:268: UpdateFlakeInputsError19131914During handling of the above exception, another exception occurred:19151916self = <tests.test_process_flake_updates.TestProcessFlakeUpdates object at 0x7ffff62fead0>1917tmp_path = PosixPath('/build/pytest-of-nixbld/pytest-0/test_fails_at_end_when_individ0')1918fixtures_path = PosixPath('/build/src/tests/fixtures')19191920 @pytest.mark.impure1921 def test_fails_at_end_when_individual_input_fails(1922 self,1923 tmp_path: Path,1924 fixtures_path: Path,1925 ) -> None:1926 """Test that the action continues updating other inputs but fails at the end."""1927 flake_content = """{1928 inputs = {1929 flake-utils.url = "github:numtide/flake-utils";1930 };1931 1932 outputs = { self, flake-utils }: {1933 # Test flake with updatable input1934 };1935 }"""1936 1937 (tmp_path / "flake.nix").write_text(flake_content)1938 1939 shutil.copy(1940 fixtures_path / "minimal" / "flake.lock",1941 tmp_path / "flake.lock",1942 )1943 1944 _setup_git_repo(tmp_path)1945 1946 original_cwd = Path.cwd()1947 os.chdir(tmp_path)1948 1949 try:1950 # FailingFlakeService injects "bad-input" during discovery and1951 # raises when asked to update it, simulating a 403 or dead ref1952 flake_service = FailingFlakeService(fail_inputs=["bad-input"])1953 test_gitea_service = MockGiteaService()1954 1955> with pytest.raises(UpdateFlakeInputsError, match="Failed to process 1 input"):1956 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^1957E AssertionError: Regex pattern did not match.1958E Expected regex: 'Failed to process 1 input'1959E Actual message: 'Failed to process 2 input(s): bad-input in flake.nix, flake-utils in flake.nix'19601961tests/test_process_flake_updates.py:596: AssertionError1962----------------------------- Captured stdout call -----------------------------1963Initialized empty Git repository in /build/pytest-of-nixbld/pytest-0/test_fails_at_end_when_individ0/.git/1964[main (root-commit) bc49a72] Initial commit1965 2 files changed, 53 insertions(+)1966 create mode 100644 flake.lock1967 create mode 100644 flake.nix1968Initialized empty Git repository in /build/pytest-of-nixbld/pytest-0/remote-test_fails_at_end_when_individ0.git/1969branch 'main' set up to track 'origin/main'.1970branch 'update-bad-input' set up to track 'origin/main'.1971HEAD is now at bc49a72 Initial commit1972branch 'update-flake-utils' set up to track 'origin/main'.1973HEAD is now at bc49a72 Initial commit1974----------------------------- Captured stderr call -----------------------------1975hint: Using 'master' as the name for the initial branch. This default branch name1976hint: will change to "main" in Git 3.0. To configure the initial branch name1977hint: to use in all of your new repositories, which will suppress this warning,1978hint: call:1979hint:1980hint: git config --global init.defaultBranch <name>1981hint:1982hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and1983hint: 'development'. The just-created branch can be renamed via this command:1984hint:1985hint: git branch -m <name>1986hint:1987hint: Disable this message with "git config set advice.defaultBranchName false"1988To /build/pytest-of-nixbld/pytest-0/remote-test_fails_at_end_when_individ0.git1989 * [new branch] main -> main1990From /build/pytest-of-nixbld/pytest-0/remote-test_fails_at_end_when_individ01991 * branch main -> FETCH_HEAD1992Preparing worktree (new branch 'update-bad-input')1993From /build/pytest-of-nixbld/pytest-0/remote-test_fails_at_end_when_individ01994 * branch main -> FETCH_HEAD1995Preparing worktree (new branch 'update-flake-utils')1996------------------------------ Captured log call -------------------------------1997ERROR update_flake_inputs.cli:cli.py:259 Failed to update input bad-input in flake.nix1998Traceback (most recent call last):1999 File "/build/src/src/update_flake_inputs/cli.py", line 223, in process_flake_updates2000 flake_service.update_flake_input(2001 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^2002 input_name,2003 ^^^^^^^^^^^2004 flake.file_path,2005 ^^^^^^^^^^^^^^^^2006 str(worktree_path),2007 ^^^^^^^^^^^^^^^^^^^2008 )2009 ^2010 File "/build/src/tests/test_process_flake_updates.py", line 635, in update_flake_input2011 raise FlakeServiceError(msg)2012update_flake_inputs.exceptions.FlakeServiceError: Simulated failure updating bad-input2013ERROR update_flake_inputs.flake_service:flake_service.py:223 Failed to update flake input flake-utils in flake.nix. Exit code: 12014Stdout: No stdout output2015Stderr: warning: you don't have Internet access; disabling some network-dependent features2016error:2017 … while updating the lock file of flake 'git+file:///build/flake-update-w3p66wv9/update-flake-utils?ref=refs/heads/update-flake-utils&rev=bc49a72e621bc5271b72dd579798ce81e3c52dfb&shallow=1'20182019 … while updating the flake input 'flake-utils'20202021 … while fetching the input 'github:numtide/flake-utils'20222023 error: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com2024Traceback (most recent call last):2025 File "/build/src/src/update_flake_inputs/flake_service.py", line 191, in update_flake_input2026 result = subprocess.run(2027 [2028 ...<10 lines>...2029 check=True,2030 )2031 File "/nix/store/n2fvjv22hixzfbqj1cm6cgl44nwz9z1n-python3-3.13.14-env/lib/python3.13/subprocess.py", line 577, in run2032 raise CalledProcessError(retcode, process.args,2033 output=stdout, stderr=stderr)2034subprocess.CalledProcessError: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/flake-update-w3p66wv9/update-flake-utils?shallow=1', 'flake-utils']' returned non-zero exit status 1.2035ERROR update_flake_inputs.cli:cli.py:259 Failed to update input flake-utils in flake.nix2036Traceback (most recent call last):2037 File "/build/src/src/update_flake_inputs/flake_service.py", line 191, in update_flake_input2038 result = subprocess.run(2039 [2040 ...<10 lines>...2041 check=True,2042 )2043 File "/nix/store/n2fvjv22hixzfbqj1cm6cgl44nwz9z1n-python3-3.13.14-env/lib/python3.13/subprocess.py", line 577, in run2044 raise CalledProcessError(retcode, process.args,2045 output=stdout, stderr=stderr)2046subprocess.CalledProcessError: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/flake-update-w3p66wv9/update-flake-utils?shallow=1', 'flake-utils']' returned non-zero exit status 1.20472048The above exception was the direct cause of the following exception:20492050Traceback (most recent call last):2051 File "/build/src/src/update_flake_inputs/cli.py", line 223, in process_flake_updates2052 flake_service.update_flake_input(2053 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^2054 input_name,2055 ^^^^^^^^^^^2056 flake.file_path,2057 ^^^^^^^^^^^^^^^^2058 str(worktree_path),2059 ^^^^^^^^^^^^^^^^^^^2060 )2061 ^2062 File "/build/src/tests/test_process_flake_updates.py", line 636, in update_flake_input2063 super().update_flake_input(input_name, flake_file, work_dir)2064 ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^2065 File "/build/src/src/update_flake_inputs/flake_service.py", line 235, in update_flake_input2066 raise FlakeServiceError(msg) from e2067update_flake_inputs.exceptions.FlakeServiceError: Failed to update flake input flake-utils in flake.nix: Command '['nix', 'flake', 'update', '--flake', 'git+file:///build/flake-update-w3p66wv9/update-flake-utils?shallow=1', 'flake-utils']' returned non-zero exit status 1.2068Stderr: warning: you don't have Internet access; disabling some network-dependent features2069error:2070 … while updating the lock file of flake 'git+file:///build/flake-update-w3p66wv9/update-flake-utils?ref=refs/heads/update-flake-utils&rev=bc49a72e621bc5271b72dd579798ce81e3c52dfb&shallow=1'20712072 … while updating the flake input 'flake-utils'20732074 … while fetching the input 'github:numtide/flake-utils'20752076 error: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com2077=========================== short test summary info ============================2078FAILED tests/test_flake_service.py::TestFlakeService::test_update_flake_input2079FAILED tests/test_flake_service.py::TestFlakeService::test_update_subflake_input2080FAILED tests/test_process_flake_updates.py::TestProcessFlakeUpdates::test_with_updatable_flake_input2081FAILED tests/test_process_flake_updates.py::TestProcessFlakeUpdates::test_worktree_based_on_base_branch_not_head2082FAILED tests/test_process_flake_updates.py::TestProcessFlakeUpdates::test_custom_git_author_committer2083FAILED tests/test_process_flake_updates.py::TestProcessFlakeUpdates::test_branch_suffix2084FAILED tests/test_process_flake_updates.py::TestProcessFlakeUpdates::test_fails_at_end_when_individual_input_fails20857 failed, 16 passed in 3.62s