From 54bee956c3bacf4b93524afff664cc83f0e18067 Mon Sep 17 00:00:00 2001 From: Veet Moradiya Date: Wed, 16 Sep 2026 16:24:14 +0000 Subject: [PATCH] fix(azuredevops_go) - consider runname for pipeline regex match --- .../plugins/azuredevops_go/models/build.go | 1 + ...60916_add_run_name_to_azuredevops_build.go | 46 +++++++++++++++++++ .../models/migrationscripts/archived/build.go | 1 + .../models/migrationscripts/register.go | 1 + .../tasks/ci_cd_build_converter.go | 4 +- .../tasks/ci_cd_build_extractor.go | 1 + .../plugins/register/azure/transformation.tsx | 6 +-- 7 files changed, 55 insertions(+), 5 deletions(-) create mode 100644 backend/plugins/azuredevops_go/models/migrationscripts/20260916_add_run_name_to_azuredevops_build.go diff --git a/backend/plugins/azuredevops_go/models/build.go b/backend/plugins/azuredevops_go/models/build.go index ba395b9504d..8b10e4d8eb6 100644 --- a/backend/plugins/azuredevops_go/models/build.go +++ b/backend/plugins/azuredevops_go/models/build.go @@ -31,6 +31,7 @@ type AzuredevopsBuild struct { Status string Result string Name string + RunName string SourceBranch string SourceVersion string // Tags is a string version of the APIs tags array that helps to identify diff --git a/backend/plugins/azuredevops_go/models/migrationscripts/20260916_add_run_name_to_azuredevops_build.go b/backend/plugins/azuredevops_go/models/migrationscripts/20260916_add_run_name_to_azuredevops_build.go new file mode 100644 index 00000000000..640d4f671c9 --- /dev/null +++ b/backend/plugins/azuredevops_go/models/migrationscripts/20260916_add_run_name_to_azuredevops_build.go @@ -0,0 +1,46 @@ +/* +Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to You under the Apache License, Version 2.0 +(the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package migrationscripts + +import ( + "github.com/apache/devlake/core/context" + "github.com/apache/devlake/core/errors" + "github.com/apache/devlake/helpers/migrationhelper" +) + +type addRunNameToAzuredevopsBuild struct{} + +type azuredevopsBuild20260916 struct { + RunName string `gorm:"type:varchar(255)"` +} + +func (azuredevopsBuild20260916) TableName() string { + return "_tool_azuredevops_go_builds" +} + +func (script *addRunNameToAzuredevopsBuild) Up(basicRes context.BasicRes) errors.Error { + return migrationhelper.AutoMigrateTables(basicRes, &azuredevopsBuild20260916{}) +} + +func (*addRunNameToAzuredevopsBuild) Version() uint64 { + return 20260916000001 +} + +func (*addRunNameToAzuredevopsBuild) Name() string { + return "add run name field to _tool_azuredevops_go_builds" +} \ No newline at end of file diff --git a/backend/plugins/azuredevops_go/models/migrationscripts/archived/build.go b/backend/plugins/azuredevops_go/models/migrationscripts/archived/build.go index e8ff36d4220..215f784886d 100644 --- a/backend/plugins/azuredevops_go/models/migrationscripts/archived/build.go +++ b/backend/plugins/azuredevops_go/models/migrationscripts/archived/build.go @@ -29,6 +29,7 @@ type AzuredevopsBuild struct { AzuredevopsId int `gorm:"primaryKey"` RepositoryId string `gorm:"type:varchar(255)"` Name string `gorm:"type:varchar(100)"` + RunName string `gorm:"type:varchar(255)"` Status string `gorm:"type:varchar(255)"` Result string `gorm:"type:varchar(255)"` SourceBranch string `gorm:"type:varchar(255)"` diff --git a/backend/plugins/azuredevops_go/models/migrationscripts/register.go b/backend/plugins/azuredevops_go/models/migrationscripts/register.go index a7f7b24cbf9..e71885f3583 100644 --- a/backend/plugins/azuredevops_go/models/migrationscripts/register.go +++ b/backend/plugins/azuredevops_go/models/migrationscripts/register.go @@ -28,5 +28,6 @@ func All() []plugin.MigrationScript { new(extendRepoTable), new(addEndpointToAzuredevops), new(addUsernameToAzuredevops), + new(addRunNameToAzuredevopsBuild), } } diff --git a/backend/plugins/azuredevops_go/tasks/ci_cd_build_converter.go b/backend/plugins/azuredevops_go/tasks/ci_cd_build_converter.go index 944b4ddb2bf..14003c719e3 100644 --- a/backend/plugins/azuredevops_go/tasks/ci_cd_build_converter.go +++ b/backend/plugins/azuredevops_go/tasks/ci_cd_build_converter.go @@ -93,8 +93,8 @@ func ConvertBuilds(taskCtx plugin.SubTaskContext) errors.Error { OriginalStatus: build.Status, OriginalResult: build.Result, CicdScopeId: repoIdGen.Generate(data.Options.ConnectionId, build.RepositoryId), - Environment: data.RegexEnricher.ReturnNameIfMatched(devops.PRODUCTION, build.Name+";"+build.Tags), - Type: data.RegexEnricher.ReturnNameIfMatched(devops.DEPLOYMENT, build.Name+";"+build.Tags), + Environment: data.RegexEnricher.ReturnNameIfMatched(devops.PRODUCTION, build.Name+";"+build.RunName+";"+build.Tags), + Type: data.RegexEnricher.ReturnNameIfMatched(devops.DEPLOYMENT, build.Name+";"+build.RunName+";"+build.Tags), DurationSec: duration, TaskDatesInfo: devops.TaskDatesInfo{ CreatedDate: *build.QueueTime, diff --git a/backend/plugins/azuredevops_go/tasks/ci_cd_build_extractor.go b/backend/plugins/azuredevops_go/tasks/ci_cd_build_extractor.go index 9d7b8be00a5..e74aec4938a 100644 --- a/backend/plugins/azuredevops_go/tasks/ci_cd_build_extractor.go +++ b/backend/plugins/azuredevops_go/tasks/ci_cd_build_extractor.go @@ -70,6 +70,7 @@ func ExtractApiBuilds(taskCtx plugin.SubTaskContext) errors.Error { Status: buildApi.Status, Result: buildApi.Result, Name: buildApi.Definition.Name, + RunName: buildApi.BuildNumber, SourceBranch: buildApi.SourceBranch, SourceVersion: buildApi.SourceVersion, QueueTime: buildApi.QueueTime, diff --git a/config-ui/src/plugins/register/azure/transformation.tsx b/config-ui/src/plugins/register/azure/transformation.tsx index 1a8ea080740..637c2d50156 100644 --- a/config-ui/src/plugins/register/azure/transformation.tsx +++ b/config-ui/src/plugins/register/azure/transformation.tsx @@ -85,8 +85,8 @@ const renderCollapseItems = ({

Convert a Azure Pipeline Run as a DevLake Deployment when:
- - The name of the Azure pipeline or one of its jobs matches + + The pipeline name, run name, or one of its jobs matches
- If the name also matches + If the pipeline name, run name, or job name also matches