[1ES] Update extensions build template (#2475)

This commit is contained in:
Lilian Kasem 2024-05-29 10:35:10 -07:00 коммит произвёл GitHub
Родитель b6ad812cd0
Коммит 3d704f5b35
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
4 изменённых файлов: 111 добавлений и 88 удалений

Просмотреть файл

@ -1,6 +1,10 @@
parameters:
- name: Projects
type: object
default: []
- name: ExtensionProjectName
type: string
default: ''
jobs:
@ -21,93 +25,20 @@ jobs:
os: linux
variables:
${{ if and( not(contains(variables['Build.SourceBranch'], '/release/')), not(startsWith(variables['Build.SourceBranch'], 'refs/tags')) ) }}:
${{ if and(not(contains(variables['Build.SourceBranch'], '/release/')), not(startsWith(variables['Build.SourceBranch'], 'refs/tags'))) }}:
buildNumberTemp: $(Build.BuildNumber)
buildNumber: $[variables.buildNumberTemp]
steps:
- template: /eng/ci/templates/steps/install-dotnet.yml@self
- task: DotNetCoreCLI@2
displayName: Build project
inputs:
command: custom
custom: build
arguments: -p:BuildNumber=$(buildNumber) -c release
projects: |
extensions/${{ parameters.ExtensionProjectName }}/src/*.csproj
- ${{ if ne(parameters.ExtensionProjectName, '') }}:
- template: /eng/ci/templates/steps/build-extension-project.yml@self
parameters:
ExtensionProjectName: ${{ parameters.ExtensionProjectName }}
- task: EsrpCodeSigning@2
displayName: Sign assemblies
inputs:
ConnectedServiceName: ESRP Service-internal
FolderPath: extensions
Pattern: Microsoft.Azure.Functions.Worker.Extensions*.dll
signConfigType: inlineSignParams
inlineOperation: |
[
{
"KeyCode": "CP-230012",
"OperationCode": "SigntoolSign",
"Parameters": {
"OpusName": "Microsoft",
"OpusInfo": "http://www.microsoft.com",
"FileDigest": "/fd \"SHA256\"",
"PageHash": "/NPH",
"TimeStamp": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256"
},
"ToolName": "sign",
"ToolVersion": "1.0"
},
{
"KeyCode": "CP-230012",
"OperationCode": "SigntoolVerify",
"Parameters": {},
"ToolName": "sign",
"ToolVersion": "1.0"
}
]
- task: DeleteFiles@1
displayName: Delete CodeSignSummary files
inputs:
contents: '**/CodeSignSummary-*.md'
- task: DotNetCoreCLI@2
displayName: Pack extension
inputs:
command: custom
custom: pack
arguments: '--no-build -c release -o $(Build.ArtifactStagingDirectory)/NugetPackages -p:BuildNumber=$(buildNumber)'
projects: |
extensions/${{ parameters.ExtensionProjectName }}/src/*.csproj
- task: EsrpCodeSigning@2
displayName: Sign nuget packages
inputs:
ConnectedServiceName: ESRP Service-internal
FolderPath: $(Build.ArtifactStagingDirectory)/NugetPackages
Pattern: Microsoft.Azure.Functions.Worker.Extensions*.nupkg
signConfigType: inlineSignParams
inlineOperation: |
[
{
"KeyCode": "CP-401405",
"OperationCode": "NuGetSign",
"Parameters": {},
"ToolName": "sign",
"ToolVersion": "1.0"
},
{
"KeyCode": "CP-401405",
"OperationCode": "NuGetVerify",
"Parameters": {},
"ToolName": "sign",
"ToolVersion": "1.0"
}
]
- task: DeleteFiles@1
displayName: Delete CodeSignSummary files
inputs:
contents: '**/CodeSignSummary-*.md'
- ${{ if not(eq(length(parameters.Projects), 0)) }}:
- ${{ each Project in parameters.Projects }}:
- template: /eng/ci/templates/steps/build-extension-project.yml@self
parameters:
ExtensionProjectName: ${{ Project }}

Просмотреть файл

@ -0,0 +1,91 @@
parameters:
- name: ExtensionProjectName
type: string
steps:
- task: DotNetCoreCLI@2
displayName: Build project
inputs:
command: custom
custom: build
arguments: -p:BuildNumber=$(buildNumber) -c release
projects: |
extensions/${{ parameters.ExtensionProjectName }}/**/*.csproj
- task: EsrpCodeSigning@2
displayName: Sign assemblies
inputs:
ConnectedServiceName: ESRP Service-internal
FolderPath: extensions
Pattern: Microsoft.Azure.Functions.Worker.Extensions*.dll
signConfigType: inlineSignParams
inlineOperation: |
[
{
"KeyCode": "CP-230012",
"OperationCode": "SigntoolSign",
"Parameters": {
"OpusName": "Microsoft",
"OpusInfo": "http://www.microsoft.com",
"FileDigest": "/fd \"SHA256\"",
"PageHash": "/NPH",
"TimeStamp": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256"
},
"ToolName": "sign",
"ToolVersion": "1.0"
},
{
"KeyCode": "CP-230012",
"OperationCode": "SigntoolVerify",
"Parameters": {},
"ToolName": "sign",
"ToolVersion": "1.0"
}
]
- task: DeleteFiles@1
displayName: Delete CodeSignSummary files
inputs:
sourceFolder: $(Build.ArtifactStagingDirectory)/NugetPackages
contents: '**/CodeSignSummary-*.md'
- task: DotNetCoreCLI@2
displayName: Pack extension
inputs:
command: custom
custom: pack
arguments: '--no-build -c release -o $(Build.ArtifactStagingDirectory)/NugetPackages -p:BuildNumber=$(buildNumber)'
projects: |
extensions/${{ parameters.ExtensionProjectName }}/**/*.csproj
- task: EsrpCodeSigning@2
displayName: Sign nuget packages
inputs:
ConnectedServiceName: ESRP Service-internal
FolderPath: $(Build.ArtifactStagingDirectory)/NugetPackages
Pattern: Microsoft.Azure.Functions.Worker.Extensions*.nupkg
signConfigType: inlineSignParams
inlineOperation: |
[
{
"KeyCode": "CP-401405",
"OperationCode": "NuGetSign",
"Parameters": {},
"ToolName": "sign",
"ToolVersion": "1.0"
},
{
"KeyCode": "CP-401405",
"OperationCode": "NuGetVerify",
"Parameters": {},
"ToolName": "sign",
"ToolVersion": "1.0"
}
]
- task: DeleteFiles@1
displayName: Delete CodeSignSummary files
inputs:
sourceFolder: $(Build.ArtifactStagingDirectory)/NugetPackages
contents: '**/CodeSignSummary-*.md'

Просмотреть файл

@ -8,6 +8,7 @@ trigger:
include:
- eng/
- extensions/Worker.Extensions.Http.AspNetCore/
- extensions/Worker.Extensions.Http.AspNetCore.Analyzers/
- test/extensions/Worker.Extensions.Http.AspNetCore.Tests/
# CI only, does not trigger on PRs.
@ -46,11 +47,9 @@ extends:
jobs:
- template: /eng/ci/templates/official/jobs/build-extension-artifacts.yml@self
parameters:
ExtensionProjectName: $(ExtensionProjectName)
- template: /eng/ci/templates/official/jobs/build-extension-artifacts.yml@self
parameters:
ExtensionProjectName: '$(ExtensionProjectName).Analyzers'
Projects:
- $(ExtensionProjectName)
- $(ExtensionProjectName).Analyzers
- template: /eng/ci/templates/jobs/run-extension-tests.yml@self
parameters:

Просмотреть файл

@ -11,6 +11,7 @@ trigger:
include:
- eng/
- extensions/Worker.Extensions.Http.AspNetCore/
- extensions/Worker.Extensions.Http.AspNetCore.Analyzers/
- test/extensions/Worker.Extensions.Http.AspNetCore.Tests/
pr:
@ -22,6 +23,7 @@ pr:
include:
- eng/
- extensions/Worker.Extensions.Http.AspNetCore/
- extensions/Worker.Extensions.Http.AspNetCore.Analyzers/
- test/extensions/Worker.Extensions.Http.AspNetCore.Tests/
resources: