Skip to content

Commit 6a495d1

Browse files
azure-pipelines: Add succeeded() conditions to signing template steps (#2143)
* Initial plan * Add succeeded() conditions to all signing steps in sign.yml Co-authored-by: bwateratmsft <[email protected]> * Add signprojExists check to multiple vsix steps for consistency Co-authored-by: bwateratmsft <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: bwateratmsft <[email protected]>
1 parent 037f4b4 commit 6a495d1

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

azure-pipelines/templates/sign.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,25 @@ steps:
1919
Write-Output "SignExtension.signproj file not found. Skipping signing."
2020
}
2121
displayName: "\U0001F449 Check for SignExtension.signproj File"
22-
condition: ${{ parameters.enableSigning }}
22+
condition: and(succeeded(), ${{ parameters.enableSigning }})
2323
2424
# put the extension name and version from the package.json into variables to use later. Variables can be used in later steps as $(package.name) and $(package.version)
2525
- pwsh: |
2626
Write-Output "##vso[task.setvariable variable=name;isOutput=true]$((Get-Content -Raw -Path package.json | ConvertFrom-Json).name)"
2727
Write-Output "##vso[task.setvariable variable=version;isOutput=true]$((Get-Content -Raw -Path package.json | ConvertFrom-Json).version)"
28-
condition: eq(variables['signprojExists'], True)
28+
condition: and(succeeded(), eq(variables['signprojExists'], True))
2929
name: package
3030
displayName: "\U0001F449 Get extension info from package.json"
3131
3232
# Sign single vsix file if vsixFileNames are not provided
3333
- ${{ if eq(join('', parameters.vsixFileNames), '') }}:
3434
- script: npx @vscode/vsce@latest generate-manifest -i $(package.name)-$(package.version).vsix -o $(Build.SourcesDirectory)/extension.manifest
35-
condition: eq(variables['signprojExists'], True)
35+
condition: and(succeeded(), eq(variables['signprojExists'], True))
3636
displayName: "\U0001F449 Generate extension manifest"
3737

3838
# this task will pass even if signing fails, so we follow it up with a check to see if the signature file was created
3939
- task: DotNetCoreCLI@2
40-
condition: eq(variables['signprojExists'], True)
40+
condition: and(succeeded(), eq(variables['signprojExists'], True))
4141
displayName: "\U0001F449 Sign with MSBuild"
4242
inputs:
4343
command: 'build'
@@ -56,17 +56,19 @@ steps:
5656
Write-Output "The file '$filePath' exists."
5757
exit 0
5858
displayName: "\U0001F449 Verify extension.signature.p7s file was created"
59-
condition: eq(variables['signprojExists'], True)
59+
condition: and(succeeded(), eq(variables['signprojExists'], True))
6060
6161
# If vsixFileNames are provided, sign each file in list and move to corresponding directory
6262
- ${{ if ne(join('', parameters.vsixFileNames), '') }}:
6363
# run this script for each item in vsixFileNames
6464
- ${{ each vsixFileName in parameters.vsixFileNames }}:
6565
- script: npx @vscode/vsce@latest generate-manifest -i ${{ vsixFileName }}-$(package.version).vsix -o $(Build.SourcesDirectory)/extension.manifest
66+
condition: and(succeeded(), eq(variables['signprojExists'], True))
6667
displayName: "\U0001F449 Generate extension manifest for ${{ vsixFileName }}"
6768

6869
# this task will pass even if signing fails, so we follow it up with a check to see if the signature file was created
6970
- task: DotNetCoreCLI@2
71+
condition: and(succeeded(), eq(variables['signprojExists'], True))
7072
displayName: "\U0001F449 Sign with MSBuild for ${{ vsixFileName }}"
7173
inputs:
7274
command: 'build'
@@ -85,6 +87,7 @@ steps:
8587
Write-Output "The file '$filePath' exists."
8688
exit 0
8789
displayName: "\U0001F449 Verify extension.signature.p7s file was created for ${{ vsixFileName }}"
90+
condition: and(succeeded(), eq(variables['signprojExists'], True))
8891
8992
- pwsh: |
9093
$targetDir = "${{ vsixFileName }}"
@@ -93,3 +96,4 @@ steps:
9396
Move-Item -Path "extension.manifest" -Destination "$(Build.SourcesDirectory)/$targetDir/extension.manifest" -Force
9497
Write-Output "Moved signature files to $targetDir directory"
9598
displayName: "\U0001F449 Move signature files to ${{ vsixFileName }} directory"
99+
condition: and(succeeded(), eq(variables['signprojExists'], True))

0 commit comments

Comments
 (0)