This is an automated email from the ASF dual-hosted git repository.
abeizn pushed a commit to branch feat-dora-config
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/feat-dora-config by this push:
new b4ba77d3c fix: jenkins can not get scope config (#8080)
b4ba77d3c is described below
commit b4ba77d3cb017eadbf776df8ef496f3c6c60c0db
Author: abeizn <[email protected]>
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
}