Skip to content

Commit 23f3ab5

Browse files
committed
Update azure-pipelines.yml for Azure Pipelines
Updated code with suggestions from initial code review.
1 parent 4fdc87f commit 23f3ab5

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

azure-pipelines.yml

+10-2
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,13 @@ steps:
118118
&az aks get-credentials --resource-group $(azureResourceGroup) --name $(kubernetesCluster)
119119
# Get all running pods in the namespace
120120
$content = &kubectl get pods -n pipeline-$(Build.BuildNumber) --field-selector=status.phase=Running 2>&1
121-
While ($content -like 'No resources found*')
121+
# Ensure that this task does not run for more than about 90 seconds
122+
$waitLimit = 90
123+
$timeWaiting = 0
124+
While (($content -like 'No resources found*') -and ($timeWaiting -lt $waitLimit))
122125
{
123126
start-sleep -Seconds 5
127+
$timeWaiting = $timeWaiting + 5
124128
$content = &kubectl get pods -n pipeline-$(Build.BuildNumber) --field-selector=status.phase=Running 2>&1
125129
}
126130
$content = &kubectl get pods -n pipeline-$(Build.BuildNumber) --field-selector=status.phase=Running -o jsonpath="{.items[0].metadata.name}"
@@ -148,9 +152,13 @@ steps:
148152
&az aks get-credentials --resource-group $(azureResourceGroup) --name $(kubernetesCluster)
149153
# Get ipAddress for service in namespace
150154
$content = &kubectl get services -n pipeline-$(Build.BuildNumber) -o jsonpath="{.items[0].status.loadBalancer.ingress[0].ip}"
151-
While ([String]::IsNullOrWhiteSpace($content))
155+
# Ensure that this task does not run for more than about 90 seconds
156+
$waitLimit = 90
157+
$timeWaiting = 0
158+
While ([String]::IsNullOrWhiteSpace($content) -and ($timeWaiting -lt $waitLimit))
152159
{
153160
start-sleep -Seconds 5
161+
$timeWaiting = $timeWaiting + 5
154162
$content = &kubectl get services -n pipeline-$(Build.BuildNumber) -o jsonpath="{.items[0].status.loadBalancer.ingress[0].ip}"
155163
}
156164
$content = &kubectl get services -n pipeline-$(Build.BuildNumber) -o jsonpath="{.items[0].status.loadBalancer.ingress[0].ip}"

0 commit comments

Comments
 (0)