Skip to content

Commit 23f2800

Browse files
azure-sdkbenbp
andauthored
Swap defaults: -Login and -PushImages to -SkipLogin and -SkipPushImages (Azure#30327)
Co-authored-by: Ben Broderick Phillips <[email protected]>
1 parent 2c92288 commit 23f2800

File tree

2 files changed

+16
-18
lines changed

2 files changed

+16
-18
lines changed

eng/common/scripts/stress-testing/deploy-stress-tests.ps1

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
1-
# Set a default parameter set here so we can call this script without requiring -Login and -Subscription,
2-
# but if it IS called with either of those, then both parameters need to be required. Not defining a
3-
# default parameter set makes Login/Subscription required all the time.
1+
# Not defining a default parameter set makes SkipLogin/Subscription required all the time.
42
[CmdletBinding(DefaultParameterSetName = 'Default')]
53
param(
64
[string]$SearchDirectory,
75
[hashtable]$Filters,
86
[string]$Environment,
97
[string]$Repository,
10-
[switch]$PushImages,
8+
[switch]$SkipPushImages,
119
[string]$ClusterGroup,
1210
[string]$DeployId,
13-
[switch]$Login,
11+
[switch]$SkipLogin,
1412
[string]$Subscription,
1513

1614
# Default to true in Azure Pipelines environments

eng/common/scripts/stress-testing/stress-test-deployment-lib.ps1

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function RunOrExitOnFailure()
4343
}
4444
}
4545

46-
function Login([string]$subscription, [string]$clusterGroup, [switch]$pushImages)
46+
function Login([string]$subscription, [string]$clusterGroup, [switch]$skipPushImages)
4747
{
4848
Write-Host "Logging in to subscription, cluster and container registry"
4949
az account show *> $null
@@ -73,7 +73,7 @@ function Login([string]$subscription, [string]$clusterGroup, [switch]$pushImages
7373
RunOrExitOnFailure kubectl config set-context $clusterName --namespace $defaultNamespace
7474
}
7575

76-
if ($pushImages) {
76+
if (!$skipPushImages) {
7777
$registry = RunOrExitOnFailure az acr list -g $clusterGroup --subscription $subscription -o json
7878
$registryName = ($registry | ConvertFrom-Json).name
7979
RunOrExitOnFailure az acr login -n $registryName
@@ -86,10 +86,10 @@ function DeployStressTests(
8686
# Default to playground environment
8787
[string]$environment = 'pg',
8888
[string]$repository = '',
89-
[switch]$pushImages,
89+
[switch]$skipPushImages,
9090
[string]$clusterGroup = '',
9191
[string]$deployId = '',
92-
[switch]$login,
92+
[switch]$skipLogin,
9393
[string]$subscription = '',
9494
[switch]$CI,
9595
[string]$Namespace,
@@ -125,8 +125,8 @@ function DeployStressTests(
125125
throw "clusterGroup and subscription parameters must be specified when deploying to an environment that is not pg or prod."
126126
}
127127

128-
if ($login) {
129-
Login -subscription $subscription -clusterGroup $clusterGroup -pushImages:$pushImages
128+
if (!$skipLogin) {
129+
Login -subscription $subscription -clusterGroup $clusterGroup -skipPushImages:$skipPushImages
130130
}
131131

132132
$chartRepoName = 'stress-test-charts'
@@ -162,8 +162,8 @@ function DeployStressTests(
162162
-deployId $deployer `
163163
-environment $environment `
164164
-repositoryBase $repository `
165-
-pushImages:$pushImages `
166-
-login:$login `
165+
-skipPushImages:$skipPushImages `
166+
-skipLogin:$skipLogin `
167167
-clusterGroup $clusterGroup `
168168
-subscription $subscription
169169
}
@@ -189,8 +189,8 @@ function DeployStressPackage(
189189
[string]$deployId,
190190
[string]$environment,
191191
[string]$repositoryBase,
192-
[switch]$pushImages,
193-
[switch]$login,
192+
[switch]$skipPushImages,
193+
[switch]$skipLogin,
194194
[string]$clusterGroup,
195195
[string]$subscription
196196
) {
@@ -267,7 +267,7 @@ function DeployStressPackage(
267267
}
268268
$dockerfileName = ($dockerFilePath -split { $_ -in '\', '/' })[-1].ToLower()
269269
$imageTag = $imageTagBase + "/${dockerfileName}:${deployId}"
270-
if ($pushImages) {
270+
if (!$skipPushImages) {
271271
Write-Host "Building and pushing stress test docker image '$imageTag'"
272272
$dockerFile = Get-ChildItem $dockerFilePath
273273

@@ -290,8 +290,8 @@ function DeployStressPackage(
290290

291291
Run docker push $imageTag
292292
if ($LASTEXITCODE) {
293-
if ($login) {
294-
Write-Warning "If docker push is failing due to authentication issues, try calling this script with '-Login'"
293+
if (!$skipLogin) {
294+
Write-Warning "If docker push is failing due to authentication issues, try calling this script without '-SkipLogin'"
295295
}
296296
}
297297
}

0 commit comments

Comments
 (0)