From 9668356e5df26cf0d38a0652e5c25e814fd65154 Mon Sep 17 00:00:00 2001 From: Ryan Newington Date: Sat, 4 Feb 2023 08:52:11 +1100 Subject: [PATCH 1/9] Update azure-pipelines.yml for Azure Pipelines --- azure-pipelines.yml | 118 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 106 insertions(+), 12 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 08f5c34..a72469d 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -19,23 +19,24 @@ variables: - name: build.date value: $[format('{0:yyyy}-{0:MM}-{0:dd}T{0:HH}:{0:mm}:{0:ss}', pipeline.startTime)] - group: Azure KeyVault Code Signing + - group: PSGallery name: $(build.version.major).$(build.version.minor).$(build.version.revision)$(build.version.suffix) trigger: none stages: -- stage: build +- stage: build-provider displayName: Build credential provider dependsOn: [] jobs: - - job: "buildjob" + - job: "build-provider-job" steps: - task: DotNetCoreCLI@2 displayName: dotnet build inputs: command: build publishWebProjects: false - arguments: '-c $(buildConfiguration) -p:Version=$(build.version) -p:PackageOutputPath=$(Build.ArtifactStagingDirectory)' + arguments: '-c $(buildConfiguration) -p:Version=$(build.version) -p:PackageOutputPath=$(Build.ArtifactStagingDirectory)\cp' projects: 'src/Lithnet.CredentialProvider/Lithnet.CredentialProvider.csproj' zipAfterPublish: false @@ -88,7 +89,7 @@ stages: targetType: 'inline' script: | $cmdargs = @( - "sign", "$(Build.ArtifactStagingDirectory)\Lithnet.CredentialProvider.$(build.version).nupkg" + "sign", "$(Build.ArtifactStagingDirectory)\cp\Lithnet.CredentialProvider.$(build.version).nupkg" "-fd", "sha256", "-kvu", "$(akv.url)", "-kvi", "$(akv.applicationID)", @@ -109,7 +110,7 @@ stages: targetType: 'inline' script: | $cmdargs = @( - "sign", "$(Build.ArtifactStagingDirectory)\Lithnet.CredentialProvider.$(build.version).snupkg" + "sign", "$(Build.ArtifactStagingDirectory)\cp\Lithnet.CredentialProvider.$(build.version).snupkg" "-fd", "sha256", "-kvu", "$(akv.url)", "-kvi", "$(akv.applicationID)", @@ -128,7 +129,7 @@ stages: displayName: Publish package to internal feed inputs: command: 'push' - packagesToPush: '$(Build.ArtifactStagingDirectory)/*.nupkg' + packagesToPush: '$(Build.ArtifactStagingDirectory)/cp/*.nupkg' nuGetFeedType: 'internal' publishVstsFeed: '91a552bc-359d-4f28-bdbd-f36f71cfdf81' @@ -136,18 +137,89 @@ stages: displayName: Publish symbols to internal feed inputs: command: 'push' - packagesToPush: '$(Build.ArtifactStagingDirectory)/*.snupkg' + packagesToPush: '$(Build.ArtifactStagingDirectory)/cp/*.snupkg' nuGetFeedType: 'internal' publishVstsFeed: '91a552bc-359d-4f28-bdbd-f36f71cfdf81' - task: PublishPipelineArtifact@1 + displayName: Publish nuget artifact inputs: - targetPath: '$(Build.ArtifactStagingDirectory)' + targetPath: '$(Build.ArtifactStagingDirectory)/cp' publishLocation: 'pipeline' -- stage: publish + - task: PublishPipelineArtifact@1 + displayName: Publish PS artifact + inputs: + targetPath: '$(Build.ArtifactStagingDirectory)/ps' + publishLocation: 'pipeline' + +- stage: build-psmodule + displayName: Build PowerShell module + dependsOn: [] + jobs: + - job: "build-ps-job" + steps: + - task: DotNetCoreCLI@2 + displayName: dotnet build + inputs: + command: build + publishWebProjects: false + arguments: '-c $(buildConfiguration) -p:Version=$(build.version) --output "$(Build.ArtifactStagingDirectory)\ps"' + projects: 'src/Lithnet.CredentialProvider.Management/Lithnet.CredentialProvider.Management.csproj' + zipAfterPublish: false + + - task: PowerShell@2 + displayName: 'Update manifest version' + inputs: + targetType: 'inline' + script: | + Update-ModuleManifest -Path "$(Build.ArtifactStagingDirectory)\ps\Lithnet.CredentialProvider.Management.psd1" -ModuleVersion "$(build.version)" + + - task: DotNetCoreCLI@2 + inputs: + command: 'custom' + custom: 'tool' + arguments: 'update --global azuresigntool' + displayName: Install AzureSignTool + + - task: PowerShell@2 + displayName: 'Sign files with AzureSignTool' + inputs: + targetType: 'inline' + script: | + $files = @() + $files += (Get-ChildItem -Recurse -Path "$(Build.ArtifactStagingDirectory)\ps\Lithnet*.dll").FullName + $files += (Get-ChildItem -Recurse -Path "$(Build.ArtifactStagingDirectory)\ps\Lithnet*.psd1").FullName + + write-host "Signing $($files.Length) files:" + write-output $files + + $cmdargs = @( + "sign", + "-d", "Lithnet Windows Credential Provider", + "-kvu", "$(akv.url)", + "-kvi", "$(akv.applicationID)", + "-kvs", "$(akv.secret)", + "-kvt", "$(akv.tenantId)", + "-kvc", "$(akv.certificateName)", + "-tr", "http://timestamp.digicert.com", + "-td", "sha256" + ) + + $cmdargs += $files + + & AzureSignTool $cmdargs + failOnStderr: true + showWarnings: true + + - task: PublishPipelineArtifact@1 + inputs: + targetPath: '$(Build.ArtifactStagingDirectory)\ps' + publishLocation: 'pipeline' + +- stage: publish-nuget displayName: Publish packages to production feed - dependsOn: "build" + dependsOn: "build-provider" jobs: - deployment: 'PublishPackages' environment: 'Production' @@ -158,7 +230,7 @@ stages: runOnce: deploy: steps: - - checkout: self + - checkout: none - task: NuGetToolInstaller@1 inputs: versionSpec: '>=4.9.0-0' @@ -168,4 +240,26 @@ stages: command: 'push' packagesToPush: '$(Pipeline.Workspace)/**/*.nupkg' nuGetFeedType: 'external' - publishFeedCredentials: 'WindowsCredentialProviderNuget' \ No newline at end of file + publishFeedCredentials: 'WindowsCredentialProviderNuget' + +- stage: publish-psgallery + displayName: Publish module to PSGallery + dependsOn: "build-psmodule" + jobs: + - deployment: 'PublishPackages' + environment: 'Production' + displayName: Publish packages to public PSGallery + pool: + vmImage: windows-2022 + strategy: + runOnce: + deploy: + steps: + - checkout: none + - task: PowerShell@2 + displayName: 'Upload module to PSGallery' + inputs: + targetType: 'inline' + script: | + Publish-Module -Path "$(Pipeline.Workspace)\ps\Lithnet.CredentialProvider.Management.psd1" -NuGetApiKey "$(psgallery.apikey)" + From 6bc51da3a8ba73f1b6fcbd96658933b92d00e3c2 Mon Sep 17 00:00:00 2001 From: Ryan Newington Date: Sat, 4 Feb 2023 08:53:25 +1100 Subject: [PATCH 2/9] Update azure-pipelines.yml for Azure Pipelines --- azure-pipelines.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index a72469d..67ba5b4 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -29,7 +29,7 @@ stages: displayName: Build credential provider dependsOn: [] jobs: - - job: "build-provider-job" + - job: "build_provider_job" steps: - task: DotNetCoreCLI@2 displayName: dotnet build @@ -153,11 +153,11 @@ stages: targetPath: '$(Build.ArtifactStagingDirectory)/ps' publishLocation: 'pipeline' -- stage: build-psmodule +- stage: build_psmodule displayName: Build PowerShell module dependsOn: [] jobs: - - job: "build-ps-job" + - job: "build_ps_job" steps: - task: DotNetCoreCLI@2 displayName: dotnet build @@ -217,9 +217,9 @@ stages: targetPath: '$(Build.ArtifactStagingDirectory)\ps' publishLocation: 'pipeline' -- stage: publish-nuget +- stage: publish_nuget displayName: Publish packages to production feed - dependsOn: "build-provider" + dependsOn: "build_provider" jobs: - deployment: 'PublishPackages' environment: 'Production' @@ -242,9 +242,9 @@ stages: nuGetFeedType: 'external' publishFeedCredentials: 'WindowsCredentialProviderNuget' -- stage: publish-psgallery +- stage: publish_psgallery displayName: Publish module to PSGallery - dependsOn: "build-psmodule" + dependsOn: "build_psmodule" jobs: - deployment: 'PublishPackages' environment: 'Production' From bcc80b28b2675c4379ca8e4a04437a951c2136e4 Mon Sep 17 00:00:00 2001 From: Ryan Newington Date: Sat, 4 Feb 2023 08:54:01 +1100 Subject: [PATCH 3/9] Update azure-pipelines.yml for Azure Pipelines --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 67ba5b4..5885f17 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -25,7 +25,7 @@ name: $(build.version.major).$(build.version.minor).$(build.version.revision)$(b trigger: none stages: -- stage: build-provider +- stage: build_provider displayName: Build credential provider dependsOn: [] jobs: From 1c6bc45083b314f31ea49190aa3cd152625644a2 Mon Sep 17 00:00:00 2001 From: Ryan Newington Date: Sat, 4 Feb 2023 09:01:50 +1100 Subject: [PATCH 4/9] Update azure-pipelines.yml for Azure Pipelines --- azure-pipelines.yml | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 5885f17..6003fef 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -35,17 +35,8 @@ stages: displayName: dotnet build inputs: command: build - publishWebProjects: false - arguments: '-c $(buildConfiguration) -p:Version=$(build.version) -p:PackageOutputPath=$(Build.ArtifactStagingDirectory)\cp' + arguments: '-c $(buildConfiguration) -p:Version=$(build.version) -p:GeneratePackageOnBuild=false' projects: 'src/Lithnet.CredentialProvider/Lithnet.CredentialProvider.csproj' - zipAfterPublish: false - - - task: DotNetCoreCLI@2 - inputs: - command: 'custom' - custom: 'tool' - arguments: 'update --global NuGetKeyVaultSignTool' - displayName: Install NugetKeyVaultSignTool - task: DotNetCoreCLI@2 inputs: @@ -83,6 +74,22 @@ stages: failOnStderr: true showWarnings: true + - task: DotNetCoreCLI@2 + displayName: dotnet pack + inputs: + command: pack + nobuild: true + includesymbols: true + arguments: '-p:PackageOutputPath=$(Build.ArtifactStagingDirectory)\cp' + projects: 'src/Lithnet.CredentialProvider/Lithnet.CredentialProvider.csproj' + + - task: DotNetCoreCLI@2 + inputs: + command: 'custom' + custom: 'tool' + arguments: 'update --global NuGetKeyVaultSignTool' + displayName: Install NugetKeyVaultSignTool + - task: PowerShell@2 displayName: 'Sign Nuget package' inputs: @@ -163,10 +170,8 @@ stages: displayName: dotnet build inputs: command: build - publishWebProjects: false arguments: '-c $(buildConfiguration) -p:Version=$(build.version) --output "$(Build.ArtifactStagingDirectory)\ps"' projects: 'src/Lithnet.CredentialProvider.Management/Lithnet.CredentialProvider.Management.csproj' - zipAfterPublish: false - task: PowerShell@2 displayName: 'Update manifest version' @@ -238,7 +243,7 @@ stages: displayName: 'Publish nuget package to public feed' inputs: command: 'push' - packagesToPush: '$(Pipeline.Workspace)/**/*.nupkg' + packagesToPush: '$(Pipeline.Workspace)/cp/*.nupkg' nuGetFeedType: 'external' publishFeedCredentials: 'WindowsCredentialProviderNuget' From ad820a7674cf82a338aabe21c07a8f665d9d1a72 Mon Sep 17 00:00:00 2001 From: Ryan Newington Date: Sat, 4 Feb 2023 09:02:26 +1100 Subject: [PATCH 5/9] Update azure-pipelines.yml for Azure Pipelines --- azure-pipelines.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 6003fef..5398665 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -154,12 +154,6 @@ stages: targetPath: '$(Build.ArtifactStagingDirectory)/cp' publishLocation: 'pipeline' - - task: PublishPipelineArtifact@1 - displayName: Publish PS artifact - inputs: - targetPath: '$(Build.ArtifactStagingDirectory)/ps' - publishLocation: 'pipeline' - - stage: build_psmodule displayName: Build PowerShell module dependsOn: [] @@ -218,8 +212,9 @@ stages: showWarnings: true - task: PublishPipelineArtifact@1 + displayName: Publish PS artifact inputs: - targetPath: '$(Build.ArtifactStagingDirectory)\ps' + targetPath: '$(Build.ArtifactStagingDirectory)/ps' publishLocation: 'pipeline' - stage: publish_nuget From 4d598fc7afd0d6b296222df4a0406aa352699640 Mon Sep 17 00:00:00 2001 From: Ryan Newington Date: Sat, 4 Feb 2023 09:03:18 +1100 Subject: [PATCH 6/9] Update azure-pipelines.yml for Azure Pipelines --- azure-pipelines.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 5398665..e09fec2 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -161,11 +161,12 @@ stages: - job: "build_ps_job" steps: - task: DotNetCoreCLI@2 - displayName: dotnet build + displayName: dotnet publish inputs: - command: build - arguments: '-c $(buildConfiguration) -p:Version=$(build.version) --output "$(Build.ArtifactStagingDirectory)\ps"' - projects: 'src/Lithnet.CredentialProvider.Management/Lithnet.CredentialProvider.Management.csproj' + command: 'publish' + arguments: '-c $(buildConfiguration) -p:Version=$(build.version) --output "$(Build.ArtifactStagingDirectory)\ps"' + zipAfterPublish: false + modifyOutputPath: false - task: PowerShell@2 displayName: 'Update manifest version' From 7b47c60eaac36505c115147397d6ae3ad6f42c29 Mon Sep 17 00:00:00 2001 From: Ryan Newington Date: Sat, 4 Feb 2023 09:09:11 +1100 Subject: [PATCH 7/9] Update azure-pipelines.yml for Azure Pipelines --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index e09fec2..1f12dba 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -81,7 +81,7 @@ stages: nobuild: true includesymbols: true arguments: '-p:PackageOutputPath=$(Build.ArtifactStagingDirectory)\cp' - projects: 'src/Lithnet.CredentialProvider/Lithnet.CredentialProvider.csproj' + packagesToPack: 'src/Lithnet.CredentialProvider/Lithnet.CredentialProvider.csproj' - task: DotNetCoreCLI@2 inputs: From a1c6dea29eca6a37791dad88f1311aaa1a9af451 Mon Sep 17 00:00:00 2001 From: Ryan Newington Date: Sat, 4 Feb 2023 09:14:32 +1100 Subject: [PATCH 8/9] Update azure-pipelines.yml for Azure Pipelines --- azure-pipelines.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 1f12dba..286f9a4 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -77,12 +77,13 @@ stages: - task: DotNetCoreCLI@2 displayName: dotnet pack inputs: - command: pack + command: 'pack' + packagesToPack: 'src/Lithnet.CredentialProvider/Lithnet.CredentialProvider.csproj' + packDirectory: '$(Build.ArtifactStagingDirectory)\cp' nobuild: true includesymbols: true - arguments: '-p:PackageOutputPath=$(Build.ArtifactStagingDirectory)\cp' - packagesToPack: 'src/Lithnet.CredentialProvider/Lithnet.CredentialProvider.csproj' - + versioningScheme: 'off' + - task: DotNetCoreCLI@2 inputs: command: 'custom' From 1e378eb1db0b83dff322e9b0dd60ccca985969cf Mon Sep 17 00:00:00 2001 From: Ryan Newington Date: Sat, 4 Feb 2023 09:16:02 +1100 Subject: [PATCH 9/9] Update azure-pipelines.yml for Azure Pipelines --- azure-pipelines.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 286f9a4..b0c6a31 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -83,7 +83,7 @@ stages: nobuild: true includesymbols: true versioningScheme: 'off' - + - task: DotNetCoreCLI@2 inputs: command: 'custom' @@ -165,6 +165,8 @@ stages: displayName: dotnet publish inputs: command: 'publish' + publishWebProjects: false + projects: 'src/Lithnet.CredentialProvider.Management/Lithnet.CredentialProvider.Management.csproj' arguments: '-c $(buildConfiguration) -p:Version=$(build.version) --output "$(Build.ArtifactStagingDirectory)\ps"' zipAfterPublish: false modifyOutputPath: false