nixbot

builds
1tribuchet: building on mac022....FF...........FFFF.F [100%]3=================================== FAILURES ===================================4___________________ TestFlakeService.test_update_flake_input ___________________56self = <update_flake_inputs.flake_service.FlakeService object at 0x10ae5b230>7input_name = 'flake-utils', flake_file = 'flake.nix'8work_dir = '/private/var/tb/8/scratch/b7a284bab7282824/build/tmpcx838pkf'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:///private/var/tb/8/scratch/b7a284bab7282824/build/tmpcx838pkf?shallow=1', 'flake-utils'],)65kwargs = {'cwd': '/private/var/tb/8/scratch/b7a284bab7282824/build/tmpcx838pkf', 'text': True, 'stdout': -1, 'stderr': -1}6667 def run(*popenargs,68 input=None, capture_output=False, timeout=None, check=False, **kwargs):69 """Run command with arguments and return a CompletedProcess instance.70 71 The returned instance will have attributes args, returncode, stdout and72 stderr. By default, stdout and stderr are not captured, and those attributes73 will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them,74 or pass capture_output=True to capture both.75 76 If check is True and the exit code was non-zero, it raises a77 CalledProcessError. The CalledProcessError object will have the return code78 in the returncode attribute, and output & stderr attributes if those streams79 were captured.80 81 If timeout (seconds) is given and the process takes too long,82 a TimeoutExpired exception will be raised.83 84 There is an optional argument "input", allowing you to85 pass bytes or a string to the subprocess's stdin. If you use this argument86 you may not also use the Popen constructor's "stdin" argument, as87 it will be used internally.88 89 By default, all communication is in bytes, and therefore any "input" should90 be bytes, and the stdout and stderr will be bytes. If in text mode, any91 "input" should be a string, and stdout and stderr will be strings decoded92 according to locale encoding, or by "encoding" if set. Text mode is93 triggered by setting any of text, encoding, errors or universal_newlines.94 95 The other arguments are the same as for the Popen constructor.96 """97 if input is not None:98 if kwargs.get('stdin') is not None:99 raise ValueError('stdin and input arguments may not both be used.')100 kwargs['stdin'] = PIPE101 102 if capture_output:103 if kwargs.get('stdout') is not None or kwargs.get('stderr') is not None:104 raise ValueError('stdout and stderr arguments may not be used '105 'with capture_output.')106 kwargs['stdout'] = PIPE107 kwargs['stderr'] = PIPE108 109 with Popen(*popenargs, **kwargs) as process:110 try:111 stdout, stderr = process.communicate(input, timeout=timeout)112 except TimeoutExpired as exc:113 process.kill()114 if _mswindows:115 # Windows accumulates the output in a single blocking116 # read() call run on child threads, with the timeout117 # being done in a join() on those threads. communicate()118 # _after_ kill() is required to collect that and add it119 # to the exception.120 exc.stdout, exc.stderr = process.communicate()121 else:122 # POSIX _communicate already populated the output so123 # far into the TimeoutExpired exception.124 process.wait()125 raise126 except: # Including KeyboardInterrupt, communicate handled that.127 process.kill()128 # We don't call process.wait() as .__exit__ does that for us.129 raise130 retcode = process.poll()131 if check and retcode:132> raise CalledProcessError(retcode, process.args,133 output=stdout, stderr=stderr)134E subprocess.CalledProcessError: Command '['nix', 'flake', 'update', '--flake', 'git+file:///private/var/tb/8/scratch/b7a284bab7282824/build/tmpcx838pkf?shallow=1', 'flake-utils']' returned non-zero exit status 1.135136/nix/store/v82ka64d1qcm6hmydyx244nyqbngccxv-python3-3.13.15-env/lib/python3.13/subprocess.py:577: CalledProcessError137138The above exception was the direct cause of the following exception:139140self = <tests.test_flake_service.TestFlakeService object at 0x10aecf890>141flake_service = <update_flake_inputs.flake_service.FlakeService object at 0x10ae5b230>142fixtures_path = PosixPath('/private/var/tb/8/scratch/b7a284bab7282824/build/src/tests/fixtures')143144 @pytest.mark.impure145 def test_update_flake_input(146 self,147 flake_service: FlakeService,148 fixtures_path: Path,149 ) -> None:150 """Test updating a flake input and modifying the lock file."""151 # Create a temporary directory for the test152 with tempfile.TemporaryDirectory() as temp_dir:153 temp_path = Path(temp_dir)154 155 # Copy minimal flake to temp directory156 shutil.copy(157 fixtures_path / "minimal" / "flake.nix",158 temp_path / "flake.nix",159 )160 shutil.copy(161 fixtures_path / "minimal" / "flake.lock",162 temp_path / "flake.lock",163 )164 165 # Initialize git repo in temp directory166 subprocess.run(["git", "init"], cwd=temp_path, check=True)167 subprocess.run(["git", "add", "."], cwd=temp_path, check=True)168 subprocess.run(169 ["git", "commit", "-m", "Initial commit"],170 cwd=temp_path,171 check=True,172 env={173 **os.environ,174 "GIT_AUTHOR_NAME": "Test User",175 "GIT_AUTHOR_EMAIL": "test@example.com",176 "GIT_COMMITTER_NAME": "Test User",177 "GIT_COMMITTER_EMAIL": "test@example.com",178 },179 )180 181 # Get the original lock file content182 original_lock_content = (temp_path / "flake.lock").read_text()183 original_lock = json.loads(original_lock_content)184 original_flake_utils_rev = original_lock["nodes"]["flake-utils"]["locked"]["rev"]185 186 # Update flake-utils input187> flake_service.update_flake_input("flake-utils", "flake.nix", str(temp_path))188189tests/test_flake_service.py:198: 190_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 191192self = <update_flake_inputs.flake_service.FlakeService object at 0x10ae5b230>193input_name = 'flake-utils', flake_file = 'flake.nix'194work_dir = '/private/var/tb/8/scratch/b7a284bab7282824/build/tmpcx838pkf'195196 def update_flake_input(197 self,198 input_name: str,199 flake_file: str,200 work_dir: str | None = None,201 ) -> None:202 """Update a specific flake input.203 204 Args:205 input_name: Name of the input to update206 flake_file: Path to the flake file207 work_dir: Optional working directory to resolve flake file path from208 209 """210 try:211 logger.info("Updating flake input: %s in %s", input_name, flake_file)212 213 # If work_dir is provided, resolve the flake file relative to it214 absolute_flake_path = Path(work_dir) / flake_file if work_dir else Path(flake_file)215 216 flake_dir = absolute_flake_path.parent or Path()217 absolute_flake_dir = flake_dir.resolve()218 219 # Use a shallow URL because worktrees may not have the full history.220 # For subflakes, nix needs the URL to point to the git root221 # with a dir= parameter rather than the subdirectory directly.222 if work_dir:223 git_root = Path(work_dir).resolve()224 relative_dir = absolute_flake_dir.relative_to(git_root)225 flake_url = f"git+file://{git_root}?shallow=1"226 if str(relative_dir) != ".":227 flake_url += f"&dir={relative_dir}"228 else:229 flake_url = f"git+file://{absolute_flake_dir}?shallow=1"230 231 result = subprocess.run(232 [233 "nix",234 "flake",235 "update",236 "--flake",237 flake_url,238 input_name,239 ],240 cwd=str(flake_dir),241 capture_output=True,242 text=True,243 check=True,244 )245 246 # Check if there was a warning about non-existent input247 if result.stderr and "does not match any input" in result.stderr:248 logger.warning(249 "Failed to update input %s in %s: %s",250 input_name,251 flake_file,252 result.stderr.strip(),253 )254 255 logger.info(256 "Successfully updated flake input: %s in %s",257 input_name,258 flake_file,259 )260 except subprocess.CalledProcessError as e:261 stderr_output = e.stderr.strip() if e.stderr else "No stderr output"262 stdout_output = e.stdout.strip() if e.stdout else "No stdout output"263 logger.exception(264 "Failed to update flake input %s in %s. Exit code: %d\nStdout: %s\nStderr: %s",265 input_name,266 flake_file,267 e.returncode,268 stdout_output,269 stderr_output,270 )271 msg = (272 f"Failed to update flake input {input_name} in {flake_file}: {e}\n"273 f"Stderr: {stderr_output}"274 )275> raise FlakeServiceError(msg) from e276E update_flake_inputs.exceptions.FlakeServiceError: Failed to update flake input flake-utils in flake.nix: Command '['nix', 'flake', 'update', '--flake', 'git+file:///private/var/tb/8/scratch/b7a284bab7282824/build/tmpcx838pkf?shallow=1', 'flake-utils']' returned non-zero exit status 1.277E Stderr: warning: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com; retrying in 328 ms (attempt 1/5)278E warning: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com; retrying in 657 ms (attempt 2/5)279E warning: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com; retrying in 1294 ms (attempt 3/5)280E warning: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com; retrying in 2770 ms (attempt 4/5)281E error:282E … while updating the lock file of flake 'git+file:///private/var/tb/8/scratch/b7a284bab7282824/build/tmpcx838pkf?ref=refs/heads/master&rev=5aedc5aa8c43094df731c89124e6371b35424cc0&shallow=1'283E 284E … while updating the flake input 'flake-utils'285E 286E … while fetching the input 'github:numtide/flake-utils'287E 288E 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.com289290src/update_flake_inputs/flake_service.py:235: FlakeServiceError291----------------------------- Captured stdout call -----------------------------292Initialized empty Git repository in /private/var/tb/8/scratch/b7a284bab7282824/build/tmpcx838pkf/.git/293[master (root-commit) 5aedc5a] Initial commit294 2 files changed, 55 insertions(+)295 create mode 100644 flake.lock296 create mode 100644 flake.nix297----------------------------- Captured stderr call -----------------------------298hint: Using 'master' as the name for the initial branch. This default branch name299hint: will change to "main" in Git 3.0. To configure the initial branch name300hint: to use in all of your new repositories, which will suppress this warning,301hint: call:302hint:303hint: git config --global init.defaultBranch <name>304hint:305hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and306hint: 'development'. The just-created branch can be renamed via this command:307hint:308hint: git branch -m <name>309hint:310hint: Disable this message with "git config set advice.defaultBranchName false"311------------------------------ Captured log call -------------------------------312ERROR update_flake_inputs.flake_service:flake_service.py:223 Failed to update flake input flake-utils in flake.nix. Exit code: 1313Stdout: No stdout output314Stderr: warning: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com; retrying in 328 ms (attempt 1/5)315warning: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com; retrying in 657 ms (attempt 2/5)316warning: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com; retrying in 1294 ms (attempt 3/5)317warning: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com; retrying in 2770 ms (attempt 4/5)318error:319 … while updating the lock file of flake 'git+file:///private/var/tb/8/scratch/b7a284bab7282824/build/tmpcx838pkf?ref=refs/heads/master&rev=5aedc5aa8c43094df731c89124e6371b35424cc0&shallow=1'320321 … while updating the flake input 'flake-utils'322323 … while fetching the input 'github:numtide/flake-utils'324325 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.com326Traceback (most recent call last):327 File "/private/var/tb/8/scratch/b7a284bab7282824/build/src/src/update_flake_inputs/flake_service.py", line 191, in update_flake_input328 result = subprocess.run(329 [330 ...<10 lines>...331 check=True,332 )333 File "/nix/store/v82ka64d1qcm6hmydyx244nyqbngccxv-python3-3.13.15-env/lib/python3.13/subprocess.py", line 577, in run334 raise CalledProcessError(retcode, process.args,335 output=stdout, stderr=stderr)336subprocess.CalledProcessError: Command '['nix', 'flake', 'update', '--flake', 'git+file:///private/var/tb/8/scratch/b7a284bab7282824/build/tmpcx838pkf?shallow=1', 'flake-utils']' returned non-zero exit status 1.337_________________ TestFlakeService.test_update_subflake_input __________________338339self = <update_flake_inputs.flake_service.FlakeService object at 0x10b30fad0>340input_name = 'flake-utils', flake_file = 'flake.nix'341work_dir = '/private/var/tb/8/scratch/b7a284bab7282824/build/tmp9ehvgs3o'342343 def update_flake_input(344 self,345 input_name: str,346 flake_file: str,347 work_dir: str | None = None,348 ) -> None:349 """Update a specific flake input.350 351 Args:352 input_name: Name of the input to update353 flake_file: Path to the flake file354 work_dir: Optional working directory to resolve flake file path from355 356 """357 try:358 logger.info("Updating flake input: %s in %s", input_name, flake_file)359 360 # If work_dir is provided, resolve the flake file relative to it361 absolute_flake_path = Path(work_dir) / flake_file if work_dir else Path(flake_file)362 363 flake_dir = absolute_flake_path.parent or Path()364 absolute_flake_dir = flake_dir.resolve()365 366 # Use a shallow URL because worktrees may not have the full history.367 # For subflakes, nix needs the URL to point to the git root368 # with a dir= parameter rather than the subdirectory directly.369 if work_dir:370 git_root = Path(work_dir).resolve()371 relative_dir = absolute_flake_dir.relative_to(git_root)372 flake_url = f"git+file://{git_root}?shallow=1"373 if str(relative_dir) != ".":374 flake_url += f"&dir={relative_dir}"375 else:376 flake_url = f"git+file://{absolute_flake_dir}?shallow=1"377 378> result = subprocess.run(379 [380 "nix",381 "flake",382 "update",383 "--flake",384 flake_url,385 input_name,386 ],387 cwd=str(flake_dir),388 capture_output=True,389 text=True,390 check=True,391 )392393src/update_flake_inputs/flake_service.py:191: 394_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 395396input = None, capture_output = True, timeout = None, check = True397popenargs = (['nix', 'flake', 'update', '--flake', 'git+file:///private/var/tb/8/scratch/b7a284bab7282824/build/tmp9ehvgs3o?shallow=1', 'flake-utils'],)398kwargs = {'cwd': '/private/var/tb/8/scratch/b7a284bab7282824/build/tmp9ehvgs3o', 'text': True, 'stdout': -1, 'stderr': -1}399400 def run(*popenargs,401 input=None, capture_output=False, timeout=None, check=False, **kwargs):402 """Run command with arguments and return a CompletedProcess instance.403 404 The returned instance will have attributes args, returncode, stdout and405 stderr. By default, stdout and stderr are not captured, and those attributes406 will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them,407 or pass capture_output=True to capture both.408 409 If check is True and the exit code was non-zero, it raises a410 CalledProcessError. The CalledProcessError object will have the return code411 in the returncode attribute, and output & stderr attributes if those streams412 were captured.413 414 If timeout (seconds) is given and the process takes too long,415 a TimeoutExpired exception will be raised.416 417 There is an optional argument "input", allowing you to418 pass bytes or a string to the subprocess's stdin. If you use this argument419 you may not also use the Popen constructor's "stdin" argument, as420 it will be used internally.421 422 By default, all communication is in bytes, and therefore any "input" should423 be bytes, and the stdout and stderr will be bytes. If in text mode, any424 "input" should be a string, and stdout and stderr will be strings decoded425 according to locale encoding, or by "encoding" if set. Text mode is426 triggered by setting any of text, encoding, errors or universal_newlines.427 428 The other arguments are the same as for the Popen constructor.429 """430 if input is not None:431 if kwargs.get('stdin') is not None:432 raise ValueError('stdin and input arguments may not both be used.')433 kwargs['stdin'] = PIPE434 435 if capture_output:436 if kwargs.get('stdout') is not None or kwargs.get('stderr') is not None:437 raise ValueError('stdout and stderr arguments may not be used '438 'with capture_output.')439 kwargs['stdout'] = PIPE440 kwargs['stderr'] = PIPE441 442 with Popen(*popenargs, **kwargs) as process:443 try:444 stdout, stderr = process.communicate(input, timeout=timeout)445 except TimeoutExpired as exc:446 process.kill()447 if _mswindows:448 # Windows accumulates the output in a single blocking449 # read() call run on child threads, with the timeout450 # being done in a join() on those threads. communicate()451 # _after_ kill() is required to collect that and add it452 # to the exception.453 exc.stdout, exc.stderr = process.communicate()454 else:455 # POSIX _communicate already populated the output so456 # far into the TimeoutExpired exception.457 process.wait()458 raise459 except: # Including KeyboardInterrupt, communicate handled that.460 process.kill()461 # We don't call process.wait() as .__exit__ does that for us.462 raise463 retcode = process.poll()464 if check and retcode:465> raise CalledProcessError(retcode, process.args,466 output=stdout, stderr=stderr)467E subprocess.CalledProcessError: Command '['nix', 'flake', 'update', '--flake', 'git+file:///private/var/tb/8/scratch/b7a284bab7282824/build/tmp9ehvgs3o?shallow=1', 'flake-utils']' returned non-zero exit status 1.468469/nix/store/v82ka64d1qcm6hmydyx244nyqbngccxv-python3-3.13.15-env/lib/python3.13/subprocess.py:577: CalledProcessError470471The above exception was the direct cause of the following exception:472473self = <tests.test_flake_service.TestFlakeService object at 0x10af02250>474flake_service = <update_flake_inputs.flake_service.FlakeService object at 0x10b30fad0>475fixtures_path = PosixPath('/private/var/tb/8/scratch/b7a284bab7282824/build/src/tests/fixtures')476477 @pytest.mark.impure478 def test_update_subflake_input(479 self,480 flake_service: FlakeService,481 fixtures_path: Path,482 ) -> None:483 """Test updating a flake input in a subdirectory (subflake)."""484 with tempfile.TemporaryDirectory() as temp_dir:485 temp_path = Path(temp_dir)486 487 # Copy minimal flake to a subdirectory488 sub_dir = temp_path / "sub"489 sub_dir.mkdir()490 shutil.copy(491 fixtures_path / "minimal" / "flake.nix",492 sub_dir / "flake.nix",493 )494 shutil.copy(495 fixtures_path / "minimal" / "flake.lock",496 sub_dir / "flake.lock",497 )498 499 # Copy minimal flake to root500 shutil.copy(501 fixtures_path / "minimal" / "flake.nix",502 temp_path / "flake.nix",503 )504 shutil.copy(505 fixtures_path / "minimal" / "flake.lock",506 temp_path / "flake.lock",507 )508 509 # Initialize git repo in temp directory510 subprocess.run(["git", "init"], cwd=temp_path, check=True)511 subprocess.run(["git", "add", "."], cwd=temp_path, check=True)512 subprocess.run(513 ["git", "commit", "-m", "Initial commit"],514 cwd=temp_path,515 check=True,516 env={517 **os.environ,518 "GIT_AUTHOR_NAME": "Test User",519 "GIT_AUTHOR_EMAIL": "test@example.com",520 "GIT_COMMITTER_NAME": "Test User",521 "GIT_COMMITTER_EMAIL": "test@example.com",522 },523 )524 525 original_root_lock = json.loads((temp_path / "flake.lock").read_text())526 original_root_rev = original_root_lock["nodes"]["flake-utils"]["locked"]["rev"]527 528 original_sub_lock = json.loads((sub_dir / "flake.lock").read_text())529 original_sub_rev = original_sub_lock["nodes"]["flake-utils"]["locked"]["rev"]530 531 # Update flake-utils in the root flake532> flake_service.update_flake_input("flake-utils", "flake.nix", str(temp_path))533534tests/test_flake_service.py:272: 535_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 536537self = <update_flake_inputs.flake_service.FlakeService object at 0x10b30fad0>538input_name = 'flake-utils', flake_file = 'flake.nix'539work_dir = '/private/var/tb/8/scratch/b7a284bab7282824/build/tmp9ehvgs3o'540541 def update_flake_input(542 self,543 input_name: str,544 flake_file: str,545 work_dir: str | None = None,546 ) -> None:547 """Update a specific flake input.548 549 Args:550 input_name: Name of the input to update551 flake_file: Path to the flake file552 work_dir: Optional working directory to resolve flake file path from553 554 """555 try:556 logger.info("Updating flake input: %s in %s", input_name, flake_file)557 558 # If work_dir is provided, resolve the flake file relative to it559 absolute_flake_path = Path(work_dir) / flake_file if work_dir else Path(flake_file)560 561 flake_dir = absolute_flake_path.parent or Path()562 absolute_flake_dir = flake_dir.resolve()563 564 # Use a shallow URL because worktrees may not have the full history.565 # For subflakes, nix needs the URL to point to the git root566 # with a dir= parameter rather than the subdirectory directly.567 if work_dir:568 git_root = Path(work_dir).resolve()569 relative_dir = absolute_flake_dir.relative_to(git_root)570 flake_url = f"git+file://{git_root}?shallow=1"571 if str(relative_dir) != ".":572 flake_url += f"&dir={relative_dir}"573 else:574 flake_url = f"git+file://{absolute_flake_dir}?shallow=1"575 576 result = subprocess.run(577 [578 "nix",579 "flake",580 "update",581 "--flake",582 flake_url,583 input_name,584 ],585 cwd=str(flake_dir),586 capture_output=True,587 text=True,588 check=True,589 )590 591 # Check if there was a warning about non-existent input592 if result.stderr and "does not match any input" in result.stderr:593 logger.warning(594 "Failed to update input %s in %s: %s",595 input_name,596 flake_file,597 result.stderr.strip(),598 )599 600 logger.info(601 "Successfully updated flake input: %s in %s",602 input_name,603 flake_file,604 )605 except subprocess.CalledProcessError as e:606 stderr_output = e.stderr.strip() if e.stderr else "No stderr output"607 stdout_output = e.stdout.strip() if e.stdout else "No stdout output"608 logger.exception(609 "Failed to update flake input %s in %s. Exit code: %d\nStdout: %s\nStderr: %s",610 input_name,611 flake_file,612 e.returncode,613 stdout_output,614 stderr_output,615 )616 msg = (617 f"Failed to update flake input {input_name} in {flake_file}: {e}\n"618 f"Stderr: {stderr_output}"619 )620> raise FlakeServiceError(msg) from e621E update_flake_inputs.exceptions.FlakeServiceError: Failed to update flake input flake-utils in flake.nix: Command '['nix', 'flake', 'update', '--flake', 'git+file:///private/var/tb/8/scratch/b7a284bab7282824/build/tmp9ehvgs3o?shallow=1', 'flake-utils']' returned non-zero exit status 1.622E Stderr: warning: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com; retrying in 301 ms (attempt 1/5)623E warning: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com; retrying in 690 ms (attempt 2/5)624E warning: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com; retrying in 1280 ms (attempt 3/5)625E warning: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com; retrying in 2828 ms (attempt 4/5)626E error:627E … while updating the lock file of flake 'git+file:///private/var/tb/8/scratch/b7a284bab7282824/build/tmp9ehvgs3o?ref=refs/heads/master&rev=b17e57897837272d25d59e8fcbf848dce4c866cf&shallow=1'628E 629E … while updating the flake input 'flake-utils'630E 631E … while fetching the input 'github:numtide/flake-utils'632E 633E 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.com634635src/update_flake_inputs/flake_service.py:235: FlakeServiceError636----------------------------- Captured stdout call -----------------------------637Initialized empty Git repository in /private/var/tb/8/scratch/b7a284bab7282824/build/tmp9ehvgs3o/.git/638[master (root-commit) b17e578] Initial commit639 4 files changed, 110 insertions(+)640 create mode 100644 flake.lock641 create mode 100644 flake.nix642 create mode 100644 sub/flake.lock643 create mode 100644 sub/flake.nix644----------------------------- Captured stderr call -----------------------------645hint: Using 'master' as the name for the initial branch. This default branch name646hint: will change to "main" in Git 3.0. To configure the initial branch name647hint: to use in all of your new repositories, which will suppress this warning,648hint: call:649hint:650hint: git config --global init.defaultBranch <name>651hint:652hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and653hint: 'development'. The just-created branch can be renamed via this command:654hint:655hint: git branch -m <name>656hint:657hint: Disable this message with "git config set advice.defaultBranchName false"658------------------------------ Captured log call -------------------------------659ERROR update_flake_inputs.flake_service:flake_service.py:223 Failed to update flake input flake-utils in flake.nix. Exit code: 1660Stdout: No stdout output661Stderr: warning: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com; retrying in 301 ms (attempt 1/5)662warning: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com; retrying in 690 ms (attempt 2/5)663warning: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com; retrying in 1280 ms (attempt 3/5)664warning: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com; retrying in 2828 ms (attempt 4/5)665error:666 … while updating the lock file of flake 'git+file:///private/var/tb/8/scratch/b7a284bab7282824/build/tmp9ehvgs3o?ref=refs/heads/master&rev=b17e57897837272d25d59e8fcbf848dce4c866cf&shallow=1'667668 … while updating the flake input 'flake-utils'669670 … while fetching the input 'github:numtide/flake-utils'671672 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.com673Traceback (most recent call last):674 File "/private/var/tb/8/scratch/b7a284bab7282824/build/src/src/update_flake_inputs/flake_service.py", line 191, in update_flake_input675 result = subprocess.run(676 [677 ...<10 lines>...678 check=True,679 )680 File "/nix/store/v82ka64d1qcm6hmydyx244nyqbngccxv-python3-3.13.15-env/lib/python3.13/subprocess.py", line 577, in run681 raise CalledProcessError(retcode, process.args,682 output=stdout, stderr=stderr)683subprocess.CalledProcessError: Command '['nix', 'flake', 'update', '--flake', 'git+file:///private/var/tb/8/scratch/b7a284bab7282824/build/tmp9ehvgs3o?shallow=1', 'flake-utils']' returned non-zero exit status 1.684___________ TestProcessFlakeUpdates.test_with_updatable_flake_input ____________685686self = <tests.test_process_flake_updates.TestProcessFlakeUpdates object at 0x10b2d1450>687tmp_path = PosixPath('/private/var/tb/8/scratch/b7a284bab7282824/build/pytest-of-_tribuchetbld8/pytest-0/test_with_updatable_flake_inpu0')688fixtures_path = PosixPath('/private/var/tb/8/scratch/b7a284bab7282824/build/src/tests/fixtures')689690 @pytest.mark.impure691 def test_with_updatable_flake_input(692 self,693 tmp_path: Path,694 fixtures_path: Path,695 ) -> None:696 """Test PR creation when flake input has available updates."""697 # Create a flake with flake-utils that can be updated698 flake_content = """{699 inputs = {700 flake-utils.url = "github:numtide/flake-utils";701 };702 703 outputs = { self, flake-utils }: {704 # Test flake with updatable input705 };706 }"""707 708 (tmp_path / "flake.nix").write_text(flake_content)709 710 # Copy old lock file from minimal fixture711 shutil.copy(712 fixtures_path / "minimal" / "flake.lock",713 tmp_path / "flake.lock",714 )715 716 _setup_git_repo(tmp_path)717 718 # Change to test directory719 original_cwd = Path.cwd()720 os.chdir(tmp_path)721 722 try:723 # Create test services724 flake_service = FlakeService()725 test_gitea_service = MockGiteaService()726 727 # Process updates728> process_flake_updates(729 flake_service,730 test_gitea_service,731 "",732 "main",733 "",734 auto_merge=False,735 )736737tests/test_process_flake_updates.py:222: 738_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 739740flake_service = <update_flake_inputs.flake_service.FlakeService object at 0x10b2e1750>741gitea_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=[])742exclude_patterns = '', base_branch = 'main', branch_suffix = ''743auto_merge = False744745 def process_flake_updates( # noqa: PLR0913746 flake_service: FlakeService,747 gitea_service: GiteaService,748 exclude_patterns: str,749 base_branch: str,750 branch_suffix: str,751 *,752 auto_merge: bool,753 ) -> None:754 """Process all flake updates.755 756 Args:757 flake_service: Flake service instance758 gitea_service: Gitea service instance759 exclude_patterns: Patterns to exclude760 base_branch: Base branch for PRs761 branch_suffix: Optional suffix to append to branch names762 auto_merge: Whether to automatically merge PRs763 764 """765 # Discover flake files766 flakes = flake_service.discover_flake_files(exclude_patterns)767 if not flakes:768 logger.info("No flake files found")769 return770 771 logger.info("Found %d flake files to process", len(flakes))772 773 failed_inputs: list[str] = []774 775 # Process each flake776 for flake in flakes:777 logger.info("Processing flake: %s", flake.file_path)778 logger.info("Inputs to update: %s", ", ".join(flake.inputs))779 780 # Don't include '.' for root directory781 parent_path = Path(flake.file_path).parent782 parent_suffix = "" if parent_path == Path() else f" in {parent_path}"783 parent_branch = "" if parent_path == Path() else f"-{parent_path}"784 suffix = branch_suffix.strip().replace("/", "-").strip("-")785 786 # Update each input787 for input_name in flake.inputs:788 try:789 branch_name = f"update{parent_branch}-{input_name}"790 branch_name = branch_name.replace("/", "-").strip("-")791 if suffix:792 branch_name = f"{branch_name}-{suffix}"793 794 logger.info(795 "Updating input %s in %s (branch: %s)",796 input_name,797 flake.file_path,798 branch_name,799 )800 801 # Create worktree and update input802 with gitea_service.worktree(branch_name, base_branch) as worktree_path:803 # Update the input804 flake_service.update_flake_input(805 input_name,806 flake.file_path,807 str(worktree_path),808 )809 810 # Commit changes811 commit_message = f"Update {input_name}{parent_suffix}"812 if gitea_service.commit_changes(813 branch_name,814 commit_message,815 worktree_path,816 ):817 # Create pull request818 pr_title = commit_message819 pr_body = (820 f"This PR updates the `{input_name}` input "821 f"in `{flake.file_path}`.\n\n"822 "Generated by update-flake-inputs action."823 )824 gitea_service.create_pull_request(825 branch_name,826 base_branch,827 pr_title,828 pr_body,829 auto_merge=auto_merge,830 )831 else:832 logger.info(833 "No changes for input %s in %s",834 input_name,835 flake.file_path,836 )837 gitea_service.delete_branch(branch_name)838 839 except Exception:840 logger.exception(841 "Failed to update input %s in %s",842 input_name,843 flake.file_path,844 )845 failed_inputs.append(f"{input_name} in {flake.file_path}")846 847 if failed_inputs:848 msg = f"Failed to process {len(failed_inputs)} input(s): {', '.join(failed_inputs)}"849> raise UpdateFlakeInputsError(msg)850E update_flake_inputs.exceptions.UpdateFlakeInputsError: Failed to process 1 input(s): flake-utils in flake.nix851852src/update_flake_inputs/cli.py:268: UpdateFlakeInputsError853----------------------------- Captured stdout call -----------------------------854Initialized empty Git repository in /private/var/tb/8/scratch/b7a284bab7282824/build/pytest-of-_tribuchetbld8/pytest-0/test_with_updatable_flake_inpu0/.git/855[main (root-commit) c9b8810] Initial commit856 2 files changed, 53 insertions(+)857 create mode 100644 flake.lock858 create mode 100644 flake.nix859Initialized empty Git repository in /private/var/tb/8/scratch/b7a284bab7282824/build/pytest-of-_tribuchetbld8/pytest-0/remote-test_with_updatable_flake_inpu0.git/860branch 'main' set up to track 'origin/main'.861branch 'update-flake-utils' set up to track 'origin/main'.862HEAD is now at c9b8810 Initial commit863----------------------------- Captured stderr call -----------------------------864hint: Using 'master' as the name for the initial branch. This default branch name865hint: will change to "main" in Git 3.0. To configure the initial branch name866hint: to use in all of your new repositories, which will suppress this warning,867hint: call:868hint:869hint: git config --global init.defaultBranch <name>870hint:871hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and872hint: 'development'. The just-created branch can be renamed via this command:873hint:874hint: git branch -m <name>875hint:876hint: Disable this message with "git config set advice.defaultBranchName false"877To /private/var/tb/8/scratch/b7a284bab7282824/build/pytest-of-_tribuchetbld8/pytest-0/remote-test_with_updatable_flake_inpu0.git878 * [new branch] main -> main879From /private/var/tb/8/scratch/b7a284bab7282824/build/pytest-of-_tribuchetbld8/pytest-0/remote-test_with_updatable_flake_inpu0880 * branch main -> FETCH_HEAD881Preparing worktree (new branch 'update-flake-utils')882------------------------------ Captured log call -------------------------------883ERROR update_flake_inputs.flake_service:flake_service.py:223 Failed to update flake input flake-utils in flake.nix. Exit code: 1884Stdout: No stdout output885Stderr: warning: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com; retrying in 327 ms (attempt 1/5)886warning: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com; retrying in 500 ms (attempt 2/5)887warning: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com; retrying in 1402 ms (attempt 3/5)888warning: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com; retrying in 2542 ms (attempt 4/5)889error:890 … while updating the lock file of flake 'git+file:///private/var/tb/8/scratch/b7a284bab7282824/build/flake-update-gznak5kz/update-flake-utils?ref=refs/heads/update-flake-utils&rev=c9b88109eab90be59fca953b2e0eb80233bef609&shallow=1'891892 … while updating the flake input 'flake-utils'893894 … while fetching the input 'github:numtide/flake-utils'895896 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.com897Traceback (most recent call last):898 File "/private/var/tb/8/scratch/b7a284bab7282824/build/src/src/update_flake_inputs/flake_service.py", line 191, in update_flake_input899 result = subprocess.run(900 [901 ...<10 lines>...902 check=True,903 )904 File "/nix/store/v82ka64d1qcm6hmydyx244nyqbngccxv-python3-3.13.15-env/lib/python3.13/subprocess.py", line 577, in run905 raise CalledProcessError(retcode, process.args,906 output=stdout, stderr=stderr)907subprocess.CalledProcessError: Command '['nix', 'flake', 'update', '--flake', 'git+file:///private/var/tb/8/scratch/b7a284bab7282824/build/flake-update-gznak5kz/update-flake-utils?shallow=1', 'flake-utils']' returned non-zero exit status 1.908ERROR update_flake_inputs.cli:cli.py:259 Failed to update input flake-utils in flake.nix909Traceback (most recent call last):910 File "/private/var/tb/8/scratch/b7a284bab7282824/build/src/src/update_flake_inputs/flake_service.py", line 191, in update_flake_input911 result = subprocess.run(912 [913 ...<10 lines>...914 check=True,915 )916 File "/nix/store/v82ka64d1qcm6hmydyx244nyqbngccxv-python3-3.13.15-env/lib/python3.13/subprocess.py", line 577, in run917 raise CalledProcessError(retcode, process.args,918 output=stdout, stderr=stderr)919subprocess.CalledProcessError: Command '['nix', 'flake', 'update', '--flake', 'git+file:///private/var/tb/8/scratch/b7a284bab7282824/build/flake-update-gznak5kz/update-flake-utils?shallow=1', 'flake-utils']' returned non-zero exit status 1.920921The above exception was the direct cause of the following exception:922923Traceback (most recent call last):924 File "/private/var/tb/8/scratch/b7a284bab7282824/build/src/src/update_flake_inputs/cli.py", line 223, in process_flake_updates925 flake_service.update_flake_input(926 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^927 input_name,928 ^^^^^^^^^^^929 flake.file_path,930 ^^^^^^^^^^^^^^^^931 str(worktree_path),932 ^^^^^^^^^^^^^^^^^^^933 )934 ^935 File "/private/var/tb/8/scratch/b7a284bab7282824/build/src/src/update_flake_inputs/flake_service.py", line 235, in update_flake_input936 raise FlakeServiceError(msg) from e937update_flake_inputs.exceptions.FlakeServiceError: Failed to update flake input flake-utils in flake.nix: Command '['nix', 'flake', 'update', '--flake', 'git+file:///private/var/tb/8/scratch/b7a284bab7282824/build/flake-update-gznak5kz/update-flake-utils?shallow=1', 'flake-utils']' returned non-zero exit status 1.938Stderr: warning: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com; retrying in 327 ms (attempt 1/5)939warning: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com; retrying in 500 ms (attempt 2/5)940warning: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com; retrying in 1402 ms (attempt 3/5)941warning: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com; retrying in 2542 ms (attempt 4/5)942error:943 … while updating the lock file of flake 'git+file:///private/var/tb/8/scratch/b7a284bab7282824/build/flake-update-gznak5kz/update-flake-utils?ref=refs/heads/update-flake-utils&rev=c9b88109eab90be59fca953b2e0eb80233bef609&shallow=1'944945 … while updating the flake input 'flake-utils'946947 … while fetching the input 'github:numtide/flake-utils'948949 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.com950_____ TestProcessFlakeUpdates.test_worktree_based_on_base_branch_not_head ______951952self = <tests.test_process_flake_updates.TestProcessFlakeUpdates object at 0x10b1c6b10>953tmp_path = PosixPath('/private/var/tb/8/scratch/b7a284bab7282824/build/pytest-of-_tribuchetbld8/pytest-0/test_worktree_based_on_base_br0')954fixtures_path = PosixPath('/private/var/tb/8/scratch/b7a284bab7282824/build/src/tests/fixtures')955956 @pytest.mark.impure957 def test_worktree_based_on_base_branch_not_head(958 self,959 tmp_path: Path,960 fixtures_path: Path,961 ) -> None:962 """Test that update branches are based on base_branch, not current HEAD.963 964 When the action is triggered from a non-main branch, the worktree965 should still be based on origin/<base_branch> so that commits from966 the triggering branch don't leak into the update branch.967 """968 flake_content = """{969 inputs = {970 flake-utils.url = "github:numtide/flake-utils";971 };972 973 outputs = { self, flake-utils }: {974 # Test flake with updatable input975 };976 }"""977 978 (tmp_path / "flake.nix").write_text(flake_content)979 980 shutil.copy(981 fixtures_path / "minimal" / "flake.lock",982 tmp_path / "flake.lock",983 )984 985 _setup_git_repo(tmp_path)986 987 # Create a feature branch with an extra commit988 git_env = {989 **os.environ,990 "GIT_AUTHOR_NAME": "Test User",991 "GIT_AUTHOR_EMAIL": "test@example.com",992 "GIT_COMMITTER_NAME": "Test User",993 "GIT_COMMITTER_EMAIL": "test@example.com",994 }995 subprocess.run(996 ["git", "checkout", "-b", "feature-branch"],997 cwd=tmp_path,998 check=True,999 )1000 (tmp_path / "extra-file.txt").write_text("feature branch content")1001 subprocess.run(["git", "add", "."], cwd=tmp_path, check=True)1002 subprocess.run(1003 ["git", "commit", "-m", "Feature branch commit"],1004 cwd=tmp_path,1005 check=True,1006 env=git_env,1007 )1008 1009 # Stay on feature-branch (simulating action triggered from non-main branch)1010 original_cwd = Path.cwd()1011 os.chdir(tmp_path)1012 1013 try:1014 flake_service = FlakeService()1015 test_gitea_service = MockGiteaService()1016 1017> process_flake_updates(1018 flake_service,1019 test_gitea_service,1020 "",1021 "main",1022 "",1023 auto_merge=False,1024 )10251026tests/test_process_flake_updates.py:328: 1027_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 10281029flake_service = <update_flake_inputs.flake_service.FlakeService object at 0x10b2e1950>1030gitea_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=[])1031exclude_patterns = '', base_branch = 'main', branch_suffix = ''1032auto_merge = False10331034 def process_flake_updates( # noqa: PLR09131035 flake_service: FlakeService,1036 gitea_service: GiteaService,1037 exclude_patterns: str,1038 base_branch: str,1039 branch_suffix: str,1040 *,1041 auto_merge: bool,1042 ) -> None:1043 """Process all flake updates.1044 1045 Args:1046 flake_service: Flake service instance1047 gitea_service: Gitea service instance1048 exclude_patterns: Patterns to exclude1049 base_branch: Base branch for PRs1050 branch_suffix: Optional suffix to append to branch names1051 auto_merge: Whether to automatically merge PRs1052 1053 """1054 # Discover flake files1055 flakes = flake_service.discover_flake_files(exclude_patterns)1056 if not flakes:1057 logger.info("No flake files found")1058 return1059 1060 logger.info("Found %d flake files to process", len(flakes))1061 1062 failed_inputs: list[str] = []1063 1064 # Process each flake1065 for flake in flakes:1066 logger.info("Processing flake: %s", flake.file_path)1067 logger.info("Inputs to update: %s", ", ".join(flake.inputs))1068 1069 # Don't include '.' for root directory1070 parent_path = Path(flake.file_path).parent1071 parent_suffix = "" if parent_path == Path() else f" in {parent_path}"1072 parent_branch = "" if parent_path == Path() else f"-{parent_path}"1073 suffix = branch_suffix.strip().replace("/", "-").strip("-")1074 1075 # Update each input1076 for input_name in flake.inputs:1077 try:1078 branch_name = f"update{parent_branch}-{input_name}"1079 branch_name = branch_name.replace("/", "-").strip("-")1080 if suffix:1081 branch_name = f"{branch_name}-{suffix}"1082 1083 logger.info(1084 "Updating input %s in %s (branch: %s)",1085 input_name,1086 flake.file_path,1087 branch_name,1088 )1089 1090 # Create worktree and update input1091 with gitea_service.worktree(branch_name, base_branch) as worktree_path:1092 # Update the input1093 flake_service.update_flake_input(1094 input_name,1095 flake.file_path,1096 str(worktree_path),1097 )1098 1099 # Commit changes1100 commit_message = f"Update {input_name}{parent_suffix}"1101 if gitea_service.commit_changes(1102 branch_name,1103 commit_message,1104 worktree_path,1105 ):1106 # Create pull request1107 pr_title = commit_message1108 pr_body = (1109 f"This PR updates the `{input_name}` input "1110 f"in `{flake.file_path}`.\n\n"1111 "Generated by update-flake-inputs action."1112 )1113 gitea_service.create_pull_request(1114 branch_name,1115 base_branch,1116 pr_title,1117 pr_body,1118 auto_merge=auto_merge,1119 )1120 else:1121 logger.info(1122 "No changes for input %s in %s",1123 input_name,1124 flake.file_path,1125 )1126 gitea_service.delete_branch(branch_name)1127 1128 except Exception:1129 logger.exception(1130 "Failed to update input %s in %s",1131 input_name,1132 flake.file_path,1133 )1134 failed_inputs.append(f"{input_name} in {flake.file_path}")1135 1136 if failed_inputs:1137 msg = f"Failed to process {len(failed_inputs)} input(s): {', '.join(failed_inputs)}"1138> raise UpdateFlakeInputsError(msg)1139E update_flake_inputs.exceptions.UpdateFlakeInputsError: Failed to process 1 input(s): flake-utils in flake.nix11401141src/update_flake_inputs/cli.py:268: UpdateFlakeInputsError1142----------------------------- Captured stdout call -----------------------------1143Initialized empty Git repository in /private/var/tb/8/scratch/b7a284bab7282824/build/pytest-of-_tribuchetbld8/pytest-0/test_worktree_based_on_base_br0/.git/1144[main (root-commit) 5995bf9] Initial commit1145 2 files changed, 53 insertions(+)1146 create mode 100644 flake.lock1147 create mode 100644 flake.nix1148Initialized empty Git repository in /private/var/tb/8/scratch/b7a284bab7282824/build/pytest-of-_tribuchetbld8/pytest-0/remote-test_worktree_based_on_base_br0.git/1149branch 'main' set up to track 'origin/main'.1150[feature-branch 91f9509] Feature branch commit1151 1 file changed, 1 insertion(+)1152 create mode 100644 extra-file.txt1153branch 'update-flake-utils' set up to track 'origin/main'.1154HEAD is now at 5995bf9 Initial commit1155----------------------------- Captured stderr call -----------------------------1156hint: Using 'master' as the name for the initial branch. This default branch name1157hint: will change to "main" in Git 3.0. To configure the initial branch name1158hint: to use in all of your new repositories, which will suppress this warning,1159hint: call:1160hint:1161hint: git config --global init.defaultBranch <name>1162hint:1163hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and1164hint: 'development'. The just-created branch can be renamed via this command:1165hint:1166hint: git branch -m <name>1167hint:1168hint: Disable this message with "git config set advice.defaultBranchName false"1169To /private/var/tb/8/scratch/b7a284bab7282824/build/pytest-of-_tribuchetbld8/pytest-0/remote-test_worktree_based_on_base_br0.git1170 * [new branch] main -> main1171Switched to a new branch 'feature-branch'1172From /private/var/tb/8/scratch/b7a284bab7282824/build/pytest-of-_tribuchetbld8/pytest-0/remote-test_worktree_based_on_base_br01173 * branch main -> FETCH_HEAD1174Preparing worktree (new branch 'update-flake-utils')1175------------------------------ Captured log call -------------------------------1176ERROR update_flake_inputs.flake_service:flake_service.py:223 Failed to update flake input flake-utils in flake.nix. Exit code: 11177Stdout: No stdout output1178Stderr: warning: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com; retrying in 290 ms (attempt 1/5)1179warning: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com; retrying in 565 ms (attempt 2/5)1180warning: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com; retrying in 1341 ms (attempt 3/5)1181warning: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com; retrying in 2168 ms (attempt 4/5)1182error:1183 … while updating the lock file of flake 'git+file:///private/var/tb/8/scratch/b7a284bab7282824/build/flake-update-5cobiupf/update-flake-utils?ref=refs/heads/update-flake-utils&rev=5995bf9ead0afb70f18ae397bd203cf1730bf18a&shallow=1'11841185 … while updating the flake input 'flake-utils'11861187 … while fetching the input 'github:numtide/flake-utils'11881189 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.com1190Traceback (most recent call last):1191 File "/private/var/tb/8/scratch/b7a284bab7282824/build/src/src/update_flake_inputs/flake_service.py", line 191, in update_flake_input1192 result = subprocess.run(1193 [1194 ...<10 lines>...1195 check=True,1196 )1197 File "/nix/store/v82ka64d1qcm6hmydyx244nyqbngccxv-python3-3.13.15-env/lib/python3.13/subprocess.py", line 577, in run1198 raise CalledProcessError(retcode, process.args,1199 output=stdout, stderr=stderr)1200subprocess.CalledProcessError: Command '['nix', 'flake', 'update', '--flake', 'git+file:///private/var/tb/8/scratch/b7a284bab7282824/build/flake-update-5cobiupf/update-flake-utils?shallow=1', 'flake-utils']' returned non-zero exit status 1.1201ERROR update_flake_inputs.cli:cli.py:259 Failed to update input flake-utils in flake.nix1202Traceback (most recent call last):1203 File "/private/var/tb/8/scratch/b7a284bab7282824/build/src/src/update_flake_inputs/flake_service.py", line 191, in update_flake_input1204 result = subprocess.run(1205 [1206 ...<10 lines>...1207 check=True,1208 )1209 File "/nix/store/v82ka64d1qcm6hmydyx244nyqbngccxv-python3-3.13.15-env/lib/python3.13/subprocess.py", line 577, in run1210 raise CalledProcessError(retcode, process.args,1211 output=stdout, stderr=stderr)1212subprocess.CalledProcessError: Command '['nix', 'flake', 'update', '--flake', 'git+file:///private/var/tb/8/scratch/b7a284bab7282824/build/flake-update-5cobiupf/update-flake-utils?shallow=1', 'flake-utils']' returned non-zero exit status 1.12131214The above exception was the direct cause of the following exception:12151216Traceback (most recent call last):1217 File "/private/var/tb/8/scratch/b7a284bab7282824/build/src/src/update_flake_inputs/cli.py", line 223, in process_flake_updates1218 flake_service.update_flake_input(1219 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^1220 input_name,1221 ^^^^^^^^^^^1222 flake.file_path,1223 ^^^^^^^^^^^^^^^^1224 str(worktree_path),1225 ^^^^^^^^^^^^^^^^^^^1226 )1227 ^1228 File "/private/var/tb/8/scratch/b7a284bab7282824/build/src/src/update_flake_inputs/flake_service.py", line 235, in update_flake_input1229 raise FlakeServiceError(msg) from e1230update_flake_inputs.exceptions.FlakeServiceError: Failed to update flake input flake-utils in flake.nix: Command '['nix', 'flake', 'update', '--flake', 'git+file:///private/var/tb/8/scratch/b7a284bab7282824/build/flake-update-5cobiupf/update-flake-utils?shallow=1', 'flake-utils']' returned non-zero exit status 1.1231Stderr: warning: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com; retrying in 290 ms (attempt 1/5)1232warning: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com; retrying in 565 ms (attempt 2/5)1233warning: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com; retrying in 1341 ms (attempt 3/5)1234warning: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com; retrying in 2168 ms (attempt 4/5)1235error:1236 … while updating the lock file of flake 'git+file:///private/var/tb/8/scratch/b7a284bab7282824/build/flake-update-5cobiupf/update-flake-utils?ref=refs/heads/update-flake-utils&rev=5995bf9ead0afb70f18ae397bd203cf1730bf18a&shallow=1'12371238 … while updating the flake input 'flake-utils'12391240 … while fetching the input 'github:numtide/flake-utils'12411242 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.com1243___________ TestProcessFlakeUpdates.test_custom_git_author_committer ___________12441245self = <tests.test_process_flake_updates.TestProcessFlakeUpdates object at 0x10b1c6ea0>1246tmp_path = PosixPath('/private/var/tb/8/scratch/b7a284bab7282824/build/pytest-of-_tribuchetbld8/pytest-0/test_custom_git_author_committ0')1247fixtures_path = PosixPath('/private/var/tb/8/scratch/b7a284bab7282824/build/src/tests/fixtures')12481249 @pytest.mark.impure1250 def test_custom_git_author_committer(1251 self,1252 tmp_path: Path,1253 fixtures_path: Path,1254 ) -> None:1255 """Test that custom git author/committer configuration is used."""1256 # Create a flake with flake-utils1257 flake_content = """{1258 inputs = {1259 flake-utils.url = "github:numtide/flake-utils";1260 };1261 1262 outputs = { self, flake-utils }: {1263 # Test flake1264 };1265 }"""1266 1267 (tmp_path / "flake.nix").write_text(flake_content)1268 1269 # Copy old lock file from minimal fixture1270 shutil.copy(1271 fixtures_path / "minimal" / "flake.lock",1272 tmp_path / "flake.lock",1273 )1274 1275 _setup_git_repo(tmp_path)1276 1277 # Change to test directory1278 original_cwd = Path.cwd()1279 os.chdir(tmp_path)1280 1281 try:1282 # Create test services with custom git author/committer1283 flake_service = FlakeService()1284 test_gitea_service = MockGiteaService()1285 test_gitea_service.git_author_name = "Custom Bot"1286 test_gitea_service.git_author_email = "custom@bot.com"1287 test_gitea_service.git_committer_name = "Custom Committer"1288 test_gitea_service.git_committer_email = "committer@bot.com"1289 1290 # Process updates1291> process_flake_updates(1292 flake_service,1293 test_gitea_service,1294 "",1295 "main",1296 "",1297 auto_merge=False,1298 )12991300tests/test_process_flake_updates.py:398: 1301_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 13021303flake_service = <update_flake_inputs.flake_service.FlakeService object at 0x10b621400>1304gitea_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=[])1305exclude_patterns = '', base_branch = 'main', branch_suffix = ''1306auto_merge = False13071308 def process_flake_updates( # noqa: PLR09131309 flake_service: FlakeService,1310 gitea_service: GiteaService,1311 exclude_patterns: str,1312 base_branch: str,1313 branch_suffix: str,1314 *,1315 auto_merge: bool,1316 ) -> None:1317 """Process all flake updates.1318 1319 Args:1320 flake_service: Flake service instance1321 gitea_service: Gitea service instance1322 exclude_patterns: Patterns to exclude1323 base_branch: Base branch for PRs1324 branch_suffix: Optional suffix to append to branch names1325 auto_merge: Whether to automatically merge PRs1326 1327 """1328 # Discover flake files1329 flakes = flake_service.discover_flake_files(exclude_patterns)1330 if not flakes:1331 logger.info("No flake files found")1332 return1333 1334 logger.info("Found %d flake files to process", len(flakes))1335 1336 failed_inputs: list[str] = []1337 1338 # Process each flake1339 for flake in flakes:1340 logger.info("Processing flake: %s", flake.file_path)1341 logger.info("Inputs to update: %s", ", ".join(flake.inputs))1342 1343 # Don't include '.' for root directory1344 parent_path = Path(flake.file_path).parent1345 parent_suffix = "" if parent_path == Path() else f" in {parent_path}"1346 parent_branch = "" if parent_path == Path() else f"-{parent_path}"1347 suffix = branch_suffix.strip().replace("/", "-").strip("-")1348 1349 # Update each input1350 for input_name in flake.inputs:1351 try:1352 branch_name = f"update{parent_branch}-{input_name}"1353 branch_name = branch_name.replace("/", "-").strip("-")1354 if suffix:1355 branch_name = f"{branch_name}-{suffix}"1356 1357 logger.info(1358 "Updating input %s in %s (branch: %s)",1359 input_name,1360 flake.file_path,1361 branch_name,1362 )1363 1364 # Create worktree and update input1365 with gitea_service.worktree(branch_name, base_branch) as worktree_path:1366 # Update the input1367 flake_service.update_flake_input(1368 input_name,1369 flake.file_path,1370 str(worktree_path),1371 )1372 1373 # Commit changes1374 commit_message = f"Update {input_name}{parent_suffix}"1375 if gitea_service.commit_changes(1376 branch_name,1377 commit_message,1378 worktree_path,1379 ):1380 # Create pull request1381 pr_title = commit_message1382 pr_body = (1383 f"This PR updates the `{input_name}` input "1384 f"in `{flake.file_path}`.\n\n"1385 "Generated by update-flake-inputs action."1386 )1387 gitea_service.create_pull_request(1388 branch_name,1389 base_branch,1390 pr_title,1391 pr_body,1392 auto_merge=auto_merge,1393 )1394 else:1395 logger.info(1396 "No changes for input %s in %s",1397 input_name,1398 flake.file_path,1399 )1400 gitea_service.delete_branch(branch_name)1401 1402 except Exception:1403 logger.exception(1404 "Failed to update input %s in %s",1405 input_name,1406 flake.file_path,1407 )1408 failed_inputs.append(f"{input_name} in {flake.file_path}")1409 1410 if failed_inputs:1411 msg = f"Failed to process {len(failed_inputs)} input(s): {', '.join(failed_inputs)}"1412> raise UpdateFlakeInputsError(msg)1413E update_flake_inputs.exceptions.UpdateFlakeInputsError: Failed to process 1 input(s): flake-utils in flake.nix14141415src/update_flake_inputs/cli.py:268: UpdateFlakeInputsError1416----------------------------- Captured stdout call -----------------------------1417Initialized empty Git repository in /private/var/tb/8/scratch/b7a284bab7282824/build/pytest-of-_tribuchetbld8/pytest-0/test_custom_git_author_committ0/.git/1418[main (root-commit) e3ec2f1] Initial commit1419 2 files changed, 53 insertions(+)1420 create mode 100644 flake.lock1421 create mode 100644 flake.nix1422Initialized empty Git repository in /private/var/tb/8/scratch/b7a284bab7282824/build/pytest-of-_tribuchetbld8/pytest-0/remote-test_custom_git_author_committ0.git/1423branch 'main' set up to track 'origin/main'.1424branch 'update-flake-utils' set up to track 'origin/main'.1425HEAD is now at e3ec2f1 Initial commit1426----------------------------- Captured stderr call -----------------------------1427hint: Using 'master' as the name for the initial branch. This default branch name1428hint: will change to "main" in Git 3.0. To configure the initial branch name1429hint: to use in all of your new repositories, which will suppress this warning,1430hint: call:1431hint:1432hint: git config --global init.defaultBranch <name>1433hint:1434hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and1435hint: 'development'. The just-created branch can be renamed via this command:1436hint:1437hint: git branch -m <name>1438hint:1439hint: Disable this message with "git config set advice.defaultBranchName false"1440To /private/var/tb/8/scratch/b7a284bab7282824/build/pytest-of-_tribuchetbld8/pytest-0/remote-test_custom_git_author_committ0.git1441 * [new branch] main -> main1442From /private/var/tb/8/scratch/b7a284bab7282824/build/pytest-of-_tribuchetbld8/pytest-0/remote-test_custom_git_author_committ01443 * branch main -> FETCH_HEAD1444Preparing worktree (new branch 'update-flake-utils')1445------------------------------ Captured log call -------------------------------1446ERROR update_flake_inputs.flake_service:flake_service.py:223 Failed to update flake input flake-utils in flake.nix. Exit code: 11447Stdout: No stdout output1448Stderr: warning: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com; retrying in 258 ms (attempt 1/5)1449warning: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com; retrying in 500 ms (attempt 2/5)1450warning: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com; retrying in 1316 ms (attempt 3/5)1451warning: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com; retrying in 2566 ms (attempt 4/5)1452error:1453 … while updating the lock file of flake 'git+file:///private/var/tb/8/scratch/b7a284bab7282824/build/flake-update-krdggdd3/update-flake-utils?ref=refs/heads/update-flake-utils&rev=e3ec2f17006833b635801188d84f84202caf0d3c&shallow=1'14541455 … while updating the flake input 'flake-utils'14561457 … while fetching the input 'github:numtide/flake-utils'14581459 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.com1460Traceback (most recent call last):1461 File "/private/var/tb/8/scratch/b7a284bab7282824/build/src/src/update_flake_inputs/flake_service.py", line 191, in update_flake_input1462 result = subprocess.run(1463 [1464 ...<10 lines>...1465 check=True,1466 )1467 File "/nix/store/v82ka64d1qcm6hmydyx244nyqbngccxv-python3-3.13.15-env/lib/python3.13/subprocess.py", line 577, in run1468 raise CalledProcessError(retcode, process.args,1469 output=stdout, stderr=stderr)1470subprocess.CalledProcessError: Command '['nix', 'flake', 'update', '--flake', 'git+file:///private/var/tb/8/scratch/b7a284bab7282824/build/flake-update-krdggdd3/update-flake-utils?shallow=1', 'flake-utils']' returned non-zero exit status 1.1471ERROR update_flake_inputs.cli:cli.py:259 Failed to update input flake-utils in flake.nix1472Traceback (most recent call last):1473 File "/private/var/tb/8/scratch/b7a284bab7282824/build/src/src/update_flake_inputs/flake_service.py", line 191, in update_flake_input1474 result = subprocess.run(1475 [1476 ...<10 lines>...1477 check=True,1478 )1479 File "/nix/store/v82ka64d1qcm6hmydyx244nyqbngccxv-python3-3.13.15-env/lib/python3.13/subprocess.py", line 577, in run1480 raise CalledProcessError(retcode, process.args,1481 output=stdout, stderr=stderr)1482subprocess.CalledProcessError: Command '['nix', 'flake', 'update', '--flake', 'git+file:///private/var/tb/8/scratch/b7a284bab7282824/build/flake-update-krdggdd3/update-flake-utils?shallow=1', 'flake-utils']' returned non-zero exit status 1.14831484The above exception was the direct cause of the following exception:14851486Traceback (most recent call last):1487 File "/private/var/tb/8/scratch/b7a284bab7282824/build/src/src/update_flake_inputs/cli.py", line 223, in process_flake_updates1488 flake_service.update_flake_input(1489 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^1490 input_name,1491 ^^^^^^^^^^^1492 flake.file_path,1493 ^^^^^^^^^^^^^^^^1494 str(worktree_path),1495 ^^^^^^^^^^^^^^^^^^^1496 )1497 ^1498 File "/private/var/tb/8/scratch/b7a284bab7282824/build/src/src/update_flake_inputs/flake_service.py", line 235, in update_flake_input1499 raise FlakeServiceError(msg) from e1500update_flake_inputs.exceptions.FlakeServiceError: Failed to update flake input flake-utils in flake.nix: Command '['nix', 'flake', 'update', '--flake', 'git+file:///private/var/tb/8/scratch/b7a284bab7282824/build/flake-update-krdggdd3/update-flake-utils?shallow=1', 'flake-utils']' returned non-zero exit status 1.1501Stderr: warning: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com; retrying in 258 ms (attempt 1/5)1502warning: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com; retrying in 500 ms (attempt 2/5)1503warning: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com; retrying in 1316 ms (attempt 3/5)1504warning: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com; retrying in 2566 ms (attempt 4/5)1505error:1506 … while updating the lock file of flake 'git+file:///private/var/tb/8/scratch/b7a284bab7282824/build/flake-update-krdggdd3/update-flake-utils?ref=refs/heads/update-flake-utils&rev=e3ec2f17006833b635801188d84f84202caf0d3c&shallow=1'15071508 … while updating the flake input 'flake-utils'15091510 … while fetching the input 'github:numtide/flake-utils'15111512 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.com1513__________________ TestProcessFlakeUpdates.test_branch_suffix __________________15141515self = <tests.test_process_flake_updates.TestProcessFlakeUpdates object at 0x10b30f410>1516tmp_path = PosixPath('/private/var/tb/8/scratch/b7a284bab7282824/build/pytest-of-_tribuchetbld8/pytest-0/test_branch_suffix0')1517fixtures_path = PosixPath('/private/var/tb/8/scratch/b7a284bab7282824/build/src/tests/fixtures')15181519 @pytest.mark.impure1520 def test_branch_suffix(1521 self,1522 tmp_path: Path,1523 fixtures_path: Path,1524 ) -> None:1525 """Test that branch suffix is properly appended to branch names."""1526 # Create a flake with flake-utils1527 flake_content = """{1528 inputs = {1529 flake-utils.url = "github:numtide/flake-utils";1530 };1531 1532 outputs = { self, flake-utils }: {1533 # Test flake1534 };1535 }"""1536 1537 (tmp_path / "flake.nix").write_text(flake_content)1538 1539 # Copy old lock file from minimal fixture1540 shutil.copy(1541 fixtures_path / "minimal" / "flake.lock",1542 tmp_path / "flake.lock",1543 )1544 1545 _setup_git_repo(tmp_path)1546 1547 # Change to test directory1548 original_cwd = Path.cwd()1549 os.chdir(tmp_path)1550 1551 try:1552 # Create test services1553 flake_service = FlakeService()1554 test_gitea_service = MockGiteaService()1555 1556 # Process updates with branch suffix1557> process_flake_updates(1558 flake_service,1559 test_gitea_service,1560 "",1561 "main",1562 "my-suffix",1563 auto_merge=False,1564 )15651566tests/test_process_flake_updates.py:465: 1567_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 15681569flake_service = <update_flake_inputs.flake_service.FlakeService object at 0x10b6226c0>1570gitea_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=[])1571exclude_patterns = '', base_branch = 'main', branch_suffix = 'my-suffix'1572auto_merge = False15731574 def process_flake_updates( # noqa: PLR09131575 flake_service: FlakeService,1576 gitea_service: GiteaService,1577 exclude_patterns: str,1578 base_branch: str,1579 branch_suffix: str,1580 *,1581 auto_merge: bool,1582 ) -> None:1583 """Process all flake updates.1584 1585 Args:1586 flake_service: Flake service instance1587 gitea_service: Gitea service instance1588 exclude_patterns: Patterns to exclude1589 base_branch: Base branch for PRs1590 branch_suffix: Optional suffix to append to branch names1591 auto_merge: Whether to automatically merge PRs1592 1593 """1594 # Discover flake files1595 flakes = flake_service.discover_flake_files(exclude_patterns)1596 if not flakes:1597 logger.info("No flake files found")1598 return1599 1600 logger.info("Found %d flake files to process", len(flakes))1601 1602 failed_inputs: list[str] = []1603 1604 # Process each flake1605 for flake in flakes:1606 logger.info("Processing flake: %s", flake.file_path)1607 logger.info("Inputs to update: %s", ", ".join(flake.inputs))1608 1609 # Don't include '.' for root directory1610 parent_path = Path(flake.file_path).parent1611 parent_suffix = "" if parent_path == Path() else f" in {parent_path}"1612 parent_branch = "" if parent_path == Path() else f"-{parent_path}"1613 suffix = branch_suffix.strip().replace("/", "-").strip("-")1614 1615 # Update each input1616 for input_name in flake.inputs:1617 try:1618 branch_name = f"update{parent_branch}-{input_name}"1619 branch_name = branch_name.replace("/", "-").strip("-")1620 if suffix:1621 branch_name = f"{branch_name}-{suffix}"1622 1623 logger.info(1624 "Updating input %s in %s (branch: %s)",1625 input_name,1626 flake.file_path,1627 branch_name,1628 )1629 1630 # Create worktree and update input1631 with gitea_service.worktree(branch_name, base_branch) as worktree_path:1632 # Update the input1633 flake_service.update_flake_input(1634 input_name,1635 flake.file_path,1636 str(worktree_path),1637 )1638 1639 # Commit changes1640 commit_message = f"Update {input_name}{parent_suffix}"1641 if gitea_service.commit_changes(1642 branch_name,1643 commit_message,1644 worktree_path,1645 ):1646 # Create pull request1647 pr_title = commit_message1648 pr_body = (1649 f"This PR updates the `{input_name}` input "1650 f"in `{flake.file_path}`.\n\n"1651 "Generated by update-flake-inputs action."1652 )1653 gitea_service.create_pull_request(1654 branch_name,1655 base_branch,1656 pr_title,1657 pr_body,1658 auto_merge=auto_merge,1659 )1660 else:1661 logger.info(1662 "No changes for input %s in %s",1663 input_name,1664 flake.file_path,1665 )1666 gitea_service.delete_branch(branch_name)1667 1668 except Exception:1669 logger.exception(1670 "Failed to update input %s in %s",1671 input_name,1672 flake.file_path,1673 )1674 failed_inputs.append(f"{input_name} in {flake.file_path}")1675 1676 if failed_inputs:1677 msg = f"Failed to process {len(failed_inputs)} input(s): {', '.join(failed_inputs)}"1678> raise UpdateFlakeInputsError(msg)1679E update_flake_inputs.exceptions.UpdateFlakeInputsError: Failed to process 1 input(s): flake-utils in flake.nix16801681src/update_flake_inputs/cli.py:268: UpdateFlakeInputsError1682----------------------------- Captured stdout call -----------------------------1683Initialized empty Git repository in /private/var/tb/8/scratch/b7a284bab7282824/build/pytest-of-_tribuchetbld8/pytest-0/test_branch_suffix0/.git/1684[main (root-commit) 325df20] Initial commit1685 2 files changed, 53 insertions(+)1686 create mode 100644 flake.lock1687 create mode 100644 flake.nix1688Initialized empty Git repository in /private/var/tb/8/scratch/b7a284bab7282824/build/pytest-of-_tribuchetbld8/pytest-0/remote-test_branch_suffix0.git/1689branch 'main' set up to track 'origin/main'.1690branch 'update-flake-utils-my-suffix' set up to track 'origin/main'.1691HEAD is now at 325df20 Initial commit1692----------------------------- Captured stderr call -----------------------------1693hint: Using 'master' as the name for the initial branch. This default branch name1694hint: will change to "main" in Git 3.0. To configure the initial branch name1695hint: to use in all of your new repositories, which will suppress this warning,1696hint: call:1697hint:1698hint: git config --global init.defaultBranch <name>1699hint:1700hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and1701hint: 'development'. The just-created branch can be renamed via this command:1702hint:1703hint: git branch -m <name>1704hint:1705hint: Disable this message with "git config set advice.defaultBranchName false"1706To /private/var/tb/8/scratch/b7a284bab7282824/build/pytest-of-_tribuchetbld8/pytest-0/remote-test_branch_suffix0.git1707 * [new branch] main -> main1708From /private/var/tb/8/scratch/b7a284bab7282824/build/pytest-of-_tribuchetbld8/pytest-0/remote-test_branch_suffix01709 * branch main -> FETCH_HEAD1710Preparing worktree (new branch 'update-flake-utils-my-suffix')1711------------------------------ Captured log call -------------------------------1712ERROR update_flake_inputs.flake_service:flake_service.py:223 Failed to update flake input flake-utils in flake.nix. Exit code: 11713Stdout: No stdout output1714Stderr: warning: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com; retrying in 316 ms (attempt 1/5)1715warning: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com; retrying in 522 ms (attempt 2/5)1716warning: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com; retrying in 1371 ms (attempt 3/5)1717warning: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com; retrying in 2194 ms (attempt 4/5)1718error:1719 … while updating the lock file of flake 'git+file:///private/var/tb/8/scratch/b7a284bab7282824/build/flake-update-k4_lgoc1/update-flake-utils-my-suffix?ref=refs/heads/update-flake-utils-my-suffix&rev=325df20e0553fc711bbec0e9a62b72acd56cbeec&shallow=1'17201721 … while updating the flake input 'flake-utils'17221723 … while fetching the input 'github:numtide/flake-utils'17241725 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.com1726Traceback (most recent call last):1727 File "/private/var/tb/8/scratch/b7a284bab7282824/build/src/src/update_flake_inputs/flake_service.py", line 191, in update_flake_input1728 result = subprocess.run(1729 [1730 ...<10 lines>...1731 check=True,1732 )1733 File "/nix/store/v82ka64d1qcm6hmydyx244nyqbngccxv-python3-3.13.15-env/lib/python3.13/subprocess.py", line 577, in run1734 raise CalledProcessError(retcode, process.args,1735 output=stdout, stderr=stderr)1736subprocess.CalledProcessError: Command '['nix', 'flake', 'update', '--flake', 'git+file:///private/var/tb/8/scratch/b7a284bab7282824/build/flake-update-k4_lgoc1/update-flake-utils-my-suffix?shallow=1', 'flake-utils']' returned non-zero exit status 1.1737ERROR update_flake_inputs.cli:cli.py:259 Failed to update input flake-utils in flake.nix1738Traceback (most recent call last):1739 File "/private/var/tb/8/scratch/b7a284bab7282824/build/src/src/update_flake_inputs/flake_service.py", line 191, in update_flake_input1740 result = subprocess.run(1741 [1742 ...<10 lines>...1743 check=True,1744 )1745 File "/nix/store/v82ka64d1qcm6hmydyx244nyqbngccxv-python3-3.13.15-env/lib/python3.13/subprocess.py", line 577, in run1746 raise CalledProcessError(retcode, process.args,1747 output=stdout, stderr=stderr)1748subprocess.CalledProcessError: Command '['nix', 'flake', 'update', '--flake', 'git+file:///private/var/tb/8/scratch/b7a284bab7282824/build/flake-update-k4_lgoc1/update-flake-utils-my-suffix?shallow=1', 'flake-utils']' returned non-zero exit status 1.17491750The above exception was the direct cause of the following exception:17511752Traceback (most recent call last):1753 File "/private/var/tb/8/scratch/b7a284bab7282824/build/src/src/update_flake_inputs/cli.py", line 223, in process_flake_updates1754 flake_service.update_flake_input(1755 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^1756 input_name,1757 ^^^^^^^^^^^1758 flake.file_path,1759 ^^^^^^^^^^^^^^^^1760 str(worktree_path),1761 ^^^^^^^^^^^^^^^^^^^1762 )1763 ^1764 File "/private/var/tb/8/scratch/b7a284bab7282824/build/src/src/update_flake_inputs/flake_service.py", line 235, in update_flake_input1765 raise FlakeServiceError(msg) from e1766update_flake_inputs.exceptions.FlakeServiceError: Failed to update flake input flake-utils in flake.nix: Command '['nix', 'flake', 'update', '--flake', 'git+file:///private/var/tb/8/scratch/b7a284bab7282824/build/flake-update-k4_lgoc1/update-flake-utils-my-suffix?shallow=1', 'flake-utils']' returned non-zero exit status 1.1767Stderr: warning: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com; retrying in 316 ms (attempt 1/5)1768warning: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com; retrying in 522 ms (attempt 2/5)1769warning: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com; retrying in 1371 ms (attempt 3/5)1770warning: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com; retrying in 2194 ms (attempt 4/5)1771error:1772 … while updating the lock file of flake 'git+file:///private/var/tb/8/scratch/b7a284bab7282824/build/flake-update-k4_lgoc1/update-flake-utils-my-suffix?ref=refs/heads/update-flake-utils-my-suffix&rev=325df20e0553fc711bbec0e9a62b72acd56cbeec&shallow=1'17731774 … while updating the flake input 'flake-utils'17751776 … while fetching the input 'github:numtide/flake-utils'17771778 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.com1779____ TestProcessFlakeUpdates.test_fails_at_end_when_individual_input_fails _____17801781self = <tests.test_process_flake_updates.TestProcessFlakeUpdates object at 0x10b2868b0>1782tmp_path = PosixPath('/private/var/tb/8/scratch/b7a284bab7282824/build/pytest-of-_tribuchetbld8/pytest-0/test_fails_at_end_when_individ0')1783fixtures_path = PosixPath('/private/var/tb/8/scratch/b7a284bab7282824/build/src/tests/fixtures')17841785 @pytest.mark.impure1786 def test_fails_at_end_when_individual_input_fails(1787 self,1788 tmp_path: Path,1789 fixtures_path: Path,1790 ) -> None:1791 """Test that the action continues updating other inputs but fails at the end."""1792 flake_content = """{1793 inputs = {1794 flake-utils.url = "github:numtide/flake-utils";1795 };1796 1797 outputs = { self, flake-utils }: {1798 # Test flake with updatable input1799 };1800 }"""1801 1802 (tmp_path / "flake.nix").write_text(flake_content)1803 1804 shutil.copy(1805 fixtures_path / "minimal" / "flake.lock",1806 tmp_path / "flake.lock",1807 )1808 1809 _setup_git_repo(tmp_path)1810 1811 original_cwd = Path.cwd()1812 os.chdir(tmp_path)1813 1814 try:1815 # FailingFlakeService injects "bad-input" during discovery and1816 # raises when asked to update it, simulating a 403 or dead ref1817 flake_service = FailingFlakeService(fail_inputs=["bad-input"])1818 test_gitea_service = MockGiteaService()1819 1820> with pytest.raises(UpdateFlakeInputsError, match="Failed to process 1 input"):1821 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^1822E AssertionError: Regex pattern did not match.1823E Expected regex: 'Failed to process 1 input'1824E Actual message: 'Failed to process 2 input(s): bad-input in flake.nix, flake-utils in flake.nix'18251826tests/test_process_flake_updates.py:596: AssertionError1827----------------------------- Captured stdout call -----------------------------1828Initialized empty Git repository in /private/var/tb/8/scratch/b7a284bab7282824/build/pytest-of-_tribuchetbld8/pytest-0/test_fails_at_end_when_individ0/.git/1829[main (root-commit) d030a01] Initial commit1830 2 files changed, 53 insertions(+)1831 create mode 100644 flake.lock1832 create mode 100644 flake.nix1833Initialized empty Git repository in /private/var/tb/8/scratch/b7a284bab7282824/build/pytest-of-_tribuchetbld8/pytest-0/remote-test_fails_at_end_when_individ0.git/1834branch 'main' set up to track 'origin/main'.1835branch 'update-bad-input' set up to track 'origin/main'.1836HEAD is now at d030a01 Initial commit1837branch 'update-flake-utils' set up to track 'origin/main'.1838HEAD is now at d030a01 Initial commit1839----------------------------- Captured stderr call -----------------------------1840hint: Using 'master' as the name for the initial branch. This default branch name1841hint: will change to "main" in Git 3.0. To configure the initial branch name1842hint: to use in all of your new repositories, which will suppress this warning,1843hint: call:1844hint:1845hint: git config --global init.defaultBranch <name>1846hint:1847hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and1848hint: 'development'. The just-created branch can be renamed via this command:1849hint:1850hint: git branch -m <name>1851hint:1852hint: Disable this message with "git config set advice.defaultBranchName false"1853To /private/var/tb/8/scratch/b7a284bab7282824/build/pytest-of-_tribuchetbld8/pytest-0/remote-test_fails_at_end_when_individ0.git1854 * [new branch] main -> main1855From /private/var/tb/8/scratch/b7a284bab7282824/build/pytest-of-_tribuchetbld8/pytest-0/remote-test_fails_at_end_when_individ01856 * branch main -> FETCH_HEAD1857Preparing worktree (new branch 'update-bad-input')1858From /private/var/tb/8/scratch/b7a284bab7282824/build/pytest-of-_tribuchetbld8/pytest-0/remote-test_fails_at_end_when_individ01859 * branch main -> FETCH_HEAD1860Preparing worktree (new branch 'update-flake-utils')1861------------------------------ Captured log call -------------------------------1862ERROR update_flake_inputs.cli:cli.py:259 Failed to update input bad-input in flake.nix1863Traceback (most recent call last):1864 File "/private/var/tb/8/scratch/b7a284bab7282824/build/src/src/update_flake_inputs/cli.py", line 223, in process_flake_updates1865 flake_service.update_flake_input(1866 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^1867 input_name,1868 ^^^^^^^^^^^1869 flake.file_path,1870 ^^^^^^^^^^^^^^^^1871 str(worktree_path),1872 ^^^^^^^^^^^^^^^^^^^1873 )1874 ^1875 File "/private/var/tb/8/scratch/b7a284bab7282824/build/src/tests/test_process_flake_updates.py", line 635, in update_flake_input1876 raise FlakeServiceError(msg)1877update_flake_inputs.exceptions.FlakeServiceError: Simulated failure updating bad-input1878ERROR update_flake_inputs.flake_service:flake_service.py:223 Failed to update flake input flake-utils in flake.nix. Exit code: 11879Stdout: No stdout output1880Stderr: warning: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com; retrying in 265 ms (attempt 1/5)1881warning: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com; retrying in 688 ms (attempt 2/5)1882warning: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com; retrying in 1159 ms (attempt 3/5)1883warning: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com; retrying in 2523 ms (attempt 4/5)1884error:1885 … while updating the lock file of flake 'git+file:///private/var/tb/8/scratch/b7a284bab7282824/build/flake-update-oqtss5gw/update-flake-utils?ref=refs/heads/update-flake-utils&rev=d030a01624b911eab531c2a4dce089fbf5430da7&shallow=1'18861887 … while updating the flake input 'flake-utils'18881889 … while fetching the input 'github:numtide/flake-utils'18901891 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.com1892Traceback (most recent call last):1893 File "/private/var/tb/8/scratch/b7a284bab7282824/build/src/src/update_flake_inputs/flake_service.py", line 191, in update_flake_input1894 result = subprocess.run(1895 [1896 ...<10 lines>...1897 check=True,1898 )1899 File "/nix/store/v82ka64d1qcm6hmydyx244nyqbngccxv-python3-3.13.15-env/lib/python3.13/subprocess.py", line 577, in run1900 raise CalledProcessError(retcode, process.args,1901 output=stdout, stderr=stderr)1902subprocess.CalledProcessError: Command '['nix', 'flake', 'update', '--flake', 'git+file:///private/var/tb/8/scratch/b7a284bab7282824/build/flake-update-oqtss5gw/update-flake-utils?shallow=1', 'flake-utils']' returned non-zero exit status 1.1903ERROR update_flake_inputs.cli:cli.py:259 Failed to update input flake-utils in flake.nix1904Traceback (most recent call last):1905 File "/private/var/tb/8/scratch/b7a284bab7282824/build/src/src/update_flake_inputs/flake_service.py", line 191, in update_flake_input1906 result = subprocess.run(1907 [1908 ...<10 lines>...1909 check=True,1910 )1911 File "/nix/store/v82ka64d1qcm6hmydyx244nyqbngccxv-python3-3.13.15-env/lib/python3.13/subprocess.py", line 577, in run1912 raise CalledProcessError(retcode, process.args,1913 output=stdout, stderr=stderr)1914subprocess.CalledProcessError: Command '['nix', 'flake', 'update', '--flake', 'git+file:///private/var/tb/8/scratch/b7a284bab7282824/build/flake-update-oqtss5gw/update-flake-utils?shallow=1', 'flake-utils']' returned non-zero exit status 1.19151916The above exception was the direct cause of the following exception:19171918Traceback (most recent call last):1919 File "/private/var/tb/8/scratch/b7a284bab7282824/build/src/src/update_flake_inputs/cli.py", line 223, in process_flake_updates1920 flake_service.update_flake_input(1921 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^1922 input_name,1923 ^^^^^^^^^^^1924 flake.file_path,1925 ^^^^^^^^^^^^^^^^1926 str(worktree_path),1927 ^^^^^^^^^^^^^^^^^^^1928 )1929 ^1930 File "/private/var/tb/8/scratch/b7a284bab7282824/build/src/tests/test_process_flake_updates.py", line 636, in update_flake_input1931 super().update_flake_input(input_name, flake_file, work_dir)1932 ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^1933 File "/private/var/tb/8/scratch/b7a284bab7282824/build/src/src/update_flake_inputs/flake_service.py", line 235, in update_flake_input1934 raise FlakeServiceError(msg) from e1935update_flake_inputs.exceptions.FlakeServiceError: Failed to update flake input flake-utils in flake.nix: Command '['nix', 'flake', 'update', '--flake', 'git+file:///private/var/tb/8/scratch/b7a284bab7282824/build/flake-update-oqtss5gw/update-flake-utils?shallow=1', 'flake-utils']' returned non-zero exit status 1.1936Stderr: warning: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com; retrying in 265 ms (attempt 1/5)1937warning: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com; retrying in 688 ms (attempt 2/5)1938warning: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com; retrying in 1159 ms (attempt 3/5)1939warning: unable to download 'https://api.github.com/repos/numtide/flake-utils/commits/HEAD': Could not resolve hostname (6) Could not resolve host: api.github.com; retrying in 2523 ms (attempt 4/5)1940error:1941 … while updating the lock file of flake 'git+file:///private/var/tb/8/scratch/b7a284bab7282824/build/flake-update-oqtss5gw/update-flake-utils?ref=refs/heads/update-flake-utils&rev=d030a01624b911eab531c2a4dce089fbf5430da7&shallow=1'19421943 … while updating the flake input 'flake-utils'19441945 … while fetching the input 'github:numtide/flake-utils'19461947 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.com1948=========================== short test summary info ============================1949FAILED tests/test_flake_service.py::TestFlakeService::test_update_flake_input1950FAILED tests/test_flake_service.py::TestFlakeService::test_update_subflake_input1951FAILED tests/test_process_flake_updates.py::TestProcessFlakeUpdates::test_with_updatable_flake_input1952FAILED tests/test_process_flake_updates.py::TestProcessFlakeUpdates::test_worktree_based_on_base_branch_not_head1953FAILED tests/test_process_flake_updates.py::TestProcessFlakeUpdates::test_custom_git_author_committer1954FAILED tests/test_process_flake_updates.py::TestProcessFlakeUpdates::test_branch_suffix1955FAILED tests/test_process_flake_updates.py::TestProcessFlakeUpdates::test_fails_at_end_when_individual_input_fails19567 failed, 16 passed in 36.83s