Merged PR 173: Replacing tokens after CD is created and creating qa/main branches
Former-commit-id: fc715cccde950445bd4b1b807c4e5586fef05e4c
This commit is contained in:
Родитель
33c79e6a18
Коммит
2a00ec90aa
|
@ -0,0 +1 @@
|
|||
config.dev.json
|
|
@ -24,10 +24,12 @@ $repoInfo = CreateAzureDevopsRepository -RepoConfiguration $config.RepoConfigura
|
|||
|
||||
$directory = CloneRepo -RepoInfo $repoInfo -UseSSH $UseSSH -UsePAT $UsePAT -Verbose:$VerbosePreference
|
||||
ImportTemplateRepoToDomainRepo -RepoConfiguration $config.RepoConfiguration -UsePAT $UsePAT -Directory $directory[0] -Verbose:$VerbosePreference
|
||||
|
||||
CreateAzDevOpsYamlPipelines -RepoConfiguration $config.RepoConfiguration -Verbose:$VerbosePreference
|
||||
|
||||
UpdateIaCParameters -Configuration $config -Directory $directory[0] -Verbose:$VerbosePreference
|
||||
|
||||
CreateAzDevOpsRepoApprovalPolicy -RepoInfo $repoInfo -RepoConfiguration $config.RepoConfiguration -Verbose:$VerbosePreference
|
||||
CreateAzDevOpsRepoCommentPolicy -RepoInfo $repoInfo -RepoConfiguration $config.RepoConfiguration -Verbose:$VerbosePreference
|
||||
CreateAzDevOpsYamlPipelines -RepoConfiguration $config.RepoConfiguration -Verbose:$VerbosePreference
|
||||
CreateAzDevOpsRepoBuildPolicy -RepoInfo $repoInfo -RepoConfiguration $config.RepoConfiguration -Verbose:$VerbosePreference
|
||||
CreateAzDevOpsVariableGroups -RepoConfiguration $config.RepoConfiguration -Verbose:$VerbosePreference
|
||||
|
|
|
@ -21,8 +21,12 @@ function ImportTemplateRepoToDomainRepo {
|
|||
git remote add template $templateGitUrl
|
||||
git fetch template
|
||||
git merge remotes/template/main
|
||||
git branch -M $RepoConfiguration.DefaultBranchName
|
||||
git push -u origin $RepoConfiguration.DefaultBranchName
|
||||
|
||||
git push -u origin HEAD:main
|
||||
git push -u origin HEAD:qa
|
||||
|
||||
git branch -M $RepoConfiguration.DefaultBranchName
|
||||
git push origin HEAD
|
||||
|
||||
Set-Location -
|
||||
}
|
||||
|
@ -38,45 +42,36 @@ function UpdateIaCParameters {
|
|||
|
||||
Set-Location $Directory
|
||||
|
||||
git checkout $Configuration.RepoConfiguration.DefaultBranchName
|
||||
|
||||
BeginScope -Scope "IaC parameters"
|
||||
|
||||
ReplaceTemplateTokens `
|
||||
-Configuration $Configuration `
|
||||
ReplaceTemplateTokens -Configuration $Configuration -RemoveInput `
|
||||
-InputFile infrastructure-as-code/infrastructure/parameters/parameters.dev.template.json `
|
||||
-OutputFile infrastructure-as-code/infrastructure/parameters/parameters.dev.json
|
||||
|
||||
ReplaceTemplateTokens `
|
||||
-Configuration $Configuration `
|
||||
ReplaceTemplateTokens -Configuration $Configuration -RemoveInput `
|
||||
-InputFile infrastructure-as-code/infrastructure/parameters/parameters.qa.template.json `
|
||||
-OutputFile infrastructure-as-code/infrastructure/parameters/parameters.qa.json
|
||||
|
||||
ReplaceTemplateTokens `
|
||||
-Configuration $Configuration `
|
||||
ReplaceTemplateTokens -Configuration $Configuration -RemoveInput `
|
||||
-InputFile infrastructure-as-code/infrastructure/parameters/parameters.prod.template.json `
|
||||
-OutputFile infrastructure-as-code/infrastructure/parameters/parameters.prod.json
|
||||
|
||||
ReplaceTemplateTokens `
|
||||
-Configuration $Configuration `
|
||||
ReplaceTemplateTokens -Configuration $Configuration -RemoveInput `
|
||||
-InputFile azure-pipelines/databricks/databricks-lib-cd.template.yml `
|
||||
-OutputFile azure-pipelines/databricks/databricks-lib-cd.yml
|
||||
|
||||
ReplaceTemplateTokens `
|
||||
-Configuration $Configuration `
|
||||
ReplaceTemplateTokens -Configuration $Configuration -RemoveInput `
|
||||
-InputFile azure-pipelines/variable.environment.template.yml `
|
||||
-OutputFile azure-pipelines/variable.environment.yml
|
||||
|
||||
EndScope
|
||||
|
||||
git add infrastructure-as-code/infrastructure/parameters/parameters.dev.json
|
||||
git add infrastructure-as-code/infrastructure/parameters/parameters.qa.json
|
||||
git add infrastructure-as-code/infrastructure/parameters/parameters.prod.json
|
||||
git add azure-pipelines/databricks/databricks-lib-cd.yml
|
||||
git add azure-pipelines/variable.environment.yml
|
||||
|
||||
git add .
|
||||
git commit -m "Update IaC paramaters."
|
||||
git push -u origin HEAD:$($Configuration.RepoConfiguration.DefaultBranchName)
|
||||
|
||||
git push -u origin $RepoConfiguration.DefaultBranchName
|
||||
|
||||
Set-Location -
|
||||
}
|
||||
|
||||
|
@ -102,7 +97,8 @@ function ReplaceTemplateTokens {
|
|||
[Parameter(Mandatory)] [string] $InputFile,
|
||||
[Parameter(Mandatory)] [string] $OutputFile,
|
||||
[string] $StartTokenPattern = '<',
|
||||
[string] $EndTokenPattern = '>'
|
||||
[string] $EndTokenPattern = '>',
|
||||
[switch] $RemoveInput
|
||||
)
|
||||
|
||||
CleanFileIfExists -File $OutputFile
|
||||
|
@ -125,6 +121,10 @@ function ReplaceTemplateTokens {
|
|||
$line | Out-File -Append -FilePath $OutputFile
|
||||
}
|
||||
|
||||
if ($RemoveInput) {
|
||||
Remove-Item $InputFile
|
||||
}
|
||||
|
||||
Write-Host "Done! ($totalTokens tokens replaced successfully)"
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче