未验证 提交 c0a0d8af 编写于 作者: LinuxSuRen's avatar LinuxSuRen 提交者: GitHub

Merge pull request #322 from LinuxSuRen/fix/start-no-lts

Fix cannot start a non-lts jenkins server
......@@ -2,6 +2,7 @@ package cmd
import (
"fmt"
"go.uber.org/zap"
"net/http"
"os"
"path/filepath"
......@@ -73,6 +74,9 @@ func (c *CenterDownloadOption) DownloadJenkins() (err error) {
ShowProgress: c.ShowProgress,
}
jenkinsWarURL := jClient.GetJenkinsWarURL()
logger.Info("prepare to download jenkins.war", zap.String("URL", jenkinsWarURL))
err = jClient.DownloadJenkins()
return
}
......@@ -2,6 +2,7 @@ package cmd
import (
"fmt"
"go.uber.org/zap"
"os"
"github.com/jenkins-zh/jenkins-cli/app/i18n"
......@@ -35,6 +36,7 @@ type CenterStartOption struct {
Download bool
Version string
LTS bool
DryRun bool
}
......@@ -60,6 +62,8 @@ func init() {
i18n.T("If you want to download jenkins.war when it does not exist"))
centerStartCmd.Flags().StringVarP(&centerStartOption.Version, "version", "", "2.190.3",
i18n.T("The of version of jenkins.war"))
centerStartCmd.Flags().BoolVarP(&centerStartOption.LTS, "lts", "", true,
i18n.T("If you want to download Jenkins as LTS"))
centerStartCmd.Flags().BoolVarP(&centerStartOption.HTTPSEnable, "https-enable", "", false,
i18n.T("If you want to enable https"))
......@@ -89,11 +93,13 @@ var centerStartCmd = &cobra.Command{
jenkinsWar := fmt.Sprintf("%s/.jenkins-cli/cache/%s/jenkins.war", userHome, centerStartOption.Version)
logger.Info("prepare to download jenkins.war", zap.String("localPath", jenkinsWar))
if !centerStartOption.DryRun {
if _, fileErr := os.Stat(jenkinsWar); fileErr != nil {
download := &CenterDownloadOption{
Mirror: "default",
LTS: true,
LTS: centerStartOption.LTS,
Output: jenkinsWar,
ShowProgress: true,
Version: centerStartOption.Version,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册