Fix the inapproprite errors handle with cron expression checking

Signed-off-by: rick <rick@jenkins-zh.cn>
This commit is contained in:
rick
2020-12-01 10:07:57 +08:00
parent c5de21af4a
commit 039dbf8033
2 changed files with 48 additions and 21 deletions

View File

@@ -25,6 +25,7 @@ import (
"kubesphere.io/kubesphere/pkg/simple/client/devops"
"log"
"net/http"
"net/url"
"os"
"reflect"
"strconv"
@@ -841,10 +842,14 @@ func (j *Jenkins) CheckCron(projectName string, httpParameters *devops.HttpParam
return nil, err
}
query := url.Values{
"value": []string{cron.Cron},
}
if cron.PipelineName != "" {
path = fmt.Sprintf(CheckPipelienCronUrl, projectName, cron.PipelineName, cron.Cron)
path = fmt.Sprintf(CheckPipelienCronUrl, projectName, cron.PipelineName, query.Encode())
} else {
path = fmt.Sprintf(CheckCronUrl, projectName, cron.Cron)
path = fmt.Sprintf(CheckCronUrl, projectName, query.Encode())
}
PipelineOjb := &Pipeline{