Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
jenkinsci
sub-group
Jenkins Cli
提交
df92cfcf
J
Jenkins Cli
项目概览
jenkinsci
/
sub-group
/
Jenkins Cli
通知
0
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
Jenkins Cli
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
df92cfcf
编写于
12月 05, 2019
作者:
LinuxSuRen
提交者:
GitHub
12月 05, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #275 from LinuxSuRen/fix/center-start-env
Support give system property to jenkins.war
上级
c5134b0e
26917e0e
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
29 addition
and
3 deletion
+29
-3
app/cmd/center_start.go
app/cmd/center_start.go
+29
-3
未找到文件。
app/cmd/center_start.go
浏览文件 @
df92cfcf
...
@@ -2,12 +2,13 @@ package cmd
...
@@ -2,12 +2,13 @@ package cmd
import
(
import
(
"fmt"
"fmt"
"github.com/mitchellh/go-homedir"
"net/http"
"net/http"
"os"
"os"
"os/exec"
"os/exec"
"syscall"
"syscall"
"github.com/mitchellh/go-homedir"
"github.com/jenkins-zh/jenkins-cli/app/i18n"
"github.com/jenkins-zh/jenkins-cli/app/i18n"
"github.com/spf13/cobra"
"github.com/spf13/cobra"
...
@@ -21,6 +22,9 @@ type CenterStartOption struct {
...
@@ -21,6 +22,9 @@ type CenterStartOption struct {
Context
string
Context
string
SetupWizard
bool
SetupWizard
bool
// comes from folder plugin
ConcurrentIndexing
int
Admin
string
Admin
string
HTTPSEnable
bool
HTTPSEnable
bool
...
@@ -29,6 +33,7 @@ type CenterStartOption struct {
...
@@ -29,6 +33,7 @@ type CenterStartOption struct {
HTTPSPrivateKey
string
HTTPSPrivateKey
string
Environments
[]
string
Environments
[]
string
System
[]
string
Download
bool
Download
bool
Version
string
Version
string
...
@@ -44,8 +49,10 @@ func init() {
...
@@ -44,8 +49,10 @@ func init() {
i18n
.
T
(
"Port of Jenkins"
))
i18n
.
T
(
"Port of Jenkins"
))
centerStartCmd
.
Flags
()
.
StringVarP
(
&
centerStartOption
.
Context
,
"context"
,
""
,
"/"
,
centerStartCmd
.
Flags
()
.
StringVarP
(
&
centerStartOption
.
Context
,
"context"
,
""
,
"/"
,
i18n
.
T
(
"Web context of Jenkins server"
))
i18n
.
T
(
"Web context of Jenkins server"
))
centerStartCmd
.
Flags
()
.
StringArrayVarP
(
&
centerStartOption
.
Environments
,
""
,
""
,
nil
,
centerStartCmd
.
Flags
()
.
StringArrayVarP
(
&
centerStartOption
.
Environments
,
"
env
"
,
""
,
nil
,
i18n
.
T
(
"Environments for the Jenkins which as key-value format"
))
i18n
.
T
(
"Environments for the Jenkins which as key-value format"
))
centerStartCmd
.
Flags
()
.
StringArrayVarP
(
&
centerStartOption
.
System
,
"sys"
,
""
,
nil
,
i18n
.
T
(
"System property key-value"
))
centerStartCmd
.
Flags
()
.
BoolVarP
(
&
centerStartOption
.
SetupWizard
,
"setup-wizard"
,
""
,
true
,
centerStartCmd
.
Flags
()
.
BoolVarP
(
&
centerStartOption
.
SetupWizard
,
"setup-wizard"
,
""
,
true
,
i18n
.
T
(
"If you want to show the setup wizard at first start"
))
i18n
.
T
(
"If you want to show the setup wizard at first start"
))
centerStartCmd
.
Flags
()
.
BoolVarP
(
&
centerStartOption
.
Download
,
"download"
,
""
,
true
,
centerStartCmd
.
Flags
()
.
BoolVarP
(
&
centerStartOption
.
Download
,
"download"
,
""
,
true
,
...
@@ -62,6 +69,9 @@ func init() {
...
@@ -62,6 +69,9 @@ func init() {
centerStartCmd
.
Flags
()
.
StringVarP
(
&
centerStartOption
.
HTTPSPrivateKey
,
"https-private"
,
""
,
""
,
centerStartCmd
.
Flags
()
.
StringVarP
(
&
centerStartOption
.
HTTPSPrivateKey
,
"https-private"
,
""
,
""
,
i18n
.
T
(
"Private key file path for https"
))
i18n
.
T
(
"Private key file path for https"
))
centerStartCmd
.
Flags
()
.
IntVarP
(
&
centerStartOption
.
ConcurrentIndexing
,
"concurrent-indexing"
,
""
,
-
1
,
i18n
.
T
(
"Concurrent indexing limit, take this value only it is bigger than -1"
))
centerStartCmd
.
Flags
()
.
BoolVarP
(
&
centerStartOption
.
DryRun
,
"dry-run"
,
""
,
false
,
centerStartCmd
.
Flags
()
.
BoolVarP
(
&
centerStartOption
.
DryRun
,
"dry-run"
,
""
,
false
,
i18n
.
T
(
"Don't run jenkins.war really"
))
i18n
.
T
(
"Don't run jenkins.war really"
))
}
}
...
@@ -103,7 +113,6 @@ var centerStartCmd = &cobra.Command{
...
@@ -103,7 +113,6 @@ var centerStartCmd = &cobra.Command{
if
err
==
nil
{
if
err
==
nil
{
env
:=
os
.
Environ
()
env
:=
os
.
Environ
()
env
=
append
(
env
,
fmt
.
Sprintf
(
"JENKINS_HOME=%s/.jenkins-cli/cache/%s/web"
,
userHome
,
centerStartOption
.
Version
))
env
=
append
(
env
,
fmt
.
Sprintf
(
"JENKINS_HOME=%s/.jenkins-cli/cache/%s/web"
,
userHome
,
centerStartOption
.
Version
))
env
=
append
(
env
,
fmt
.
Sprintf
(
"jenkins.install.runSetupWizard=%v"
,
centerStartOption
.
SetupWizard
))
if
centerStartOption
.
Environments
!=
nil
{
if
centerStartOption
.
Environments
!=
nil
{
for
_
,
item
:=
range
centerStartOption
.
Environments
{
for
_
,
item
:=
range
centerStartOption
.
Environments
{
...
@@ -112,6 +121,7 @@ var centerStartCmd = &cobra.Command{
...
@@ -112,6 +121,7 @@ var centerStartCmd = &cobra.Command{
}
}
jenkinsWarArgs
:=
[]
string
{
"java"
}
jenkinsWarArgs
:=
[]
string
{
"java"
}
jenkinsWarArgs
=
centerStartOption
.
setSystemProperty
(
jenkinsWarArgs
)
jenkinsWarArgs
=
append
(
jenkinsWarArgs
,
"-jar"
,
jenkinsWar
)
jenkinsWarArgs
=
append
(
jenkinsWarArgs
,
"-jar"
,
jenkinsWar
)
jenkinsWarArgs
=
append
(
jenkinsWarArgs
,
fmt
.
Sprintf
(
"--httpPort=%d"
,
centerStartOption
.
Port
))
jenkinsWarArgs
=
append
(
jenkinsWarArgs
,
fmt
.
Sprintf
(
"--httpPort=%d"
,
centerStartOption
.
Port
))
jenkinsWarArgs
=
append
(
jenkinsWarArgs
,
"--argumentsRealm.passwd.admin=admin --argumentsRealm.roles.admin=admin"
)
jenkinsWarArgs
=
append
(
jenkinsWarArgs
,
"--argumentsRealm.passwd.admin=admin --argumentsRealm.roles.admin=admin"
)
...
@@ -130,3 +140,19 @@ var centerStartCmd = &cobra.Command{
...
@@ -130,3 +140,19 @@ var centerStartCmd = &cobra.Command{
return
return
},
},
}
}
func
(
c
*
CenterStartOption
)
setSystemProperty
(
jenkinsWarArgs
[]
string
)
[]
string
{
if
c
.
System
==
nil
{
c
.
System
=
[]
string
{}
}
c
.
System
=
append
(
c
.
System
,
fmt
.
Sprintf
(
"jenkins.install.runSetupWizard=%v"
,
c
.
SetupWizard
))
if
c
.
ConcurrentIndexing
>
-
1
{
c
.
System
=
append
(
c
.
System
,
fmt
.
Sprintf
(
"com.cloudbees.hudson.plugins.folder.computed.ThrottleComputationQueueTaskDispatcher.LIMIT=%d"
,
c
.
ConcurrentIndexing
))
}
for
_
,
item
:=
range
centerStartOption
.
System
{
jenkinsWarArgs
=
append
(
jenkinsWarArgs
,
fmt
.
Sprintf
(
"-D%s"
,
item
))
}
return
jenkinsWarArgs
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录