当前位置: 首页 > news >正文

一段有意思的代码

parameters:

  • name: build_configuration
    displayName: Build configuration
    type: string
    default: Release
    values:
    • Release
    • Debug
  • name: include_suffix
    displayName: Append version suffix
    type: boolean
    default: true
  • name: version_suffix
    displayName: Version suffix
    type: string
    default: ci.$(Build.BuildNumber)
  • name: codesign
    displayName: Enable code signing
    type: boolean
    default: false
  • name: skip_test
    displayName: Skip tests
    type: boolean
    default: false
  • name: publish_nightly
    displayName: Publish to autogen-nightly
    type: boolean
    default: false
  • name: publish_nuget
    displayName: Publish to nuget.org
    type: boolean
    default: false
  • name: publish_artifacts
    displayName: Publish artifacts
    type: boolean
    default: false
  • name: runCodeQL3000
    default: false
    displayName: Run CodeQL3000 tasks
    type: boolean

jobs:

Build, sign dlls, build nuget pkgs, then sign them

  • job: Build
    displayName: Build and create NuGet packages
    variables:
    publishVstsFeed: 'AGPublic/AutoGen-Nightly'
    ${{ if eq(parameters.codesign, true) }}:
    esrp_signing: true
    ${{ else }}:
    esrp_signing: false
    ${{ if ne(variables['System.TeamProject'], 'GitHub - PR Builds') }}:
    templateContext:
    outputs:
    # Publish artifacts if enabled
    - ${{ if eq(parameters.publish_artifacts, true) }}: # TODO add eq(parameters.codesign, true)
    - output: pipelineArtifact
    targetPath: '$(build.sourcesdirectory)/dotnet/artifacts'
    artifactName: artifacts folder
    # Publish packages to nightly
    - ${{ if eq(parameters.publish_nightly, true) }}: # TODO add eq(parameters.codesign, true)
    - output: nuget
    useDotNetTask: false
    packageParentPath: $(Pipeline.Workspace)
    packagesToPush: $(build.sourcesdirectory)/dotnet/artifacts//*.nupkg;$(build.sourcesdirectory)/dotnet/artifacts//.snupkg
    nuGetFeedType: internal
    publishVstsFeed: $(publishVstsFeed)
    allowPackageConflicts: true
    - ${{ if and(eq(parameters.codesign, true), eq(parameters.publish_nuget, true)) }}:
    - output: nuget
    condition: succeeded()
    useDotNetTask: false
    packageParentPath: $(Pipeline.Workspace)
    packagesToPush: $(build.sourcesdirectory)/dotnet/artifacts/**/
    .nupkg;$(build.sourcesdirectory)/dotnet/artifacts/**/*.snupkg
    nuGetFeedType: external
    publishFeedCredentials: dotnet-orleans-nuget
    publishPackageMetadata: true
    allowPackageConflicts: true
    steps:
    • checkout: self
      lfs: true

    • task: UseDotNet@2
      displayName: 'Use .NET Core sdk'
      inputs:
      useGlobalJson: true
      workingDirectory: $(Build.SourcesDirectory)/dotnet

    • task: PowerShell@2
      displayName: 'Install uv'
      inputs:
      targetType: 'inline'
      script: |
      irm https://astral.sh/uv/install.ps1 | iex
      $env:Path = "C:\Users\cloudtest.local\bin;$env:Path"
      uv --version

    • task: Bash@3
      displayName: Install .NET Aspire workload
      inputs:
      targetType: 'inline'
      script: |
      dotnet nuget locals all --clear
      dotnet workload install aspire

    • ${{ if eq(variables.runCodeQL3000, 'true') }}:

      • task: CodeQL3000Init@0
        displayName: CodeQL Initialize

      This task only tags a build if it actually does CodeQL3000 work.

      Those tasks no-op while the analysis is considered up to date i.e. for runs w/in a few days of each other.

      • script: "echo ##vso[build.addbuildtag]CodeQL3000"
        displayName: 'Set CI CodeQL3000 tag'
        condition: ne(variables.CODEQL_DIST,'')
    • task: DotNetCoreCLI@2
      displayName: Build
      inputs:
      command: build
      arguments: '$(build_flags) /bl:${{parameters.build_configuration}}-Build.binlog /p:Configuration=${{parameters.build_configuration}} /p:ContinuousIntegrationBuild=true $(solution)'
      workingDirectory: $(Build.SourcesDirectory)/dotnet
      env:
      PATH: "C:\Users\cloudtest\.local\bin;$(PATH)"
      ${{ if and(eq(parameters.include_suffix, true), eq(parameters.publish_nuget, false)) }}:
      VersionSuffix: ${{parameters.version_suffix}}
      OfficialBuild: $(official_build)

    • ${{ if eq(variables.runCodeQL3000, 'true') }}:

      • task: CodeQL3000Finalize@0
        displayName: CodeQL Finalize

    DLL code signing

    • ${{ if eq(variables.esrp_signing, true) }}:
      • task: UseDotNet@2
        displayName: 'Codesign: Use .NET Core'
        inputs:
        packageType: runtime
        version: $(codesign_runtime)
      • task: CopyFiles@2
        displayName: 'Codesign: Copy Files for signing'
        inputs:
        SourceFolder: '$(build.sourcesdirectory)'
        Contents: |
        /bin//AutoGen.dll
        /bin//Microsoft.AutoGen.
        .dll
        TargetFolder: '$(build.artifactstagingdirectory)\codesign'
        CleanTargetFolder: true
      • task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@5
        displayName: 'Codesign: ESRP CodeSigning (dlls)'
        inputs:
        ConnectedServiceName: 'AI Frontiers ESRP'
        AppRegistrationClientId: 'c1e7a5c0-ee6b-4cec-9e11-4dc3f4670042'
        AppRegistrationTenantId: '975f013f-7f24-47e8-a7d3-abc4752bf346'
        AuthAKVName: 'aif-autogen-esrp-kv'
        AuthCertName: 'AIF-PME-InfrastructureAuth'
        AuthSignCertName: 'AutoGenPublishESRPPKI' # this variable is only needed for codesign
        FolderPath: '$(build.artifactstagingdirectory)\codesign'
        Pattern: '*.dll'
        signConfigType: inlineSignParams
        inlineOperation: |
        [
        {
        "keyCode": "CP-230012",
        "operationSetCode": "SigntoolSign",
        "parameters": [
        {
        "parameterName": "OpusName",
        "parameterValue": "Microsoft"
        },
        {
        "parameterName": "OpusInfo",
        "parameterValue": "http://www.microsoft.com"
        },
        {
        "parameterName": "FileDigest",
        "parameterValue": "/fd "SHA256""
        },
        {
        "parameterName": "PageHash",
        "parameterValue": "/NPH"
        },
        {
        "parameterName": "TimeStamp",
        "parameterValue": "/tr "http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer" /td sha256"
        }
        ],
        "toolName": "sign",
        "toolVersion": "1.0"
        },
        {
        "keyCode": "CP-230012",
        "operationSetCode": "SigntoolVerify",
        "parameters": [ ],
        "toolName": "sign",
        "toolVersion": "1.0"
        }
        ]
        SessionTimeout: 180
        VerboseLogin: true
      • task: CopyFiles@2
        displayName: 'Codesign: Copy Signed Files Back'
        inputs:
        SourceFolder: '$(build.artifactstagingdirectory)\codesign'
        Contents: '***'
        TargetFolder: '$(build.sourcesdirectory)'
        OverWrite: true

      End DLL code signing

    • task: CmdLine@2
      displayName: Pack
      inputs:
      script: 'dotnet pack --no-build --no-restore $(build_flags) /bl:${{parameters.build_configuration}}-Pack.binlog /p:Configuration=${{parameters.build_configuration}} /p:ContinuousIntegrationBuild=true $(solution)'
      workingDirectory: $(Build.SourcesDirectory)/dotnet
      env:
      ${{ if and(eq(parameters.include_suffix, true), eq(parameters.publish_nuget, false)) }}:
      VersionSuffix: ${{parameters.version_suffix}}
      OfficialBuild: $(official_build)

    NuGet code signing

    • ${{ if eq(variables.esrp_signing, true) }}:
      • task: UseDotNet@2
        displayName: 'Codesign: Use .NET Core'
        inputs:
        packageType: runtime
        version: $(codesign_runtime)
      • task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@5
        displayName: 'Codesign: ESRP CodeSigning (nuget)'
        inputs:
        ConnectedServiceName: 'AI Frontiers ESRP'
        AppRegistrationClientId: 'c1e7a5c0-ee6b-4cec-9e11-4dc3f4670042'
        AppRegistrationTenantId: '975f013f-7f24-47e8-a7d3-abc4752bf346'
        AuthAKVName: 'aif-autogen-esrp-kv'
        AuthCertName: 'AIF-PME-InfrastructureAuth'
        AuthSignCertName: 'AutoGenPublishESRPPKI' # this variable is only needed for codesign
        FolderPath: '$(build.sourcesdirectory)/dotnet/artifacts/package/${{parameters.build_configuration}}'
        Pattern: '*.nupkg'
        signConfigType: inlineSignParams
        inlineOperation: |
        [
        {
        "keyCode": "CP-401405",
        "operationSetCode": "NuGetSign",
        "parameters": [],
        "toolName": "sign",
        "toolVersion": "1.0"
        },
        {
        "keyCode": "CP-401405",
        "operationSetCode": "NuGetVerify",
        "parameters": [ ],
        "toolName": "sign",
        "toolVersion": "1.0"
        }
        ]
        SessionTimeout: 180
        VerboseLogin: true
http://www.jsqmd.com/news/58317/

相关文章:

  • EasyGBS新版本(v3.7.168)发布!视频能力再度升级!
  • 深入解析Oracle 10046事件与数据库初始化引导机制
  • 2025年浙江省颗粒物废气处理公司推荐:废气处理生产厂家TO
  • 哈尔滨影视后期培训学校权威推荐:资质齐全+信誉优选,助你零基
  • 客服开户python
  • AI赋能测试开发,周末高薪私教班助你职场进阶!
  • 预生产测试环境时间的评估
  • Docker Compose 主要功能 - jerry
  • 2025年双车道双翻集装箱翻转机厂家权威推荐榜单:单车道双翻集装箱翻转机‌/20尺集装箱翻转机‌/20吨集装箱翻转机‌源头厂家精选
  • 2025年靠谱变频器厂家推荐:5 家实力品牌,覆盖工业+商用多场景
  • n8n测试进阶:Function节点自定义断言与复杂数据验证指南
  • 我的python日记
  • 南京混合机供应商综合实力排行榜,烘箱/高温电热鼓风干燥箱/实验室臭氧发生器/大型烘房/三维混合机/混合机混合机产品推荐排行
  • 线上内存泄漏问题,如何快速定位与修复?
  • etcd集群常用操作
  • CSS 文本和字体属性、列表属性 - 详解
  • 贪睡星人狂喜!2025免冲泡即食代餐品牌推荐,多睡10分钟
  • 2025年Q4水质在线监测分析仪厂家推荐,多参数COD/总氮/蓝绿藻 ,IP68防护+快速响应测评榜
  • 2025年制氮机维修定制厂家权威推荐榜单:制氮机设备‌/工业制氮机‌/高压制氮机‌源头厂家精选
  • 2025年五大可靠企业邮箱服务排行榜,企业商用邮箱推荐
  • MySQL UPDATE多表关联更新
  • Avalonia 最大化适配不同DPI
  • 推荐几家海外社媒运营推广公司(12月更新),五家优质B2B海外社媒营销公司详细介绍
  • 2025年电子试验机厂家权威推荐榜单:导热系数仪生产厂家‌/电子试验机生产厂家‌/导热系数仪厂家‌源头厂家精选
  • 订阅号看一看推送 关闭
  • QTemporaryFile
  • springAI集成智谱,输入文字图片(多模态)
  • 完整教程:蓝牙钥匙 第40次 汽车租赁与试驾场景中的智能权限管理:关键技术与实践方案
  • 2025年四川成都电线电缆厂家行业优选指南:专注国标品质,电力电缆、高压电缆、中压电缆、低压电缆、铜芯电缆、铝芯电缆、铝合金电缆、成都鑫佰亿线缆成信赖之选
  • 2025年南昌学生校服夏装源头厂家推荐榜单:南昌小学校服春秋装/南昌校服/南昌新校服专业制造商精选