diff --git a/.dockerignore b/.dockerignore index 6004650..a435859 100644 --- a/.dockerignore +++ b/.dockerignore @@ -14,5 +14,6 @@ __pycache__ /.venv /.vscode /tmp +/vcs_config.csv config.yml terraform.tfstate* diff --git a/custom/commands/update_vcs_config.py b/custom/commands/update_vcs_config.py index a920fe2..71c05ac 100644 --- a/custom/commands/update_vcs_config.py +++ b/custom/commands/update_vcs_config.py @@ -47,11 +47,17 @@ def update_vcs_config(vcs_config_file_path: str): logging.warning(f"No VCS configuration found for the '{stack.get('name')}' stack. Skipping.") continue + if stack_vcs_config.get("BackendPath"): + project_root = Path(stack_vcs_config.get("BackendPath")).parent.as_posix() + "/" + else: + project_root = None + stack.vcs.update( { "branch": stack_vcs_config.get("Branch"), - "namespace": urlparse(stack_vcs_config.get("RepoURL")).path.split("/")[1], - "project_root": Path(stack_vcs_config.get("BackendPath")).parent.as_posix() + "/", + "integration_id": urlparse(stack_vcs_config.get("RepoURL")).path.split("/")[1], + "namespace": urlparse(stack_vcs_config.get("RepoURL")).path.split("/")[2], + "project_root": project_root, "provider": "azure_devops", "repository": stack_vcs_config.get("RepoName"), } diff --git a/custom/templates/base.tf.jinja b/custom/templates/base.tf.jinja index f5f59f9..5726c69 100644 --- a/custom/templates/base.tf.jinja +++ b/custom/templates/base.tf.jinja @@ -104,6 +104,7 @@ resource "spacelift_stack" "{{ stack._relationships.space._migration_id }}_{{ st } {% elif stack.vcs.provider == "azure_devops" %} azure_devops { + {{ argument("id", stack.vcs.integration_id, default=None) }} {{ argument("project", stack.vcs.namespace) }} } {% elif stack.vcs.provider %}