Skip to content

Commit

Permalink
fix: take overriden organization properties into account for github app
Browse files Browse the repository at this point in the history
  • Loading branch information
netomi committed Jan 30, 2024
1 parent 0c6b3f9 commit 352fc4a
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions otterdog/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@ def __init__(
name: str,
github_id: str,
config_repo: str,
base_template: str,
jsonnet_config: JsonnetConfig,
credential_data: dict[str, Any],
):
self._name = name
self._github_id = github_id
self._config_repo = config_repo
self._base_template = base_template
self._jsonnet_config = jsonnet_config
self._credential_data = credential_data

Expand All @@ -50,6 +52,10 @@ def github_id(self) -> str:
def config_repo(self) -> str:
return self._config_repo

@property
def base_template(self) -> str:
return self._base_template

@property
def jsonnet_config(self) -> JsonnetConfig:
return self._jsonnet_config
Expand Down Expand Up @@ -92,7 +98,7 @@ def from_dict(cls, data: dict[str, Any], otterdog_config: OtterdogConfig) -> Org
if data is None:
raise RuntimeError(f"missing required credentials for organization config with name '{name}'")

return cls(name, github_id, config_repo, jsonnet_config, data)
return cls(name, github_id, config_repo, base_template, jsonnet_config, data)

@classmethod
def of(
Expand All @@ -103,17 +109,22 @@ def of(
work_dir: str,
otterdog_config: OtterdogConfig,
) -> OrganizationConfig:
config_repo = otterdog_config.default_config_repo
# get the default organization config to retrieve some properties
org_config = otterdog_config.get_organization_config(project_name)
config_repo = org_config.config_repo
base_template = org_config.base_template

# construct a custom jsonnet config based on the given work_dir
base_dir = os.path.join(otterdog_config.jsonnet_base_dir, work_dir)

jsonnet_config = JsonnetConfig(
github_id,
base_dir,
otterdog_config.default_base_template,
base_template,
otterdog_config.local_mode,
)

return cls(project_name, github_id, config_repo, jsonnet_config, credential_data)
return cls(project_name, github_id, config_repo, base_template, jsonnet_config, credential_data)


class OtterdogConfig:
Expand Down

0 comments on commit 352fc4a

Please sign in to comment.