Skip to content

Commit

Permalink
Improve AzureDevops mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
jmfontaine committed May 29, 2024
1 parent fc0e53f commit d280106
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ __pycache__
/.venv
/.vscode
/tmp
/vcs_config.csv
config.yml
terraform.tfstate*
10 changes: 8 additions & 2 deletions custom/commands/update_vcs_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
}
Expand Down
1 change: 1 addition & 0 deletions custom/templates/base.tf.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Expand Down

0 comments on commit d280106

Please sign in to comment.