You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by wa...@apache.org on 2022/09/19 11:47:46 UTC
[incubator-devlake] 02/04: feat: add deployTagPattern for jenkins
This is an automated email from the ASF dual-hosted git repository.
warren pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
commit 76290e45e230d0854b8a48199952230bd1f62bfa
Author: abeizn <zi...@merico.dev>
AuthorDate: Mon Sep 19 16:56:18 2022 +0800
feat: add deployTagPattern for jenkins
---
plugins/jenkins/models/build.go | 1 -
plugins/jenkins/tasks/build_extractor.go | 16 +---------------
2 files changed, 1 insertion(+), 16 deletions(-)
diff --git a/plugins/jenkins/models/build.go b/plugins/jenkins/models/build.go
index 8e3a4fad..f17bf05c 100644
--- a/plugins/jenkins/models/build.go
+++ b/plugins/jenkins/models/build.go
@@ -36,7 +36,6 @@ type JenkinsBuild struct {
Result string // Result
Timestamp int64 // start time
StartTime time.Time // convered by timestamp
- CommitSha string `gorm:"type:varchar(255)"`
Type string `gorm:"index;type:varchar(255)"`
Class string `gorm:"index;type:varchar(255)" `
TriggeredBy string `gorm:"type:varchar(255)"`
diff --git a/plugins/jenkins/tasks/build_extractor.go b/plugins/jenkins/tasks/build_extractor.go
index e0968138..7061d864 100644
--- a/plugins/jenkins/tasks/build_extractor.go
+++ b/plugins/jenkins/tasks/build_extractor.go
@@ -20,11 +20,10 @@ package tasks
import (
"encoding/json"
"fmt"
- "github.com/apache/incubator-devlake/errors"
- "strconv"
"strings"
"time"
+ "github.com/apache/incubator-devlake/errors"
"github.com/apache/incubator-devlake/plugins/core"
"github.com/apache/incubator-devlake/plugins/helper"
"github.com/apache/incubator-devlake/plugins/jenkins/models"
@@ -87,15 +86,7 @@ func ExtractApiBuilds(taskCtx core.SubTaskContext) errors.Error {
vcs := body.ChangeSet.Kind
if vcs == "git" || vcs == "hg" {
for _, a := range body.Actions {
- sha := ""
branch := ""
- if a.LastBuiltRevision.SHA1 != "" {
- sha = a.LastBuiltRevision.SHA1
- }
- if a.MercurialRevisionNumber != "" {
- sha = a.MercurialRevisionNumber
- }
- build.CommitSha = sha
if len(a.LastBuiltRevision.Branches) > 0 {
branch = a.LastBuiltRevision.Branches[0].Name
}
@@ -104,7 +95,6 @@ func ExtractApiBuilds(taskCtx core.SubTaskContext) errors.Error {
buildCommitRemoteUrl := models.JenkinsBuildCommit{
ConnectionId: data.Options.ConnectionId,
BuildName: build.FullDisplayName,
- CommitSha: sha,
RepoUrl: url,
Branch: branch,
}
@@ -120,10 +110,6 @@ func ExtractApiBuilds(taskCtx core.SubTaskContext) errors.Error {
}
}
}
- } else if vcs == "svn" {
- if len(body.ChangeSet.Revisions) > 0 {
- build.CommitSha = strconv.Itoa(body.ChangeSet.Revisions[0].Revision)
- }
}
results = append(results, build)