Skip to content

Commit f3094cd

Browse files
Fix SF task issues (#5634)
* Add a default value for the new setting configureDockerSettings. Ported from master(#5620) * Do not throw if server certificate is not present to encrypt password
1 parent b4ce3b2 commit f3094cd

File tree

8 files changed

+14
-11
lines changed

8 files changed

+14
-11
lines changed

Tasks/Common/ServiceFabricHelpers/Get-ServiceFabricEncryptedText.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ function Get-ServiceFabricEncryptedText
1717
$cert = Get-Item "Cert:\$defaultCertStoreLocation\$defaultCertStoreName\$serverCertThumbprint" -ErrorAction SilentlyContinue
1818
if (-not $cert)
1919
{
20-
throw (Get-VstsLocString -Key ServerCertificateNotFoundForTextEncrypt -ArgumentList $serverCertThumbprint)
20+
Write-Warning (Get-VstsLocString -Key ServerCertificateNotFoundForTextEncrypt -ArgumentList $serverCertThumbprint)
21+
return $Text
2122
}
2223

2324
# Encrypt the text using the cluster connection's certificate.

Tasks/ServiceFabricComposeDeploy/ServiceFabricComposeDeploy.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ try {
8282

8383
if ($registryCredentials -ne "None")
8484
{
85-
if (-not $isEncrypted)
85+
if (-not $isEncrypted -and $clusterConnectionParameters["ServerCertThumbprint"])
8686
{
8787
Write-Host (Get-VstsLocString -Key EncryptingPassword)
8888
$password = Get-ServiceFabricEncryptedText -Text $password -ClusterConnectionParameters $clusterConnectionParameters

Tasks/ServiceFabricComposeDeploy/task.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"version": {
1717
"Major": 0,
1818
"Minor": 1,
19-
"Patch": 5
19+
"Patch": 6
2020
},
2121
"demands": [
2222
"Cmd"

Tasks/ServiceFabricComposeDeploy/task.loc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"version": {
1717
"Major": 0,
1818
"Minor": 1,
19-
"Patch": 5
19+
"Patch": 6
2020
},
2121
"demands": [
2222
"Cmd"

Tasks/ServiceFabricDeploy/Strings/resources.resjson/en-US/resources.resjson

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@
5151
"loc.input.label.registryCredentials": "Registry Credentials Source",
5252
"loc.input.help.registryCredentials": "Choose how credentials for the Docker registry will be provided.",
5353
"loc.input.label.dockerRegistryEndpoint": "Docker Registry Connection",
54-
"loc.input.help.dockerRegistryEndpoint": "Select a Docker registry connection. Required for commands that need to authenticate with a registry.",
54+
"loc.input.help.dockerRegistryEndpoint": "Select a Docker registry connection. Required for commands that need to authenticate with a registry.<br/>Note: task will try to encrypt the registry secret before transmitting it to service fabric cluster. However, it needs cluster's server certiticate to be installed on agent machine in order to do so. If certificate is not present, secret will not be encrypted.",
5555
"loc.input.label.azureSubscriptionEndpoint": "Azure subscription",
56-
"loc.input.help.azureSubscriptionEndpoint": "Select an Azure subscription",
56+
"loc.input.help.azureSubscriptionEndpoint": "Select an Azure subscription.<br/>Note: task will try to encrypt the registry secret before transmitting it to service fabric cluster. However, it needs cluster's server certiticate to be installed on agent machine in order to do so. If certificate is not present, secret will not be encrypted.",
5757
"loc.input.label.registryUserName": "Registry User Name",
5858
"loc.input.help.registryUserName": "Username for the Docker registry",
5959
"loc.input.label.registryPassword": "Registry Password",

Tasks/ServiceFabricDeploy/Update-DockerSettings.psm1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function Update-DockerSettings
4343
}
4444
}
4545

46-
if (-not $isPasswordEncrypted)
46+
if (-not $isPasswordEncrypted -and $ClusterConnectionParameters["ServerCertThumbprint"])
4747
{
4848
$password = Get-ServiceFabricEncryptedText -Text $password -ClusterConnectionParameters $ClusterConnectionParameters
4949
$isPasswordEncrypted = $true

Tasks/ServiceFabricDeploy/task.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"version": {
1717
"Major": 1,
1818
"Minor": 4,
19-
"Patch": 1
19+
"Patch": 2
2020
},
2121
"demands": [
2222
"Cmd"
@@ -307,6 +307,7 @@
307307
"name": "configureDockerSettings",
308308
"type": "boolean",
309309
"label": "Configure Docker settings",
310+
"defaultValue": "false",
310311
"helpMarkDown": "Configures the application with the specified Docker settings.",
311312
"groupname": "docker"
312313
},
@@ -329,7 +330,7 @@
329330
"name": "dockerRegistryEndpoint",
330331
"type": "connectedService:dockerregistry",
331332
"label": "Docker Registry Connection",
332-
"helpMarkDown": "Select a Docker registry connection. Required for commands that need to authenticate with a registry.",
333+
"helpMarkDown": "Select a Docker registry connection. Required for commands that need to authenticate with a registry.<br/>Note: task will try to encrypt the registry secret before transmitting it to service fabric cluster. However, it needs cluster's server certiticate to be installed on agent machine in order to do so. If certificate is not present, secret will not be encrypted.",
333334
"visibleRule": "configureDockerSettings = true && registryCredentials = ContainerRegistryEndpoint",
334335
"required": true,
335336
"groupname": "docker"
@@ -338,7 +339,7 @@
338339
"name": "azureSubscriptionEndpoint",
339340
"type": "connectedService:AzureRM",
340341
"label": "Azure subscription",
341-
"helpMarkDown": "Select an Azure subscription",
342+
"helpMarkDown": "Select an Azure subscription.<br/>Note: task will try to encrypt the registry secret before transmitting it to service fabric cluster. However, it needs cluster's server certiticate to be installed on agent machine in order to do so. If certificate is not present, secret will not be encrypted.",
342343
"visibleRule": "configureDockerSettings = true && registryCredentials = AzureResourceManagerEndpoint",
343344
"required": true,
344345
"groupname": "docker"

Tasks/ServiceFabricDeploy/task.loc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"version": {
1717
"Major": 1,
1818
"Minor": 4,
19-
"Patch": 1
19+
"Patch": 2
2020
},
2121
"demands": [
2222
"Cmd"
@@ -307,6 +307,7 @@
307307
"name": "configureDockerSettings",
308308
"type": "boolean",
309309
"label": "ms-resource:loc.input.label.configureDockerSettings",
310+
"defaultValue": "false",
310311
"helpMarkDown": "ms-resource:loc.input.help.configureDockerSettings",
311312
"groupname": "docker"
312313
},

0 commit comments

Comments
 (0)