我必须创建自定义VSTS(Azure DevOps)扩展。我需要在自定义选项卡中令人失望地从构建工件或构建变量中获取一些附加信息。我发现了一些示例,该示例如何使用Controls.BaseControl创建自定义标签,但使用var sharedConfig:
TFS_Build_Extension_Contracts.IBuildResultsViewExtensionConfig = VSS.getConfiguration();
sharedConfig.onBuildChanged((build: TFS_Build_Contracts.Build) => {
//How fetchartifacts from build
});
不包含有关工件和排队变量的信息。 所以我的问题是,如何在扩展Controls.BaseControl的类中获取该信息?也许是实现这一目标的另一种方法。
import Controls = require("VSS/Controls");
import VSS_Service = require("VSS/Service");
import TFS_Build_Contracts = require("TFS/Build/Contracts");
import TFS_Build_Extension_Contracts = require("TFS/Build/ExtensionContracts");
export class StatusSection extends Controls.BaseControl {
constructor() {
super();
}
public initialize(): void {
super.initialize();
// Get configuration that's shared between extension and the extension host
var sharedConfig: TFS_Build_Extension_Contracts.IBuildResultsViewExtensionConfig = VSS.getConfiguration();
if(sharedConfig) {
// register your extension with host through callback
sharedConfig.onBuildChanged((build: TFS_Build_Contracts.Build) => {
var buildId = build.id;
//needs variables or artifacts here
});
}
}
...