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