Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions backend/plugins/azuredevops_go/models/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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"
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)"`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ func All() []plugin.MigrationScript {
new(extendRepoTable),
new(addEndpointToAzuredevops),
new(addUsernameToAzuredevops),
new(addRunNameToAzuredevopsBuild),
}
}
4 changes: 2 additions & 2 deletions backend/plugins/azuredevops_go/tasks/ci_cd_build_converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions config-ui/src/plugins/register/azure/transformation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ const renderCollapseItems = ({
</p>
<div>Convert a Azure Pipeline Run as a DevLake Deployment when: </div>
<div style={{ margin: '8px 0', paddingLeft: 28 }}>
<span>
The name of the <strong>Azure pipeline</strong> or <strong>one of its jobs</strong> matches
<span>
The <strong>pipeline name</strong>, <strong>run name</strong>, or <strong>one of its jobs</strong> matches
</span>
<Input
style={{ width: 200, margin: '0 8px' }}
Expand All @@ -104,7 +104,7 @@ const renderCollapseItems = ({
<HelpTooltip content="Azure Pipelines: https://learn.microsoft.com/en-us/azure/devops/pipelines/get-started/what-is-azure-pipelines?view=azure-devops#continuous-testing" />
</div>
<div style={{ margin: '8px 0', paddingLeft: 28 }}>
<span>If the name also matches</span>
<span>If the pipeline name, run name, or job name also matches</span>
<Input
style={{ width: 200, margin: '0 8px' }}
placeholder="prod(.*)"
Expand Down