You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by mi...@apache.org on 2024/09/20 04:23:16 UTC
(incubator-devlake) 39/39: fix: jenkins can not get scope config (#8080)
This is an automated email from the ASF dual-hosted git repository.
mintsweet pushed a commit to branch feat-dora-config
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
commit 1111403946f06df33c086b99ff10ef4a788a30f7
Author: abeizn <zi...@merico.dev>
AuthorDate: Fri Sep 20 11:34:44 2024 +0800
fix: jenkins can not get scope config (#8080)
* fix: jenkins can not get scope config
* fix: jenkins can not get scope config
---
backend/plugins/jenkins/impl/impl.go | 24 ++++++++++--------------
1 file changed, 10 insertions(+), 14 deletions(-)
diff --git a/backend/plugins/jenkins/impl/impl.go b/backend/plugins/jenkins/impl/impl.go
index be9589152..2a686037f 100644
--- a/backend/plugins/jenkins/impl/impl.go
+++ b/backend/plugins/jenkins/impl/impl.go
@@ -118,9 +118,6 @@ func (p Jenkins) PrepareTaskData(taskCtx plugin.TaskContext, options map[string]
nil,
p.Name(),
)
- if err != nil {
- return nil, err
- }
err = connectionHelper.FirstById(connection, op.ConnectionId)
if err != nil {
return nil, err
@@ -295,19 +292,18 @@ func EnrichOptions(taskCtx plugin.TaskContext,
op.JobPath = fmt.Sprintf("%s/", op.JobPath)
}
// We only set op.JenkinsScopeConfig when it's nil and we have op.ScopeConfigId != 0
- if op.ScopeConfig.DeploymentPattern != nil && op.ScopeConfig.ProductionPattern != nil {
- if *op.ScopeConfig.DeploymentPattern == "" && *op.ScopeConfig.ProductionPattern == "" && op.ScopeConfigId != 0 {
- var scopeConfig models.JenkinsScopeConfig
- err = taskCtx.GetDal().First(&scopeConfig, dal.Where("id = ?", op.ScopeConfigId))
- if err != nil {
- return errors.BadInput.Wrap(err, "fail to get scopeConfig")
- }
- op.ScopeConfig = &scopeConfig
+ if (op.ScopeConfig.DeploymentPattern == nil && op.ScopeConfig.ProductionPattern == nil || *op.ScopeConfig.DeploymentPattern == "" && *op.ScopeConfig.ProductionPattern == "") && op.ScopeConfigId != 0 {
+ var scopeConfig models.JenkinsScopeConfig
+ err = taskCtx.GetDal().First(&scopeConfig, dal.Where("id = ?", op.ScopeConfigId))
+ if err != nil {
+ return errors.BadInput.Wrap(err, "fail to get scopeConfig")
}
+ op.ScopeConfig = &scopeConfig
+ }
- if *op.ScopeConfig.DeploymentPattern == "" && *op.ScopeConfig.ProductionPattern == "" && op.ScopeConfigId == 0 {
- op.ScopeConfig = new(models.JenkinsScopeConfig)
- }
+ if (op.ScopeConfig.DeploymentPattern == nil && op.ScopeConfig.ProductionPattern == nil || *op.ScopeConfig.DeploymentPattern == "" && *op.ScopeConfig.ProductionPattern == "") && op.ScopeConfigId == 0 {
+ op.ScopeConfig = new(models.JenkinsScopeConfig)
}
+
return nil
}