jenkins-capistrano 0.0.7 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +73 -16
- data/Gemfile.lock +80 -0
- data/README.md +169 -56
- data/Vagrantfile +23 -0
- data/example/Gemfile +3 -1
- data/example/README.md +13 -17
- data/example/config/deploy.rb +8 -12
- data/example/config/deploy/develop.rb +5 -3
- data/example/config/deploy/production.rb +13 -3
- data/example/config/deploy/staging.rb +13 -4
- data/example/config/jenkins/nodes/develop/dev-slave01.xml.erb +33 -0
- data/example/config/jenkins/nodes/production/prod-slave01.xml.erb +33 -0
- data/example/config/jenkins/nodes/production/prod-slave02.xml.erb +33 -0
- data/example/config/jenkins/nodes/production/prod-slave03.xml.erb +33 -0
- data/example/config/jenkins/nodes/staging/stg-slave01.xml.erb +33 -0
- data/example/config/jenkins/nodes/staging/stg-slave02.xml.erb +33 -0
- data/example/config/jenkins/nodes/staging/stg-slave03.xml.erb +33 -0
- data/example/script/bootstrap +1 -2
- data/features/config_jobs.feature +162 -0
- data/features/config_nodes.feature +121 -0
- data/features/config_views.feature +136 -0
- data/features/help.feature +83 -0
- data/features/step_definitions/jenkins_steps.rb +19 -0
- data/features/support/env.rb +5 -0
- data/features/support/jenkins_helper.rb +113 -0
- data/jenkins-capistrano.gemspec +4 -3
- data/lib/jenkins-capistrano.rb +2 -215
- data/lib/jenkins-capistrano/configurator.rb +87 -0
- data/lib/jenkins-capistrano/tasks.rb +112 -0
- data/lib/jenkins-capistrano/template.rb +20 -0
- data/lib/jenkins-capistrano/version.rb +1 -1
- metadata +87 -41
- checksums.yaml +0 -7
- data/example/config/jenkins/jobs/.gitkeep +0 -0
- data/example/config/jenkins/nodes/develop/dev-slave01.json +0 -17
- data/example/config/jenkins/nodes/production/prod-slave01.json +0 -17
- data/example/config/jenkins/nodes/production/prod-slave02.json +0 -17
- data/example/config/jenkins/nodes/production/prod-slave03.json +0 -17
- data/example/config/jenkins/nodes/staging/stg-slave01.json +0 -17
- data/example/config/jenkins/nodes/staging/stg-slave02.json +0 -17
- data/example/config/jenkins/nodes/staging/stg-slave03.json +0 -17
- data/lib/jenkins-capistrano/client.rb +0 -66
- data/lib/jenkins-capistrano/client/job.rb +0 -47
- data/lib/jenkins-capistrano/client/node.rb +0 -103
- data/lib/jenkins-capistrano/client/plugin_manager.rb +0 -51
- data/lib/jenkins-capistrano/client/update_center.rb +0 -43
- data/lib/jenkins-capistrano/client/view.rb +0 -40
data/Vagrantfile
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- mode: ruby -*-
|
2
|
+
# vi: set ft=ruby :
|
3
|
+
|
4
|
+
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
|
5
|
+
VAGRANTFILE_API_VERSION = "2"
|
6
|
+
|
7
|
+
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
8
|
+
config.vm.box_url = 'https://github.com/2creatives/vagrant-centos/releases/download/v6.5.3/centos65-x86_64-20140116.box'
|
9
|
+
config.vm.box = 'centos65-x86_64-20140116'
|
10
|
+
|
11
|
+
config.vm.provider :virtualbox do |vb|
|
12
|
+
vb.customize ['modifyvm', :id, '--memory', '512']
|
13
|
+
end
|
14
|
+
|
15
|
+
config.vm.network 'forwarded_port', guest: 8080, host: 8080
|
16
|
+
config.vm.provision :shell, :inline => (<<-SCRIPT).gsub(/^ */, '')
|
17
|
+
curl -o /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo >/dev/null 2&>1
|
18
|
+
rpm --import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key
|
19
|
+
yum -y install java-1.7.0-openjdk jenkins
|
20
|
+
service jenkins start
|
21
|
+
SCRIPT
|
22
|
+
end
|
23
|
+
|
data/example/Gemfile
CHANGED
data/example/README.md
CHANGED
@@ -1,32 +1,28 @@
|
|
1
1
|
# jenkins-capistrano example
|
2
2
|
|
3
|
-
|
3
|
+
This is a example **batch** project with jekins-capistrano configs
|
4
|
+
which deploy and configure the following staff to the master-slave Jenkins:
|
4
5
|
|
5
|
-
*
|
6
|
-
*
|
7
|
-
*
|
6
|
+
* A job to execute the batch program
|
7
|
+
* A node to excute the job
|
8
|
+
* The batch program itself
|
8
9
|
|
9
|
-
##
|
10
|
+
## Deploy
|
10
11
|
|
11
|
-
|
12
|
-
* 各スレーブノードに`/opt/hello`ディレクトリがあること
|
13
|
-
* `/opt/hello`ディレクトリにjenkinsユーザが書き込み権限があること
|
14
|
-
* jenkinsユーザがマスターノードからスレーブノードに公開鍵認証で接続できること
|
12
|
+
### Development
|
15
13
|
|
16
|
-
## デプロイの仕方
|
17
|
-
|
18
|
-
本番環境:
|
19
14
|
```
|
20
|
-
$ script/deploy
|
15
|
+
$ script/deploy
|
21
16
|
```
|
22
17
|
|
23
|
-
|
18
|
+
### Staging
|
19
|
+
|
24
20
|
```
|
25
21
|
$ script/deploy staging
|
26
22
|
```
|
27
23
|
|
28
|
-
|
24
|
+
### Production
|
25
|
+
|
29
26
|
```
|
30
|
-
$ script/deploy
|
27
|
+
$ script/deploy production
|
31
28
|
```
|
32
|
-
|
data/example/config/deploy.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
set :application, 'hello'
|
2
2
|
set :repository, 'http://example.org/your/repository.git'
|
3
3
|
set :scm, :git
|
4
|
-
set :branch, 'develop'
|
5
|
-
set :deploy_via, :copy
|
4
|
+
set :branch, 'develop'
|
5
|
+
set :deploy_via, :copy
|
6
6
|
set :deploy_to, "/opt/#{application}"
|
7
7
|
set :use_sudo, false
|
8
8
|
set :keep_releases, 5
|
@@ -10,14 +10,13 @@ set :keep_releases, 5
|
|
10
10
|
set :stages, %w(develop staging production)
|
11
11
|
set :default_stage, 'develop'
|
12
12
|
|
13
|
-
set :user, '
|
14
|
-
|
15
|
-
#
|
16
|
-
|
17
|
-
#end
|
13
|
+
set :user, 'vagrant'
|
14
|
+
set :password do
|
15
|
+
ENV['DEPLOY_PASSWORD'] || Capistrano::CLI.password_prompt("linux user password[#{user}]: ")
|
16
|
+
end
|
18
17
|
|
19
|
-
|
20
|
-
#
|
18
|
+
# if you need the credentials
|
19
|
+
# set :jenkins_username, 'jenkins'
|
21
20
|
#set :jenkins_password do
|
22
21
|
# ENV['DEPLOY_PASSWORD'] || Capistrano::CLI.password_prompt("jenkins server password[#{user}]: ")
|
23
22
|
#end
|
@@ -27,9 +26,6 @@ after 'deploy', 'jenkins:deploy_jobs'
|
|
27
26
|
after 'deploy', 'jenkins:deploy_jobs'
|
28
27
|
after 'deploy', 'deploy:cleanup'
|
29
28
|
|
30
|
-
# ローカルにgitコマンドがあること
|
31
29
|
depend :local, :command, 'git'
|
32
|
-
# リモートにデプロイ用ディレクトリがあること
|
33
30
|
depend :remote, :directory, deploy_to
|
34
|
-
# jenkinsユーザで書き込みができること
|
35
31
|
depend :remote, :writable, deploy_to
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# ブランチはconfig/deploy.rbの設定に従う
|
2
|
-
role :batch, '
|
3
|
-
set :jenkins_host, '
|
2
|
+
role :batch, 'localhsot:22222'
|
3
|
+
set :jenkins_host, 'localhost:8080'
|
4
4
|
set :jenkins_node_config_dir, 'config/jenkins/nodes/develop'
|
5
|
-
|
5
|
+
set :jenkins_template_vars, {
|
6
|
+
credential_id: 'AAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA'
|
7
|
+
}
|
@@ -1,9 +1,19 @@
|
|
1
1
|
set :branch, 'v1.0.0'
|
2
2
|
|
3
3
|
role :batch, 'prod-slave01.local'
|
4
|
-
|
5
|
-
|
6
|
-
#role :batch, 'prod-slave03.local'
|
4
|
+
role :batch, 'prod-slave02.local'
|
5
|
+
role :batch, 'prod-slave03.local'
|
7
6
|
|
8
7
|
set :jenkins_host, 'prod-master.local'
|
9
8
|
set :jenkins_node_config_dir, 'config/jenkins/nodes/production'
|
9
|
+
set :jenkins_template_vars, {
|
10
|
+
slave01: {
|
11
|
+
credential_id: 'PRODUCTION-SLAVE01-CREDENTIAL',
|
12
|
+
},
|
13
|
+
slave02: {
|
14
|
+
credential_id: 'PRODUCTION-SLAVE02-CREDENTIAL',
|
15
|
+
},
|
16
|
+
slave03: {
|
17
|
+
credential_id: 'PRODUCTION-SLAVE03-CREDENTIAL',
|
18
|
+
}
|
19
|
+
}
|
@@ -1,10 +1,19 @@
|
|
1
1
|
set :branch, 'release/1.0.1'
|
2
2
|
|
3
3
|
role :batch, 'stg-slave01.local'
|
4
|
-
|
5
|
-
|
6
|
-
#role :batch, 'stg-slave03.local'
|
4
|
+
role :batch, 'stg-slave02.local'
|
5
|
+
role :batch, 'stg-slave03.local'
|
7
6
|
|
8
7
|
set :jenkins_host, 'stg-master.local'
|
9
8
|
set :jenkins_node_config_dir, 'config/jenkins/nodes/staging'
|
10
|
-
|
9
|
+
set :jenkins_template_vars, {
|
10
|
+
slave01: {
|
11
|
+
credential_id: 'STAGING-SLAVE01-CREDENTIAL',
|
12
|
+
},
|
13
|
+
slave02: {
|
14
|
+
credential_id: 'STAGING-SLAVE02-CREDENTIAL',
|
15
|
+
},
|
16
|
+
slave03: {
|
17
|
+
credential_id: 'STAGING-SLAVE03-CREDENTIAL',
|
18
|
+
}
|
19
|
+
}
|
@@ -0,0 +1,33 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<slave>
|
3
|
+
<name>dev-slave01</name>
|
4
|
+
<description>Slave01</description>
|
5
|
+
<remoteFS>/home/jenkins</remoteFS>
|
6
|
+
<numExecutors>5</numExecutors>
|
7
|
+
<mode>EXCLUSIVE</mode>
|
8
|
+
<retentionStrategy class="hudson.slaves.RetentionStrategy$Always"/>
|
9
|
+
<launcher class="hudson.plugins.sshslaves.SSHLauncher" plugin="ssh-slaves@1.5">
|
10
|
+
<host>dev-slave01.local</host>
|
11
|
+
<port>22</port>
|
12
|
+
<credentialsId><%= @credential_id %></credentialsId>
|
13
|
+
<jvmOptions>-Dfile.encoding=UTF-8</jvmOptions>
|
14
|
+
</launcher>
|
15
|
+
<label>hello</label>
|
16
|
+
<nodeProperties>
|
17
|
+
<hudson.slaves.EnvironmentVariablesNodeProperty>
|
18
|
+
<envVars serialization="custom">
|
19
|
+
<unserializable-parents/>
|
20
|
+
<tree-map>
|
21
|
+
<default>
|
22
|
+
<comparator class="hudson.util.CaseInsensitiveComparator"/>
|
23
|
+
</default>
|
24
|
+
<int>2</int><!-- must specify env var count -->
|
25
|
+
<string>LANG</string>
|
26
|
+
<string>ja_JP.UTF-8</string>
|
27
|
+
<string>ENVIRONMENT</string>
|
28
|
+
<string>develop</string>
|
29
|
+
</tree-map>
|
30
|
+
</envVars>
|
31
|
+
</hudson.slaves.EnvironmentVariablesNodeProperty>
|
32
|
+
</nodeProperties>
|
33
|
+
</slave>
|
@@ -0,0 +1,33 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<slave>
|
3
|
+
<name>prod-slave01</name>
|
4
|
+
<description>Slave01</description>
|
5
|
+
<remoteFS>/home/jenkins</remoteFS>
|
6
|
+
<numExecutors>5</numExecutors>
|
7
|
+
<mode>EXCLUSIVE</mode>
|
8
|
+
<retentionStrategy class="hudson.slaves.RetentionStrategy$Always"/>
|
9
|
+
<launcher class="hudson.plugins.sshslaves.SSHLauncher" plugin="ssh-slaves@1.5">
|
10
|
+
<host>prod-slave01.local</host>
|
11
|
+
<port>22</port>
|
12
|
+
<credentialsId><%= @slave01[:credential_id] %></credentialsId>
|
13
|
+
<jvmOptions>-Dfile.encoding=UTF-8</jvmOptions>
|
14
|
+
</launcher>
|
15
|
+
<label>hello</label>
|
16
|
+
<nodeProperties>
|
17
|
+
<hudson.slaves.EnvironmentVariablesNodeProperty>
|
18
|
+
<envVars serialization="custom">
|
19
|
+
<unserializable-parents/>
|
20
|
+
<tree-map>
|
21
|
+
<default>
|
22
|
+
<comparator class="hudson.util.CaseInsensitiveComparator"/>
|
23
|
+
</default>
|
24
|
+
<int>2</int><!-- must specify env var count -->
|
25
|
+
<string>LANG</string>
|
26
|
+
<string>ja_JP.UTF-8</string>
|
27
|
+
<string>ENVIRONMENT</string>
|
28
|
+
<string>production</string>
|
29
|
+
</tree-map>
|
30
|
+
</envVars>
|
31
|
+
</hudson.slaves.EnvironmentVariablesNodeProperty>
|
32
|
+
</nodeProperties>
|
33
|
+
</slave>
|
@@ -0,0 +1,33 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<slave>
|
3
|
+
<name>prod-slave02</name>
|
4
|
+
<description>Slave02</description>
|
5
|
+
<remoteFS>/home/jenkins</remoteFS>
|
6
|
+
<numExecutors>5</numExecutors>
|
7
|
+
<mode>EXCLUSIVE</mode>
|
8
|
+
<retentionStrategy class="hudson.slaves.RetentionStrategy$Always"/>
|
9
|
+
<launcher class="hudson.plugins.sshslaves.SSHLauncher" plugin="ssh-slaves@1.5">
|
10
|
+
<host>prod-slave02.local</host>
|
11
|
+
<port>22</port>
|
12
|
+
<credentialsId><%= @slave02[:credential_id] %></credentialsId>
|
13
|
+
<jvmOptions>-Dfile.encoding=UTF-8</jvmOptions>
|
14
|
+
</launcher>
|
15
|
+
<label>hello</label>
|
16
|
+
<nodeProperties>
|
17
|
+
<hudson.slaves.EnvironmentVariablesNodeProperty>
|
18
|
+
<envVars serialization="custom">
|
19
|
+
<unserializable-parents/>
|
20
|
+
<tree-map>
|
21
|
+
<default>
|
22
|
+
<comparator class="hudson.util.CaseInsensitiveComparator"/>
|
23
|
+
</default>
|
24
|
+
<int>2</int><!-- must specify env var count -->
|
25
|
+
<string>LANG</string>
|
26
|
+
<string>ja_JP.UTF-8</string>
|
27
|
+
<string>ENVIRONMENT</string>
|
28
|
+
<string>production</string>
|
29
|
+
</tree-map>
|
30
|
+
</envVars>
|
31
|
+
</hudson.slaves.EnvironmentVariablesNodeProperty>
|
32
|
+
</nodeProperties>
|
33
|
+
</slave>
|
@@ -0,0 +1,33 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<slave>
|
3
|
+
<name>prod-slave03</name>
|
4
|
+
<description>Slave03</description>
|
5
|
+
<remoteFS>/home/jenkins</remoteFS>
|
6
|
+
<numExecutors>5</numExecutors>
|
7
|
+
<mode>EXCLUSIVE</mode>
|
8
|
+
<retentionStrategy class="hudson.slaves.RetentionStrategy$Always"/>
|
9
|
+
<launcher class="hudson.plugins.sshslaves.SSHLauncher" plugin="ssh-slaves@1.5">
|
10
|
+
<host>prod-slave03.local</host>
|
11
|
+
<port>22</port>
|
12
|
+
<credentialsId><%= @slave03[:credential_id] %></credentialsId>
|
13
|
+
<jvmOptions>-Dfile.encoding=UTF-8</jvmOptions>
|
14
|
+
</launcher>
|
15
|
+
<label>hello</label>
|
16
|
+
<nodeProperties>
|
17
|
+
<hudson.slaves.EnvironmentVariablesNodeProperty>
|
18
|
+
<envVars serialization="custom">
|
19
|
+
<unserializable-parents/>
|
20
|
+
<tree-map>
|
21
|
+
<default>
|
22
|
+
<comparator class="hudson.util.CaseInsensitiveComparator"/>
|
23
|
+
</default>
|
24
|
+
<int>2</int><!-- must specify env var count -->
|
25
|
+
<string>LANG</string>
|
26
|
+
<string>ja_JP.UTF-8</string>
|
27
|
+
<string>ENVIRONMENT</string>
|
28
|
+
<string>production</string>
|
29
|
+
</tree-map>
|
30
|
+
</envVars>
|
31
|
+
</hudson.slaves.EnvironmentVariablesNodeProperty>
|
32
|
+
</nodeProperties>
|
33
|
+
</slave>
|
@@ -0,0 +1,33 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<slave>
|
3
|
+
<name>stg-slave01</name>
|
4
|
+
<description>Slave01</description>
|
5
|
+
<remoteFS>/home/jenkins</remoteFS>
|
6
|
+
<numExecutors>5</numExecutors>
|
7
|
+
<mode>EXCLUSIVE</mode>
|
8
|
+
<retentionStrategy class="hudson.slaves.RetentionStrategy$Always"/>
|
9
|
+
<launcher class="hudson.plugins.sshslaves.SSHLauncher" plugin="ssh-slaves@1.5">
|
10
|
+
<host>stg-slave01.local</host>
|
11
|
+
<port>22</port>
|
12
|
+
<credentialsId><%= @slave01[:credential_id] %></credentialsId>
|
13
|
+
<jvmOptions>-Dfile.encoding=UTF-8</jvmOptions>
|
14
|
+
</launcher>
|
15
|
+
<label>hello</label>
|
16
|
+
<nodeProperties>
|
17
|
+
<hudson.slaves.EnvironmentVariablesNodeProperty>
|
18
|
+
<envVars serialization="custom">
|
19
|
+
<unserializable-parents/>
|
20
|
+
<tree-map>
|
21
|
+
<default>
|
22
|
+
<comparator class="hudson.util.CaseInsensitiveComparator"/>
|
23
|
+
</default>
|
24
|
+
<int>2</int><!-- must specify env var count -->
|
25
|
+
<string>LANG</string>
|
26
|
+
<string>ja_JP.UTF-8</string>
|
27
|
+
<string>ENVIRONMENT</string>
|
28
|
+
<string>staging</string>
|
29
|
+
</tree-map>
|
30
|
+
</envVars>
|
31
|
+
</hudson.slaves.EnvironmentVariablesNodeProperty>
|
32
|
+
</nodeProperties>
|
33
|
+
</slave>
|
@@ -0,0 +1,33 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<slave>
|
3
|
+
<name>stg-slave02</name>
|
4
|
+
<description>Slave02</description>
|
5
|
+
<remoteFS>/home/jenkins</remoteFS>
|
6
|
+
<numExecutors>5</numExecutors>
|
7
|
+
<mode>EXCLUSIVE</mode>
|
8
|
+
<retentionStrategy class="hudson.slaves.RetentionStrategy$Always"/>
|
9
|
+
<launcher class="hudson.plugins.sshslaves.SSHLauncher" plugin="ssh-slaves@1.5">
|
10
|
+
<host>stg-slave02.local</host>
|
11
|
+
<port>22</port>
|
12
|
+
<credentialsId><%= @slave02[:credential_id] %></credentialsId>
|
13
|
+
<jvmOptions>-Dfile.encoding=UTF-8</jvmOptions>
|
14
|
+
</launcher>
|
15
|
+
<label>hello</label>
|
16
|
+
<nodeProperties>
|
17
|
+
<hudson.slaves.EnvironmentVariablesNodeProperty>
|
18
|
+
<envVars serialization="custom">
|
19
|
+
<unserializable-parents/>
|
20
|
+
<tree-map>
|
21
|
+
<default>
|
22
|
+
<comparator class="hudson.util.CaseInsensitiveComparator"/>
|
23
|
+
</default>
|
24
|
+
<int>2</int><!-- must specify env var count -->
|
25
|
+
<string>LANG</string>
|
26
|
+
<string>ja_JP.UTF-8</string>
|
27
|
+
<string>ENVIRONMENT</string>
|
28
|
+
<string>staging</string>
|
29
|
+
</tree-map>
|
30
|
+
</envVars>
|
31
|
+
</hudson.slaves.EnvironmentVariablesNodeProperty>
|
32
|
+
</nodeProperties>
|
33
|
+
</slave>
|
@@ -0,0 +1,33 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<slave>
|
3
|
+
<name>stg-slave03</name>
|
4
|
+
<description>Slave03</description>
|
5
|
+
<remoteFS>/home/jenkins</remoteFS>
|
6
|
+
<numExecutors>5</numExecutors>
|
7
|
+
<mode>EXCLUSIVE</mode>
|
8
|
+
<retentionStrategy class="hudson.slaves.RetentionStrategy$Always"/>
|
9
|
+
<launcher class="hudson.plugins.sshslaves.SSHLauncher" plugin="ssh-slaves@1.5">
|
10
|
+
<host>stg-slave03.local</host>
|
11
|
+
<port>22</port>
|
12
|
+
<credentialsId><%= @slave03[:credential_id] %></credentialsId>
|
13
|
+
<jvmOptions>-Dfile.encoding=UTF-8</jvmOptions>
|
14
|
+
</launcher>
|
15
|
+
<label>hello</label>
|
16
|
+
<nodeProperties>
|
17
|
+
<hudson.slaves.EnvironmentVariablesNodeProperty>
|
18
|
+
<envVars serialization="custom">
|
19
|
+
<unserializable-parents/>
|
20
|
+
<tree-map>
|
21
|
+
<default>
|
22
|
+
<comparator class="hudson.util.CaseInsensitiveComparator"/>
|
23
|
+
</default>
|
24
|
+
<int>2</int><!-- must specify env var count -->
|
25
|
+
<string>LANG</string>
|
26
|
+
<string>ja_JP.UTF-8</string>
|
27
|
+
<string>ENVIRONMENT</string>
|
28
|
+
<string>staging</string>
|
29
|
+
</tree-map>
|
30
|
+
</envVars>
|
31
|
+
</hudson.slaves.EnvironmentVariablesNodeProperty>
|
32
|
+
</nodeProperties>
|
33
|
+
</slave>
|
data/example/script/bootstrap
CHANGED
@@ -2,9 +2,8 @@
|
|
2
2
|
|
3
3
|
set -e
|
4
4
|
|
5
|
-
(gem spec bundler -v '~> 1.
|
5
|
+
(gem spec bundler -v '~> 1.6.0' > /dev/null 2>&1) || gem install bundler -v '~> 1.6.0' --no-rdoc --no-ri
|
6
6
|
|
7
|
-
# 常に綺麗な設定で行うように
|
8
7
|
rm -rf .bundle/config
|
9
8
|
bundle install --binstubs .bundle/bin --path .bundle
|
10
9
|
|
@@ -0,0 +1,162 @@
|
|
1
|
+
Feature: Configuring Jobs
|
2
|
+
|
3
|
+
Scenario: Configuring jobs to newly created Jenkins
|
4
|
+
Given the plain Jenkins server
|
5
|
+
And a file named "Capfile" with:
|
6
|
+
"""
|
7
|
+
require 'jenkins-capistrano'
|
8
|
+
load 'config/deploy'
|
9
|
+
"""
|
10
|
+
And a file named "config/deploy.rb" with:
|
11
|
+
"""
|
12
|
+
set :jenkins_host, 'http://localhost:8080'
|
13
|
+
"""
|
14
|
+
And a file named "config/jenkins/jobs/job1.xml" with:
|
15
|
+
"""
|
16
|
+
<?xml version="1.0" encoding="UTF-8"?><project>
|
17
|
+
<actions/>
|
18
|
+
<description>Created</description>
|
19
|
+
<keepDependencies>false</keepDependencies>
|
20
|
+
<properties/>
|
21
|
+
<scm class="hudson.scm.NullSCM"/>
|
22
|
+
<canRoam>true</canRoam>
|
23
|
+
<disabled>false</disabled>
|
24
|
+
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
|
25
|
+
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
|
26
|
+
<jdk>Default</jdk>
|
27
|
+
<triggers/>
|
28
|
+
<concurrentBuild>false</concurrentBuild>
|
29
|
+
<builders/>
|
30
|
+
<publishers/>
|
31
|
+
</project>
|
32
|
+
"""
|
33
|
+
When I successfully run `bundle exec cap jenkins:config_jobs`
|
34
|
+
Then the output should contain:
|
35
|
+
"""
|
36
|
+
job job1 created.
|
37
|
+
"""
|
38
|
+
And the Jenkins has following jobs:
|
39
|
+
| Name | Description | Disabled |
|
40
|
+
| job1 | Created | false |
|
41
|
+
|
42
|
+
Scenario: Configuring jobs already created
|
43
|
+
Given the Jenkins server has following jobs:
|
44
|
+
| Name | Description | Disabled |
|
45
|
+
| job1 | Created | false |
|
46
|
+
And a file named "Capfile" with:
|
47
|
+
"""
|
48
|
+
require 'jenkins-capistrano'
|
49
|
+
load 'config/deploy'
|
50
|
+
"""
|
51
|
+
And a file named "config/deploy.rb" with:
|
52
|
+
"""
|
53
|
+
set :jenkins_host, 'http://localhost:8080'
|
54
|
+
"""
|
55
|
+
And a file named "config/jenkins/jobs/job1.xml" with:
|
56
|
+
"""
|
57
|
+
<?xml version="1.0" encoding="UTF-8"?><project>
|
58
|
+
<actions/>
|
59
|
+
<description>Updated</description>
|
60
|
+
<keepDependencies>false</keepDependencies>
|
61
|
+
<properties/>
|
62
|
+
<scm class="hudson.scm.NullSCM"/>
|
63
|
+
<canRoam>true</canRoam>
|
64
|
+
<disabled>false</disabled>
|
65
|
+
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
|
66
|
+
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
|
67
|
+
<jdk>Default</jdk>
|
68
|
+
<triggers/>
|
69
|
+
<concurrentBuild>false</concurrentBuild>
|
70
|
+
<builders/>
|
71
|
+
<publishers/>
|
72
|
+
</project>
|
73
|
+
"""
|
74
|
+
When I successfully run `bundle exec cap jenkins:config_jobs`
|
75
|
+
Then the Jenkins has following jobs:
|
76
|
+
| Name | Description | Disabled |
|
77
|
+
| job1 | Updated | false |
|
78
|
+
And the output should contain:
|
79
|
+
"""
|
80
|
+
job job1 created.
|
81
|
+
"""
|
82
|
+
|
83
|
+
Scenario: Disabling the specified job
|
84
|
+
Given the plain Jenkins server
|
85
|
+
And a file named "Capfile" with:
|
86
|
+
"""
|
87
|
+
require 'jenkins-capistrano'
|
88
|
+
load 'config/deploy'
|
89
|
+
"""
|
90
|
+
And a file named "config/deploy.rb" with:
|
91
|
+
"""
|
92
|
+
set :jenkins_host, 'http://localhost:8080'
|
93
|
+
set :disabled_jobs, %w(job1)
|
94
|
+
"""
|
95
|
+
And a file named "config/jenkins/jobs/job1.xml" with:
|
96
|
+
"""
|
97
|
+
<?xml version="1.0" encoding="UTF-8"?><project>
|
98
|
+
<actions/>
|
99
|
+
<description>Disabled</description>
|
100
|
+
<keepDependencies>false</keepDependencies>
|
101
|
+
<properties/>
|
102
|
+
<scm class="hudson.scm.NullSCM"/>
|
103
|
+
<canRoam>true</canRoam>
|
104
|
+
<disabled>false</disabled>
|
105
|
+
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
|
106
|
+
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
|
107
|
+
<jdk>Default</jdk>
|
108
|
+
<triggers/>
|
109
|
+
<concurrentBuild>false</concurrentBuild>
|
110
|
+
<builders/>
|
111
|
+
<publishers/>
|
112
|
+
</project>
|
113
|
+
"""
|
114
|
+
When I successfully run `bundle exec cap jenkins:config_jobs`
|
115
|
+
Then the Jenkins has following jobs:
|
116
|
+
| Name | Description | Disabled |
|
117
|
+
| job1 | Disabled | true |
|
118
|
+
And the output should contain:
|
119
|
+
"""
|
120
|
+
job job1 created.
|
121
|
+
-> disabled
|
122
|
+
"""
|
123
|
+
|
124
|
+
Scenario: Configuring the jobs with teamplated config.xmls
|
125
|
+
Given the plain Jenkins server
|
126
|
+
And a file named "Capfile" with:
|
127
|
+
"""
|
128
|
+
require 'jenkins-capistrano'
|
129
|
+
load 'config/deploy'
|
130
|
+
"""
|
131
|
+
And a file named "config/deploy.rb" with:
|
132
|
+
"""
|
133
|
+
set :jenkins_host, 'http://localhost:8080'
|
134
|
+
set :jenkins_template_vars, { :templated => 'Yay!!' }
|
135
|
+
"""
|
136
|
+
And a file named "config/jenkins/jobs/job1.xml.erb" with:
|
137
|
+
"""
|
138
|
+
<?xml version="1.0" encoding="UTF-8"?><project>
|
139
|
+
<actions/>
|
140
|
+
<description><%= @templated %></description>
|
141
|
+
<keepDependencies>false</keepDependencies>
|
142
|
+
<properties/>
|
143
|
+
<scm class="hudson.scm.NullSCM"/>
|
144
|
+
<canRoam>true</canRoam>
|
145
|
+
<disabled>false</disabled>
|
146
|
+
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
|
147
|
+
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
|
148
|
+
<jdk>Default</jdk>
|
149
|
+
<triggers/>
|
150
|
+
<concurrentBuild>false</concurrentBuild>
|
151
|
+
<builders/>
|
152
|
+
<publishers/>
|
153
|
+
</project>
|
154
|
+
"""
|
155
|
+
When I successfully run `bundle exec cap jenkins:config_jobs`
|
156
|
+
Then the Jenkins has following jobs:
|
157
|
+
| Name | Description | Disabled |
|
158
|
+
| job1 | Yay!! | false |
|
159
|
+
And the output should contain:
|
160
|
+
"""
|
161
|
+
job job1 created.
|
162
|
+
"""
|