为什么在我的发布管道中自动创建发布注释?
Why are release annotations automatically created in my release pipelines?
我注意到在执行发布管道时,现在为几个 Application Insights 实例添加了 release annotations。我们没有做文章中提到的任何事情。这些注释来自哪里?
它似乎只发生在我们的应用程序发布管道上,而不是基础设施上。我们的大多数应用程序 运行 都在 App Service 上,但并非所有应用程序都有发布注释。
Azure App Service Deploy Task 自动创建发布注释。
唯一的先决条件是应用服务在其 AppSettings 中具有有效的 APPINSIGHTS_INSTRUMENTATIONKEY
。
这是相关的代码块:
export async function addReleaseAnnotation(endpoint: AzureEndpoint, azureAppService: AzureAppService, isDeploymentSuccess: boolean): Promise<void> {
try {
var appSettings = await azureAppService.getApplicationSettings();
var instrumentationKey = appSettings && appSettings.properties && appSettings.properties.APPINSIGHTS_INSTRUMENTATIONKEY;
if(instrumentationKey) {
let appinsightsResources: ApplicationInsightsResources = new ApplicationInsightsResources(endpoint);
var appInsightsResources = await appinsightsResources.list(null, [`$filter=InstrumentationKey eq '${instrumentationKey}'`]);
if(appInsightsResources.length > 0) {
var appInsights: AzureApplicationInsights = new AzureApplicationInsights(endpoint, appInsightsResources[0].id.split('/')[4], appInsightsResources[0].name);
var releaseAnnotationData = getReleaseAnnotation(isDeploymentSuccess);
await appInsights.addReleaseAnnotation(releaseAnnotationData);
console.log(tl.loc("SuccessfullyAddedReleaseAnnotation", appInsightsResources[0].name));
}
我注意到在执行发布管道时,现在为几个 Application Insights 实例添加了 release annotations。我们没有做文章中提到的任何事情。这些注释来自哪里?
它似乎只发生在我们的应用程序发布管道上,而不是基础设施上。我们的大多数应用程序 运行 都在 App Service 上,但并非所有应用程序都有发布注释。
Azure App Service Deploy Task 自动创建发布注释。
唯一的先决条件是应用服务在其 AppSettings 中具有有效的 APPINSIGHTS_INSTRUMENTATIONKEY
。
这是相关的代码块:
export async function addReleaseAnnotation(endpoint: AzureEndpoint, azureAppService: AzureAppService, isDeploymentSuccess: boolean): Promise<void> {
try {
var appSettings = await azureAppService.getApplicationSettings();
var instrumentationKey = appSettings && appSettings.properties && appSettings.properties.APPINSIGHTS_INSTRUMENTATIONKEY;
if(instrumentationKey) {
let appinsightsResources: ApplicationInsightsResources = new ApplicationInsightsResources(endpoint);
var appInsightsResources = await appinsightsResources.list(null, [`$filter=InstrumentationKey eq '${instrumentationKey}'`]);
if(appInsightsResources.length > 0) {
var appInsights: AzureApplicationInsights = new AzureApplicationInsights(endpoint, appInsightsResources[0].id.split('/')[4], appInsightsResources[0].name);
var releaseAnnotationData = getReleaseAnnotation(isDeploymentSuccess);
await appInsights.addReleaseAnnotation(releaseAnnotationData);
console.log(tl.loc("SuccessfullyAddedReleaseAnnotation", appInsightsResources[0].name));
}