Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pipeline Moved to new Certification #5017

Merged
merged 65 commits into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from 64 commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
f155635
test-1
ugras-ergun-sonarsource Nov 7, 2023
a1826a5
add signtool path
ugras-ergun-sonarsource Nov 7, 2023
ff8a7b4
add password to sha1
ugras-ergun-sonarsource Nov 7, 2023
117ebd5
removed sha1
ugras-ergun-sonarsource Nov 7, 2023
637cea6
just try
ugras-ergun-sonarsource Nov 8, 2023
da85b73
azure deneme
ugras-ergun-sonarsource Nov 8, 2023
55a71f0
a
ugras-ergun-sonarsource Nov 8, 2023
ddb93e2
adas
ugras-ergun-sonarsource Nov 8, 2023
2fa5a85
sadf
ugras-ergun-sonarsource Nov 8, 2023
57b91af
asdf
ugras-ergun-sonarsource Nov 8, 2023
11f79bb
aa
ugras-ergun-sonarsource Nov 8, 2023
3ae7a35
dgfs
ugras-ergun-sonarsource Nov 9, 2023
31768e1
dasfs
ugras-ergun-sonarsource Nov 9, 2023
c8b007e
adfs
ugras-ergun-sonarsource Nov 9, 2023
55d4300
ghfhc
ugras-ergun-sonarsource Nov 9, 2023
eb895cd
adgadss
ugras-ergun-sonarsource Nov 9, 2023
a39c435
asfasf
ugras-ergun-sonarsource Nov 9, 2023
968f316
agfa
ugras-ergun-sonarsource Nov 9, 2023
0babd2e
test with nuget
ugras-ergun-sonarsource Nov 9, 2023
b7399c7
test new
ugras-ergun-sonarsource Nov 9, 2023
9728409
fp
ugras-ergun-sonarsource Nov 9, 2023
684f62b
1111
ugras-ergun-sonarsource Nov 9, 2023
237ed92
sadsadasd
ugras-ergun-sonarsource Nov 9, 2023
e5e084d
aaaa
ugras-ergun-sonarsource Nov 9, 2023
9cbba6b
asdas
ugras-ergun-sonarsource Nov 9, 2023
a6db1de
pwrshell
ugras-ergun-sonarsource Nov 9, 2023
8ebe94f
aasdd
ugras-ergun-sonarsource Nov 9, 2023
beafd81
env
ugras-ergun-sonarsource Nov 9, 2023
06a9764
fasdfasd
ugras-ergun-sonarsource Nov 9, 2023
d0b13a6
aaaa
ugras-ergun-sonarsource Nov 9, 2023
08ee0c3
dasfadsf
ugras-ergun-sonarsource Nov 9, 2023
1946f40
changes
ugras-ergun-sonarsource Nov 9, 2023
ad23c66
yeter
ugras-ergun-sonarsource Nov 9, 2023
dc3c908
filename
ugras-ergun-sonarsource Nov 9, 2023
5b7de0c
dsaf
ugras-ergun-sonarsource Nov 9, 2023
d68dd23
dasfasdf
ugras-ergun-sonarsource Nov 9, 2023
a5dc77c
path
ugras-ergun-sonarsource Nov 9, 2023
a95a325
ooooo
ugras-ergun-sonarsource Nov 9, 2023
26bb7eb
add step names and condition
ugras-ergun-sonarsource Nov 10, 2023
5f22f7c
fixed var
ugras-ergun-sonarsource Nov 10, 2023
69fbaa4
clean-up test 1
ugras-ergun-sonarsource Nov 10, 2023
a35f998
Revert "clean-up test 1"
ugras-ergun-sonarsource Nov 10, 2023
6280352
removed signtool step1
ugras-ergun-sonarsource Nov 10, 2023
45c7dc4
sm_kp removed
ugras-ergun-sonarsource Nov 10, 2023
a1a573e
a
ugras-ergun-sonarsource Nov 10, 2023
e5942da
comment issue
ugras-ergun-sonarsource Nov 10, 2023
83c45e3
signtool
ugras-ergun-sonarsource Nov 10, 2023
6d964b2
remove same name variables
ugras-ergun-sonarsource Nov 10, 2023
2b5391d
sm_kp
ugras-ergun-sonarsource Nov 10, 2023
72ce792
sm cert
ugras-ergun-sonarsource Nov 10, 2023
96be7aa
sm cert fp
ugras-ergun-sonarsource Nov 10, 2023
8f9b9df
SM_CLIENT_CERT_FILE
ugras-ergun-sonarsource Nov 10, 2023
8976dc2
SM_API_KEY
ugras-ergun-sonarsource Nov 10, 2023
23e1260
SM_HOST
ugras-ergun-sonarsource Nov 10, 2023
d0e7cb2
SIGNTOOL_PATH
ugras-ergun-sonarsource Nov 10, 2023
90fe757
Locate signtool removed
ugras-ergun-sonarsource Nov 10, 2023
b2f136e
SM_CERT_FP use var
ugras-ergun-sonarsource Nov 10, 2023
7df3bcb
SM_KP
ugras-ergun-sonarsource Nov 10, 2023
31d0b70
SM_CERT
ugras-ergun-sonarsource Nov 10, 2023
9c788f8
disable all
ugras-ergun-sonarsource Nov 10, 2023
e08e15e
SM_CLIENT_CERT_FILE
ugras-ergun-sonarsource Nov 10, 2023
15fdb0c
SM_CLIENT_CERT_PASSWORD
ugras-ergun-sonarsource Nov 10, 2023
9192108
final
ugras-ergun-sonarsource Nov 10, 2023
b31dc6c
final2
ugras-ergun-sonarsource Nov 10, 2023
644c5e1
PR feedback
ugras-ergun-sonarsource Nov 10, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 39 additions & 10 deletions pipeline/azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
variables:
- group: sonarsource-build-variables
- group: digicert-keylocker
- name: BuildParameters.solution
value: SonarLint.VisualStudio.Integration.sln

Expand Down Expand Up @@ -68,12 +69,6 @@ jobs:
targetType: filePath
filePath: $(System.DefaultWorkingDirectory)\pipeline\scripts\read-versions.props.ps1

- task: PowerShell@2
displayName: Locate signtool.exe
inputs:
targetType: filePath
filePath: $(System.DefaultWorkingDirectory)\pipeline\scripts\locate-signtool.ps1

- task: PowerShell@2
displayName: (VS2022 only) Set VsixVersion as a build property for the release pipeline to use
env:
Expand Down Expand Up @@ -104,11 +99,32 @@ jobs:
retryCount: 5

- task: DownloadSecureFile@1
name: pfx
displayName: Download pfx file
name: SM_CLIENT_CERT
displayName: Download p12 file
inputs:
secureFile: SonarSource-2021-2023.pfx
secureFile: digicert_authentication_certificate.p12
retryCount: 5

- task: SSMClientToolsSetup@1
displayName: Client Tools Setup
condition: eq(variables['SHOULD_SIGN'], 'true')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand who sets SHOULD_SIGN to true and when this happens. Could give me a hint? :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, now I got it. Thanks!


- task: SSMSigningToolsSetup@1
displayName: Signing Tools Setup
condition: eq(variables['SHOULD_SIGN'], 'true')

- task: PowerShell@2
displayName: Syncs certificates to local Windows store
inputs:
targetType: 'inline'
script: |
Write-Output "smctl healthcheck:"
smctl healthcheck
Write-Output "smctl sync:"
smctl windows certsync
env:
SM_API_KEY: $(SM_API_KEY)
condition: eq(variables['SHOULD_SIGN'], 'true')

# Specify the version of Java to use.
# See https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/java-tool-installer-v0?view=azure-pipelines
Expand Down Expand Up @@ -154,12 +170,25 @@ jobs:
inputs:
solution: $(BuildParameters.solution)
vsVersion: 17.0
msbuildArgs: /p:VsTargetVersion=$(vsTargetVersion) /p:DeployExtension=false /p:SignArtifacts=$(SHOULD_SIGN) /p:AssemblyOriginatorKeyFile="$(snk.secureFilePath)" /p:pfxCertificatePath="$(pfx.secureFilePath)" /p:pfxPassword="$(pfxPassword2021-2023)" /p:pfxSha1=$(pfxSha1-2021-2023) /p:Sha1=$(Build.SourceVersion) /p:BuildNumber=$(Build.BuildId) $(AdditionalMSBuildArgs)
msbuildArgs: /p:VsTargetVersion=$(vsTargetVersion) /p:DeployExtension=false /p:SignArtifacts=false /p:AssemblyOriginatorKeyFile="$(snk.secureFilePath)" /p:Sha1=$(Build.SourceVersion) /p:BuildNumber=$(Build.BuildId) $(AdditionalMSBuildArgs)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now instead of signing the artifact on build we sign them after the build.

pavel-mikula-sonarsource marked this conversation as resolved.
Show resolved Hide resolved
pavel-mikula-sonarsource marked this conversation as resolved.
Show resolved Hide resolved
platform: $(BuildPlatform)
configuration: $(BuildConfiguration)
maximumCpuCount: true
logFileVerbosity: diagnostic

- task: PowerShell@2
displayName: Sign Vsix file
env:
PACKAGES_PATH: '$(Build.SourcesDirectory)\binaries\SonarLint.VSIX-$(SONAR_PROJECT_VERSION).$(Build.BuildId)-$(vsTargetVersion).vsix'
pavel-mikula-sonarsource marked this conversation as resolved.
Show resolved Hide resolved
SM_HOST: $(SM_HOST)
SM_API_KEY: $(SM_API_KEY)
SM_CLIENT_CERT_PASSWORD: $(SM_CLIENT_CERT_PASSWORD)
SM_CLIENT_CERT_FILE: $(SM_CLIENT_CERT.secureFilePath)
inputs:
targetType: 'inline'
script: nuget sign "$env:PACKAGES_PATH" -Overwrite -HashAlgorithm SHA256 -CertificateFingerprint $(SM_CERT_FP) -Timestamper http://timestamp.digicert.com -TimestampHashAlgorithm SHA256
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By trials done by Tom nuget sign is the only command that works for vsix signing.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you try to remove the -Override? The docs says this, and I don't see a way how the package could already have a signature in CI

Switch to indicate if the current signature should be overwritten. By default the command will fail if the package already has a signature.

condition: eq(variables['SHOULD_SIGN'], 'true')

- task: CopyFiles@2
displayName: 'Copy asmref files to: $(Build.ArtifactStagingDirectory) in the event of a build failure'
inputs:
Expand Down
18 changes: 0 additions & 18 deletions pipeline/scripts/locate-signtool.ps1

This file was deleted.