在Azure Devops发布管道中,如何获取与该发布关联的内部版本的名称?

时间:2020-08-21 10:12:52

标签: azure-devops azure-pipelines azure-pipelines-release-task

我在Azure Devops中有一个发布管道。在发布管道中,我有一个bash脚本-step,它引用变量 $(Release.Artifacts.MyCustomAlias.BuildNumber)。在脚本中,我回显了变量的值。

现在,我创建了一个新版本,并选择了构建 20200820.22 作为工件。

enter image description here

检查脚本的输出时,它使用的是值 20200821.2 ,它是最新版本,而不是我选择的版本。

如何从发行脚本访问正确的构建版本?

enter image description here

1 个答案:

答案 0 :(得分:1)

我试图重蹈覆辙。

enter image description here

对于此脚本:

import { Component, OnInit, Input } from "@angular/core";

@Component({
  selector: "app-app-control-message",
  templateUrl: "./app-control-message.component.html",
  styleUrls: ["./app-control-message.component.css"]
})
export class AppControlMessageComponent implements OnInit {
  @Input() control; // Input whose value parent component will provide

  constructor() {}

  ngOnInit() {}
}

我得到正确的结果:

enter image description here

由于最新的版本是Write-Host $(Build.BuildNumber) Write-Host $(Release.Artifacts.CustomName.BuildNumber) ,因此它将选择正确的编号。请尝试适用于主要工件的20200821.1

enter image description here

相关问题