这是构建 azure通用工件
的程序包描述的方式 // Universal package Description: <SHA1> <BUILD_URL> <GIT_BRANCH>
// Limit: 256 characters
def shaID = env.GIT_COMMIT.substring(0,7)
def description = "SHA1: ${shaID} BUILD_URL: ${env.BUILD_URL} GIT_BRANCH: ${env.GIT_BRANCH}"
if( description.length() > 256 ) {
description = description.substring(0,255)
}
Azure cli 进行发布:
az工件普遍发布--project“ XXX” --scope项目--feed“ ProjectArtifacts” --name“ package_name”-版本“ 0.0.1” --path。 --description“ SHA1:12345678 BUILD_URL:
GIT_BRANCH:dummy_branch”
天蓝色中的描述如下:
SHA1:12345678 BUILD_URL:
................> GIT_BRANCH:dummy_branch
将可以添加换行符以使描述更易读。
SHA1:12345678
BUILD_URL:URL
GIT_BRANCH:dummy_branch
答案 0 :(得分:0)
恐怕无法通过将描述传递给az构件命令行的--description
属性来完成。如果我将断路器\n
放入描述字符串中,它将自动更改为\\n
但是,在azure devops管道中有解决此问题的方法。见下文:
首先我create a azure pipeline,然后我将Powershell任务添加到set the description as a variable。请参阅Powershell任务中的以下脚本:
- powershell: |
#use ";" as delimiter
$des= "SHA1: 12345678 ;BUILD_URL: <url.........................> ;GIT_BRANCH: dummy_branch"
#replace delimiter ";" with "%0D%0A" which will be parsed as "\n"
$newdes= $des -replace ';', "%0D%0A"
#set the descrption to environment varialbe Description.
Write-Host "##vso[task.setvariable variable=Description]$newdes"
然后,我使用UniversalPackages任务发布到Azure devops feed。
- task: UniversalPackages@0
displayName: Universal Publish
inputs:
command: publish
publishDirectory: '$(Build.ArtifactStagingDirectory)'
vstsFeedPublish: '<projectName>/<feedName>'
vstsFeedPackagePublish: '<Package name>'
versionOption: custom
versionPublish: '<Package version>'
# refer to the description set in above powershell task by setting packagePublishDescription as $(Description)
packagePublishDescription: '$(Description)'
请参见下面由上述管道发布的描述的屏幕截图。
关于此问题,您也可以ubmit a user voice联系微软开发团队。