Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: dry run failure when project transfer is configured along with other additional configs #726

Merged
merged 7 commits into from Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 2 additions & 5 deletions gitlabform/processors/abstract_processor.py
Expand Up @@ -51,10 +51,7 @@
verbose(
f"Processing section '{self.configuration_name}' in dry-run mode."
)
self._print_diff(
project_or_project_and_group,
configuration.get(self.configuration_name),
)
self._print_diff(project_or_project_and_group, configuration)

Check warning on line 54 in gitlabform/processors/abstract_processor.py

View check run for this annotation

Codecov / codecov/patch

gitlabform/processors/abstract_processor.py#L54

Added line #L54 was not covered by tests
amimas marked this conversation as resolved.
Show resolved Hide resolved
else:
verbose(f"Processing section '{self.configuration_name}'")
if self._can_proceed(project_or_project_and_group, configuration):
Expand Down Expand Up @@ -133,7 +130,7 @@
):
pass

def _print_diff(self, project_or_project_and_group: str, entity_config):
def _print_diff(self, project_or_project_and_group: str, configuration):
verbose(f"Diffing for section '{self.configuration_name}' is not supported yet")

def _needs_update(
Expand Down
8 changes: 7 additions & 1 deletion gitlabform/processors/project/variables_processor.py
Expand Up @@ -37,6 +37,12 @@
return True

def _print_diff(self, project_and_group: str, configuration):
try:
project_transfer_source = configuration["project"]["transfer_from"]
project_and_group = project_transfer_source
except KeyError:
pass

Check warning on line 44 in gitlabform/processors/project/variables_processor.py

View check run for this annotation

Codecov / codecov/patch

gitlabform/processors/project/variables_processor.py#L40-L44

Added lines #L40 - L44 were not covered by tests

try:
current_variables = self.gitlab.get_variables(project_and_group)

Expand All @@ -56,7 +62,7 @@

verbose(f"Variables in {project_and_group} in configuration:")

configured_variables = copy.deepcopy(configuration)
configured_variables = copy.deepcopy(configuration.get(self.configuration_name))

Check warning on line 65 in gitlabform/processors/project/variables_processor.py

View check run for this annotation

Codecov / codecov/patch

gitlabform/processors/project/variables_processor.py#L65

Added line #L65 was not covered by tests
for key in configured_variables.keys():
configured_variables[key]["value"] = hide(
configured_variables[key]["value"]
Expand Down
9 changes: 8 additions & 1 deletion gitlabform/processors/single_entity_processor.py
Expand Up @@ -50,8 +50,15 @@
self.add_method(project_or_group, entity_config)
debug(f"{self.configuration_name} AFTER: ^^^")

def _print_diff(self, project_or_project_and_group: str, entity_config):
def _print_diff(self, project_or_project_and_group: str, configuration):
try:
project_transfer_source = configuration["project"]["transfer_from"]
project_or_project_and_group = project_transfer_source
except KeyError:
pass

Check warning on line 58 in gitlabform/processors/single_entity_processor.py

View check run for this annotation

Codecov / codecov/patch

gitlabform/processors/single_entity_processor.py#L54-L58

Added lines #L54 - L58 were not covered by tests
amimas marked this conversation as resolved.
Show resolved Hide resolved

entity_in_gitlab = self.get_method(project_or_project_and_group)
entity_config = configuration.get(self.configuration_name)

Check warning on line 61 in gitlabform/processors/single_entity_processor.py

View check run for this annotation

Codecov / codecov/patch

gitlabform/processors/single_entity_processor.py#L61

Added line #L61 was not covered by tests

DifferenceLogger.log_diff(
f"{self.configuration_name} changes",
Expand Down