Skip to content

Commit 946fc4e

Browse files
authored
Merge pull request #137 from tSQLt-org/Fix-Main-Azure-Build-pipeline-is-not-rerunnable-#135
Fix main azure build pipeline is not rerunnable #135
2 parents 383e1aa + 02422b4 commit 946fc4e

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

CI/Azure-DevOps/AZ_MainPipeline.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,14 @@ parameters: # TODO, these don't work for scheduled pipelines, not even the defau
2323
SQLVersionEdition: 2017
2424
- name: SQL2019
2525
SQLVersionEdition: 2019
26-
26+
- name: VMPriority
27+
displayName: VM Priority
28+
type: string
29+
default: Spot
30+
values:
31+
- Spot
32+
- Regular
33+
- Low
2734

2835
variables:
2936
- name: ArtifactBranchName
@@ -77,6 +84,7 @@ stages:
7784
${{ each version in parameters.VMMatrix }}:
7885
${{ format('{0}', version.name) }}:
7986
SQLVersionEdition: ${{ version.SQLVersionEdition }}
87+
SQLVersionName: ${{ version.name }}
8088

8189
steps:
8290
- checkout: self
@@ -99,7 +107,7 @@ stages:
99107
Set-Location "$(Pipeline.Workspace)/$(TSQLT_REPO_DIR)"
100108
.("Build/CommonFunctionsAndMethods.ps1")
101109
102-
$ResourceGroupName = ("$(NamePreFix)" + (Get-Date).tostring('yyyyMMdd') + "_" + "$(SQLVersionEdition)" + "_" + "$(Build.BuildId)");
110+
$ResourceGroupName = ("$(NamePreFix)" + (Get-Date).tostring('yyyyMMdd') + "_" + "$(SQLVersionName)" + "_" + "$(Build.BuildId)");
103111
Log-Output "ResourceGroupName: $ResourceGroupName";
104112
Write-Host "##vso[task.setvariable variable=ResourceGroupName;isOutput=true]$ResourceGroupName";
105113
@@ -140,6 +148,7 @@ stages:
140148
SQLPort="$SqlPort";
141149
SQLUserName="$SQLUserName";
142150
SQLPwd="$SQLPwd";
151+
VMPriority="${{ parameters.VMPriority }}";
143152
};
144153
$VMDetails = .'CI/Azure-DevOps/CreateSQLVM_azcli.ps1' @Parameters
145154
@@ -611,7 +620,7 @@ stages:
611620
git switch "$(ArtifactBranchName)"
612621
$CheckIfGitOk.invoke($?);
613622
614-
git tag $TagName;
623+
git tag -f $TagName;
615624
$CheckIfGitOk.invoke($?);
616625
617626
git push --tags

CI/Azure-DevOps/CreateSQLVM_azcli.ps1

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ Param(
99
[Parameter(Mandatory=$true)][ValidateNotNullOrEmpty()][string] $SQLVersionEdition,
1010
[Parameter(Mandatory=$true)][ValidateNotNullOrEmpty()][string] $SQLPort,
1111
[Parameter(Mandatory=$true)][ValidateNotNullOrEmpty()][string] $SQLUserName,
12-
[Parameter(Mandatory=$true)][ValidateNotNullOrEmpty()][string] $SQLPwd
12+
[Parameter(Mandatory=$true)][ValidateNotNullOrEmpty()][string] $SQLPwd,
13+
[Parameter(Mandatory=$true)][ValidateNotNullOrEmpty()][string] $VMPriority
1314
);
1415

1516
$scriptpath = $MyInvocation.MyCommand.Path;
@@ -28,6 +29,7 @@ Log-Output "ResourceGroupName:", $ResourceGroupName;
2829
Log-Output "BuildId:", $BuildId;
2930
Log-Output "SQLVersionEdition:", $SQLVersionEdition;
3031
Log-Output "SQLPort:", $SQLPort;
32+
Log-Output "VMPriority:", $VMPriority;
3133
Log-Output "Parameters: ---------------------------";
3234
Log-Output "<-><-><-><-><-><-><-><-><-><-><-><-><-><->";
3335

@@ -128,7 +130,7 @@ Log-Output "DONE: Creating NIC $InterfaceName";
128130
Log-Output "Creating VM $VMName";
129131

130132
$output = az vm create --name "$VMName" --resource-group "$ResourceGroupName" --location "$Location" --admin-password "$VMAdminPwd" `
131-
--admin-username "$VMAdminName" --computer-name "$VMName" --image "$ImageUrn" --nics "$InterfaceName" --priority Spot `
133+
--admin-username "$VMAdminName" --computer-name "$VMName" --image "$ImageUrn" --nics "$InterfaceName" --priority "$VMPriority" `
132134
--size $Size --data-disk-sizes-gb 8 | ConvertFrom-Json;
133135
if (!$output) {
134136
Log-Output "VMName: ", $VMName;

0 commit comments

Comments
 (0)