Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions backend/infrahub/git/integrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,10 +437,18 @@ async def get_repository_config(self, branch_name: str, commit: str) -> Infrahub
branch_wt = self.get_worktree(identifier=commit or branch_name)
log = get_run_logger()

config_file_name = ".infrahub.yml"
config_file = branch_wt.directory / config_file_name
if not config_file.is_file():
log.debug(f"Unable to find the configuration file {config_file_name}, skipping")
# Check for both .infrahub.yml and .infrahub.yaml, prefer .yml if both exist
config_file_yml = branch_wt.directory / ".infrahub.yml"
config_file_yaml = branch_wt.directory / ".infrahub.yaml"

if config_file_yml.is_file():
config_file = config_file_yml
config_file_name = ".infrahub.yml"
elif config_file_yaml.is_file():
config_file = config_file_yaml
config_file_name = ".infrahub.yaml"
else:
log.debug("Unable to find the configuration file (.infrahub.yml or .infrahub.yaml), skipping")
return None

config_file_content = config_file.read_text(encoding="utf-8")
Expand Down
11 changes: 10 additions & 1 deletion backend/infrahub/proposed_change/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,16 @@ async def run_proposed_change_user_tests(model: RequestProposedChangeUserTests)
def _execute(
directory: Path, repository: ProposedChangeRepository, proposed_change: InfrahubNode
) -> int | pytest.ExitCode:
config_file = str(directory / ".infrahub.yml")
# Check for both .infrahub.yml and .infrahub.yaml, prefer .yml if both exist
config_file_yml = directory / ".infrahub.yml"
config_file_yaml = directory / ".infrahub.yaml"

if config_file_yml.is_file():
config_file = str(config_file_yml)
elif config_file_yaml.is_file():
config_file = str(config_file_yaml)
else:
config_file = str(config_file_yml) # Default to .yml for error messages
test_directory = directory / "tests"
log = get_logger()

Expand Down