jenkins-capistrano 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +218 -0
- data/example/.gitignore +4 -0
- data/example/Capfile +9 -0
- data/example/Gemfile +4 -0
- data/example/README.md +32 -0
- data/example/bin/hello +3 -0
- data/example/config/deploy.rb +35 -0
- data/example/config/deploy/develop.rb +5 -0
- data/example/config/deploy/production.rb +9 -0
- data/example/config/deploy/staging.rb +10 -0
- data/example/config/jenkins/jobs/.gitkeep +0 -0
- data/example/config/jenkins/jobs/hello.xml +30 -0
- data/example/config/jenkins/nodes/develop/dev-slave01.json +17 -0
- data/example/config/jenkins/nodes/production/prod-slave01.json +17 -0
- data/example/config/jenkins/nodes/production/prod-slave02.json +17 -0
- data/example/config/jenkins/nodes/production/prod-slave03.json +17 -0
- data/example/config/jenkins/nodes/staging/stg-slave01.json +17 -0
- data/example/config/jenkins/nodes/staging/stg-slave02.json +17 -0
- data/example/config/jenkins/nodes/staging/stg-slave03.json +17 -0
- data/example/script/bootstrap +10 -0
- data/example/script/deploy +6 -0
- data/lib/jenkins-capistrano/client/job.rb +1 -1
- data/lib/jenkins-capistrano/version.rb +1 -1
- metadata +36 -29
- data/README.rst +0 -216
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 08e7f0caa243bf076670aee6c701dea64f471263
|
4
|
+
data.tar.gz: c4bf4f53e44317c8c51d503e6d68343a5deeb05f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 42bf4c7d1b3d24563f8844bcfe553116c464260748aa403bd4bd63b2c6eef2b71f93ed5cdeb478c0e3a805e2b7ce055f4829f8cef31e41cefe78d5d50195c7c0
|
7
|
+
data.tar.gz: a4af671c54adbeb70e9c624eef73b057f44aef1c9b0ac4b7200507defbea1daffea715cf1646d2fb25f6328fedc6b64dae6db1970052fb720eb7e803d634407e
|
data/README.md
ADDED
@@ -0,0 +1,218 @@
|
|
1
|
+
# jenkins-capistrano
|
2
|
+
|
3
|
+
The capistrano tasks for Jenkins CI Server. Supports to manage following things:
|
4
|
+
|
5
|
+
* Job
|
6
|
+
* Node
|
7
|
+
* View
|
8
|
+
* Plugins(Experimental)
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
Add this line to your application's Gemfile::
|
13
|
+
|
14
|
+
gem 'jenkins-capistrano'
|
15
|
+
|
16
|
+
And then execute::
|
17
|
+
|
18
|
+
$ bundle
|
19
|
+
|
20
|
+
Or install it yourself as::
|
21
|
+
|
22
|
+
$ gem install jenkins-capistrano
|
23
|
+
|
24
|
+
## Example
|
25
|
+
|
26
|
+
See [example directory](https://github.com/cynipe/jenkins-capistrano/tree/develop/example>) or following instructions.
|
27
|
+
|
28
|
+
### Job Configuration
|
29
|
+
|
30
|
+
The following code will creates or updates Jenkins jobs before each deploy task:
|
31
|
+
|
32
|
+
config directory structure(name your config.xml as a job name):
|
33
|
+
```
|
34
|
+
config
|
35
|
+
├── deploy.rb
|
36
|
+
└── jenkins
|
37
|
+
└── jobs
|
38
|
+
├── job-name1.xml
|
39
|
+
├── job-name2.xml
|
40
|
+
└── job-name3.xml
|
41
|
+
```
|
42
|
+
|
43
|
+
deploy.rb:
|
44
|
+
```ruby
|
45
|
+
set :application, "your-awesome-app"
|
46
|
+
set :scm, :git
|
47
|
+
set :repository, "https://github.com/your/repository.git"
|
48
|
+
|
49
|
+
set :jenkins_host, 'http://localhost:8080'
|
50
|
+
#set :jenkins_username, '' # default empty
|
51
|
+
#set :jenkins_password, '' # default empty
|
52
|
+
#set :jenkins_job_config_dir, 'config/jenkins/jobs'
|
53
|
+
|
54
|
+
before 'deploy', 'jenkins:deploy_jobs'
|
55
|
+
```
|
56
|
+
|
57
|
+
#### Want to disabling some jobs for specific environment?
|
58
|
+
|
59
|
+
Since 0.0.5, you can disabling jobs using `disabled_jobs` option.
|
60
|
+
Use this option with [multistage-extension](<https://github.com/capistrano/capistrano/wiki/2.x-Multistage-Extension>).
|
61
|
+
|
62
|
+
Put the following line into `config/deploy/<env>.rb`:
|
63
|
+
```
|
64
|
+
set :disabled_jobs, %w(job1 job2)
|
65
|
+
```
|
66
|
+
|
67
|
+
|
68
|
+
### Node Configuration
|
69
|
+
|
70
|
+
config directory structure(name your json file as a node name):
|
71
|
+
```
|
72
|
+
config
|
73
|
+
├── deploy.rb
|
74
|
+
└── jenkins
|
75
|
+
└── nodes
|
76
|
+
├── node1.json
|
77
|
+
├── node2.json
|
78
|
+
└── node3.json
|
79
|
+
```
|
80
|
+
|
81
|
+
sample node configuration:
|
82
|
+
```json
|
83
|
+
{
|
84
|
+
"name" : "example",
|
85
|
+
"type" : "hudson.slaves.DumbSlave$DescriptorImpl",
|
86
|
+
"description" : "some description",
|
87
|
+
"executors" : 2,
|
88
|
+
"labels" : "linux, java, ruby",
|
89
|
+
"slave_host" : "example.com",
|
90
|
+
"slave_port" : 22,
|
91
|
+
"slave_user" : "jenkins",
|
92
|
+
"master_key" : "/var/lib/jenkins/.ssh/id_rsa",
|
93
|
+
"slave_fs" : "/home/jenkins",
|
94
|
+
"exclusive" : true,
|
95
|
+
"java_path": "/opt/java/bin/java",
|
96
|
+
"jvm_options": "-Xmx512M",
|
97
|
+
"env_vars": {
|
98
|
+
"key1": "val1",
|
99
|
+
"key2": "val2"
|
100
|
+
}
|
101
|
+
}
|
102
|
+
```
|
103
|
+
|
104
|
+
deploy.rb:
|
105
|
+
```ruby
|
106
|
+
set :application, "your-awesome-app"
|
107
|
+
set :scm, :git
|
108
|
+
set :repository, "https://github.com/your/repository.git"
|
109
|
+
|
110
|
+
set :jenkins_host, 'http://localhost:8080'
|
111
|
+
# set :jenkins_username, '' # default empty
|
112
|
+
# set :jenkins_password, '' # default empty
|
113
|
+
# set :jenkins_node_config_dir, 'config/jenkins/nodes'
|
114
|
+
|
115
|
+
before 'deploy', 'jenkins:config_nodes'
|
116
|
+
```
|
117
|
+
|
118
|
+
### View Configuration
|
119
|
+
|
120
|
+
config directory structure(name your json file as a node name):
|
121
|
+
```
|
122
|
+
config
|
123
|
+
├── deploy.rb
|
124
|
+
└── jenkins
|
125
|
+
└── views
|
126
|
+
├── view1.xml
|
127
|
+
├── view2.xml
|
128
|
+
└── view3.xml
|
129
|
+
```
|
130
|
+
|
131
|
+
sample view configuration:
|
132
|
+
```xml
|
133
|
+
<listView>
|
134
|
+
<name>view1</name>
|
135
|
+
<filterExecutors>false</filterExecutors>
|
136
|
+
<filterQueue>false</filterQueue>
|
137
|
+
<properties class="hudson.model.View$PropertyList"/>
|
138
|
+
<jobNames class="tree-set">
|
139
|
+
<comparator class="hudson.util.CaseInsensitiveComparator" reference="../../../hudson.plugins.view.dashboard.Dashboard/jobNames/comparator"/>
|
140
|
+
</jobNames>
|
141
|
+
<jobFilters/>
|
142
|
+
<columns>
|
143
|
+
<hudson.views.StatusColumn/>
|
144
|
+
<hudson.views.WeatherColumn/>
|
145
|
+
<hudson.views.JobColumn/>
|
146
|
+
<hudson.views.LastSuccessColumn/>
|
147
|
+
<hudson.views.LastFailureColumn/>
|
148
|
+
<hudson.views.LastDurationColumn/>
|
149
|
+
<hudson.views.BuildButtonColumn/>
|
150
|
+
</columns>
|
151
|
+
<includeRegex>job.*</includeRegex>
|
152
|
+
</listView>
|
153
|
+
```
|
154
|
+
|
155
|
+
deploy.rb:
|
156
|
+
```ruby
|
157
|
+
set :application, "your-awesome-app"
|
158
|
+
set :scm, :git
|
159
|
+
set :repository, "https://github.com/your/repository.git"
|
160
|
+
|
161
|
+
set :jenkins_host, 'http://localhost:8080'
|
162
|
+
# set :jenkins_username, '' # default empty
|
163
|
+
# set :jenkins_password, '' # default empty
|
164
|
+
# set :jenkins_node_config_dir, 'config/jenkins/nodes'
|
165
|
+
|
166
|
+
before 'deploy', 'jenkins:config_views'
|
167
|
+
```
|
168
|
+
|
169
|
+
#### Don't know how to write config.xml for view?
|
170
|
+
|
171
|
+
Create or configure the view you want to manage via usual operation through the Jenkins UI.
|
172
|
+
Then, open the `JENKINS_HOME/config.xml` and copy the desired configuration from `<views>` section, and
|
173
|
+
ommit `<owner class="hudson" reference="../../.."/>` line.
|
174
|
+
|
175
|
+
### Plugin Configuration(experimental)
|
176
|
+
|
177
|
+
#### Note
|
178
|
+
|
179
|
+
This feature is may change its API without any notice.
|
180
|
+
Use at your own risk.
|
181
|
+
|
182
|
+
deploy.rb:
|
183
|
+
```ruby
|
184
|
+
set :application, "your-awesome-app"
|
185
|
+
set :scm, :git
|
186
|
+
set :repository, "https://github.com/your/repository.git"
|
187
|
+
|
188
|
+
set :jenkins_plugins, %w(cron_column envinject join)
|
189
|
+
# you can specify version as follows:
|
190
|
+
#set :jenkins_plugins, %w(cron_column@1.1.2 envinject join@1.0.0)
|
191
|
+
set :jenkins_install_timeout, 60 * 5 # default: 5min
|
192
|
+
set :jenkins_plugin_enable_update, false # dafault: false
|
193
|
+
set :jenkins_plugin_enable_restart, false # default: false
|
194
|
+
|
195
|
+
before 'deploy', 'jenkins:install_plugins'
|
196
|
+
```
|
197
|
+
|
198
|
+
## Release Notes
|
199
|
+
|
200
|
+
### 0.0.7
|
201
|
+
* Fix disable_job is not working with recent version of Jenkins ([#9](https://github.com/cynipe/jenkins-capistrano/pull/9))
|
202
|
+
|
203
|
+
### 0.0.6
|
204
|
+
* Support view management ([726ad3ef](<https://github.com/cynipe/jenkins-capistrano/commit/726ad3ef817ba15a2d66503ce0dd4bc961ed92e2))
|
205
|
+
* Support plugin management(Experimental) ([4d9964c0](https://github.com/cynipe/jenkins-capistrano/commit/4d9964c00ff95798915484ceb8b5c837b2aa03e8))
|
206
|
+
|
207
|
+
### 0.0.5.2
|
208
|
+
* Fix cgi library loading error
|
209
|
+
|
210
|
+
## Contributing
|
211
|
+
|
212
|
+
1. Fork it
|
213
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
214
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
215
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
216
|
+
5. Create new Pull Request
|
217
|
+
|
218
|
+
[![githalytics.com alpha](https://cruel-carlota.pagodabox.com/e76247570c952ad3205ca7d6d3f0f7b5 "githalytics.com")](http://githalytics.com/cynipe/jenkins-capistrano)
|
data/example/.gitignore
ADDED
data/example/Capfile
ADDED
data/example/Gemfile
ADDED
data/example/README.md
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# jenkins-capistrano example
|
2
|
+
|
3
|
+
jenkins-capistranoを使って、master-slave構成のJenkinsに以下のことを行う設定例
|
4
|
+
|
5
|
+
* バッチで必要なジョブ
|
6
|
+
* バッチを実際に実行するためのスレーブノードの登録
|
7
|
+
* バッチプログラム(binディレクトリ)のデプロイ
|
8
|
+
|
9
|
+
## 前提
|
10
|
+
|
11
|
+
* ローカルにruby1.8.7+が入っていること
|
12
|
+
* 各スレーブノードに`/opt/hello`ディレクトリがあること
|
13
|
+
* `/opt/hello`ディレクトリにjenkinsユーザが書き込み権限があること
|
14
|
+
* jenkinsユーザがマスターノードからスレーブノードに公開鍵認証で接続できること
|
15
|
+
|
16
|
+
## デプロイの仕方
|
17
|
+
|
18
|
+
本番環境:
|
19
|
+
```
|
20
|
+
$ script/deploy production
|
21
|
+
```
|
22
|
+
|
23
|
+
ステージング環境:
|
24
|
+
```
|
25
|
+
$ script/deploy staging
|
26
|
+
```
|
27
|
+
|
28
|
+
開発環境:
|
29
|
+
```
|
30
|
+
$ script/deploy
|
31
|
+
```
|
32
|
+
|
data/example/bin/hello
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
set :application, 'hello'
|
2
|
+
set :repository, 'http://example.org/your/repository.git'
|
3
|
+
set :scm, :git
|
4
|
+
set :branch, 'develop' # デフォルトブランチの設定
|
5
|
+
set :deploy_via, :copy # ローカルクローンしてリモートにコピー(リモートでクローンしないように)
|
6
|
+
set :deploy_to, "/opt/#{application}"
|
7
|
+
set :use_sudo, false
|
8
|
+
set :keep_releases, 5
|
9
|
+
|
10
|
+
set :stages, %w(develop staging production)
|
11
|
+
set :default_stage, 'develop'
|
12
|
+
|
13
|
+
set :user, 'jenkins'
|
14
|
+
# 公開鍵認証を推奨
|
15
|
+
#set :password do
|
16
|
+
# ENV['DEPLOY_PASSWORD'] || Capistrano::CLI.password_prompt("linux user password[#{user}]: ")
|
17
|
+
#end
|
18
|
+
|
19
|
+
set :jenkins_username, user
|
20
|
+
# 必要であれば
|
21
|
+
#set :jenkins_password do
|
22
|
+
# ENV['DEPLOY_PASSWORD'] || Capistrano::CLI.password_prompt("jenkins server password[#{user}]: ")
|
23
|
+
#end
|
24
|
+
|
25
|
+
before 'deploy', 'deploy:check'
|
26
|
+
after 'deploy', 'jenkins:deploy_jobs'
|
27
|
+
after 'deploy', 'jenkins:deploy_jobs'
|
28
|
+
after 'deploy', 'deploy:cleanup'
|
29
|
+
|
30
|
+
# ローカルにgitコマンドがあること
|
31
|
+
depend :local, :command, 'git'
|
32
|
+
# リモートにデプロイ用ディレクトリがあること
|
33
|
+
depend :remote, :directory, deploy_to
|
34
|
+
# jenkinsユーザで書き込みができること
|
35
|
+
depend :remote, :writable, deploy_to
|
File without changes
|
@@ -0,0 +1,30 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?><project>
|
2
|
+
<actions/>
|
3
|
+
<description/>
|
4
|
+
<keepDependencies>false</keepDependencies>
|
5
|
+
<properties/>
|
6
|
+
<scm class="hudson.scm.NullSCM"/>
|
7
|
+
<canRoam>true</canRoam>
|
8
|
+
<disabled>false</disabled>
|
9
|
+
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
|
10
|
+
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
|
11
|
+
<jdk>Default</jdk>
|
12
|
+
<triggers class="vector">
|
13
|
+
<hudson.triggers.TimerTrigger>
|
14
|
+
<spec>0 8 * * *</spec>
|
15
|
+
</hudson.triggers.TimerTrigger>
|
16
|
+
</triggers>
|
17
|
+
<concurrentBuild>false</concurrentBuild>
|
18
|
+
<builders>
|
19
|
+
<hudson.tasks.Shell>
|
20
|
+
<command>cd /opt/hello/current && bin/hello</command>
|
21
|
+
</hudson.tasks.Shell>
|
22
|
+
</builders>
|
23
|
+
<publishers>
|
24
|
+
<hudson.tasks.Mailer>
|
25
|
+
<recipients>opsadmin@example.com</recipients>
|
26
|
+
<dontNotifyEveryUnstableBuild>false</dontNotifyEveryUnstableBuild>
|
27
|
+
<sendToIndividuals>false</sendToIndividuals>
|
28
|
+
</hudson.tasks.Mailer>
|
29
|
+
</publishers>
|
30
|
+
</project>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
{
|
2
|
+
"description" : "Slave1",
|
3
|
+
"slave_fs" : "/home/jenkins",
|
4
|
+
"executors" : 5,
|
5
|
+
"exclusive" : true,
|
6
|
+
"labels" : "hello",
|
7
|
+
"slave_host" : "dev-slave01.local",
|
8
|
+
"slave_port" : 22,
|
9
|
+
"slave_user" : "jenkins",
|
10
|
+
"master_key" : "/var/lib/jenkins/.ssh/id_rsa",
|
11
|
+
"jvm_options" : "-Dfile.encoding=UTF-8",
|
12
|
+
"env_vars": {
|
13
|
+
"LANG" : "ja_JP.UTF-8",
|
14
|
+
"ENVIRONMENT" : "production",
|
15
|
+
}
|
16
|
+
}
|
17
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
{
|
2
|
+
"description" : "Slave1",
|
3
|
+
"slave_fs" : "/home/jenkins",
|
4
|
+
"executors" : 5,
|
5
|
+
"exclusive" : true,
|
6
|
+
"labels" : "hello",
|
7
|
+
"slave_host" : "prod-slave01.local",
|
8
|
+
"slave_port" : 22,
|
9
|
+
"slave_user" : "jenkins",
|
10
|
+
"master_key" : "/var/lib/jenkins/.ssh/id_rsa",
|
11
|
+
"jvm_options" : "-Dfile.encoding=UTF-8",
|
12
|
+
"env_vars": {
|
13
|
+
"LANG" : "ja_JP.UTF-8",
|
14
|
+
"ENVIRONMENT" : "production",
|
15
|
+
}
|
16
|
+
}
|
17
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
{
|
2
|
+
"description" : "Slave1",
|
3
|
+
"slave_fs" : "/home/jenkins",
|
4
|
+
"executors" : 5,
|
5
|
+
"exclusive" : true,
|
6
|
+
"labels" : "hello",
|
7
|
+
"slave_host" : "prod-slave02.local",
|
8
|
+
"slave_port" : 22,
|
9
|
+
"slave_user" : "jenkins",
|
10
|
+
"master_key" : "/var/lib/jenkins/.ssh/id_rsa",
|
11
|
+
"jvm_options" : "-Dfile.encoding=UTF-8",
|
12
|
+
"env_vars": {
|
13
|
+
"LANG" : "ja_JP.UTF-8",
|
14
|
+
"ENVIRONMENT" : "production",
|
15
|
+
}
|
16
|
+
}
|
17
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
{
|
2
|
+
"description" : "Slave1",
|
3
|
+
"slave_fs" : "/home/jenkins",
|
4
|
+
"executors" : 5,
|
5
|
+
"exclusive" : true,
|
6
|
+
"labels" : "hello",
|
7
|
+
"slave_host" : "prod-slave03.local",
|
8
|
+
"slave_port" : 22,
|
9
|
+
"slave_user" : "jenkins",
|
10
|
+
"master_key" : "/var/lib/jenkins/.ssh/id_rsa",
|
11
|
+
"jvm_options" : "-Dfile.encoding=UTF-8",
|
12
|
+
"env_vars": {
|
13
|
+
"LANG" : "ja_JP.UTF-8",
|
14
|
+
"ENVIRONMENT" : "production",
|
15
|
+
}
|
16
|
+
}
|
17
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
{
|
2
|
+
"description" : "Slave1",
|
3
|
+
"slave_fs" : "/home/jenkins",
|
4
|
+
"executors" : 5,
|
5
|
+
"exclusive" : true,
|
6
|
+
"labels" : "hello",
|
7
|
+
"slave_host" : "stg-slave01.local",
|
8
|
+
"slave_port" : 22,
|
9
|
+
"slave_user" : "jenkins",
|
10
|
+
"master_key" : "/var/lib/jenkins/.ssh/id_rsa",
|
11
|
+
"jvm_options" : "-Dfile.encoding=UTF-8",
|
12
|
+
"env_vars": {
|
13
|
+
"LANG" : "ja_JP.UTF-8",
|
14
|
+
"ENVIRONMENT" : "staging",
|
15
|
+
}
|
16
|
+
}
|
17
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
{
|
2
|
+
"description" : "Slave2",
|
3
|
+
"slave_fs" : "/home/jenkins",
|
4
|
+
"executors" : 5,
|
5
|
+
"exclusive" : true,
|
6
|
+
"labels" : "hello",
|
7
|
+
"slave_host" : "stg-slave02.local",
|
8
|
+
"slave_port" : 22,
|
9
|
+
"slave_user" : "jenkins",
|
10
|
+
"master_key" : "/var/lib/jenkins/.ssh/id_rsa",
|
11
|
+
"jvm_options" : "-Dfile.encoding=UTF-8",
|
12
|
+
"env_vars": {
|
13
|
+
"LANG" : "ja_JP.UTF-8",
|
14
|
+
"ENVIRONMENT" : "staging",
|
15
|
+
}
|
16
|
+
}
|
17
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
{
|
2
|
+
"description" : "Slave3",
|
3
|
+
"slave_fs" : "/home/jenkins",
|
4
|
+
"executors" : 5,
|
5
|
+
"exclusive" : true,
|
6
|
+
"labels" : "hello",
|
7
|
+
"slave_host" : "stg-slave03.local",
|
8
|
+
"slave_port" : 22,
|
9
|
+
"slave_user" : "jenkins",
|
10
|
+
"master_key" : "/var/lib/jenkins/.ssh/id_rsa",
|
11
|
+
"jvm_options" : "-Dfile.encoding=UTF-8",
|
12
|
+
"env_vars": {
|
13
|
+
"LANG" : "ja_JP.UTF-8",
|
14
|
+
"ENVIRONMENT" : "staging",
|
15
|
+
}
|
16
|
+
}
|
17
|
+
|
@@ -27,7 +27,7 @@ module Jenkins
|
|
27
27
|
|
28
28
|
def disable_job(name)
|
29
29
|
res = self.class.post("/job/#{CGI.escape(name)}/disable")
|
30
|
-
raise ServerError, parse_error_message(res) unless res.code.to_i == 200
|
30
|
+
raise ServerError, parse_error_message(res) unless res.code.to_i == 200 || res.code.to_i == 302
|
31
31
|
rescue => e
|
32
32
|
raise ServerError, "Failed to create job: #{name}, make sure you have specified auth info properly"
|
33
33
|
end
|
metadata
CHANGED
@@ -1,36 +1,32 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jenkins-capistrano
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.7
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- cynipe
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-10-29 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: capistrano
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: httparty
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - ~>
|
36
32
|
- !ruby/object:Gem::Version
|
@@ -38,7 +34,6 @@ dependencies:
|
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - ~>
|
44
39
|
- !ruby/object:Gem::Version
|
@@ -46,49 +41,43 @@ dependencies:
|
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: hpricot
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - '>='
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0'
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - '>='
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0'
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: rake
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - '>='
|
68
60
|
- !ruby/object:Gem::Version
|
69
61
|
version: '0'
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- -
|
66
|
+
- - '>='
|
76
67
|
- !ruby/object:Gem::Version
|
77
68
|
version: '0'
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: pry
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
|
-
- -
|
73
|
+
- - '>='
|
84
74
|
- !ruby/object:Gem::Version
|
85
75
|
version: '0'
|
86
76
|
type: :development
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
|
-
- -
|
80
|
+
- - '>='
|
92
81
|
- !ruby/object:Gem::Version
|
93
82
|
version: '0'
|
94
83
|
description: The capistrano tasks for Jenkins CI Server
|
@@ -101,8 +90,28 @@ files:
|
|
101
90
|
- .gitignore
|
102
91
|
- Gemfile
|
103
92
|
- LICENSE
|
104
|
-
- README.
|
93
|
+
- README.md
|
105
94
|
- Rakefile
|
95
|
+
- example/.gitignore
|
96
|
+
- example/Capfile
|
97
|
+
- example/Gemfile
|
98
|
+
- example/README.md
|
99
|
+
- example/bin/hello
|
100
|
+
- example/config/deploy.rb
|
101
|
+
- example/config/deploy/develop.rb
|
102
|
+
- example/config/deploy/production.rb
|
103
|
+
- example/config/deploy/staging.rb
|
104
|
+
- example/config/jenkins/jobs/.gitkeep
|
105
|
+
- example/config/jenkins/jobs/hello.xml
|
106
|
+
- example/config/jenkins/nodes/develop/dev-slave01.json
|
107
|
+
- example/config/jenkins/nodes/production/prod-slave01.json
|
108
|
+
- example/config/jenkins/nodes/production/prod-slave02.json
|
109
|
+
- example/config/jenkins/nodes/production/prod-slave03.json
|
110
|
+
- example/config/jenkins/nodes/staging/stg-slave01.json
|
111
|
+
- example/config/jenkins/nodes/staging/stg-slave02.json
|
112
|
+
- example/config/jenkins/nodes/staging/stg-slave03.json
|
113
|
+
- example/script/bootstrap
|
114
|
+
- example/script/deploy
|
106
115
|
- jenkins-capistrano.gemspec
|
107
116
|
- lib/jenkins-capistrano.rb
|
108
117
|
- lib/jenkins-capistrano/client.rb
|
@@ -114,27 +123,25 @@ files:
|
|
114
123
|
- lib/jenkins-capistrano/version.rb
|
115
124
|
homepage: https://github.com/cynipe/jenkins-capistrano
|
116
125
|
licenses: []
|
126
|
+
metadata: {}
|
117
127
|
post_install_message:
|
118
128
|
rdoc_options: []
|
119
129
|
require_paths:
|
120
130
|
- lib
|
121
131
|
required_ruby_version: !ruby/object:Gem::Requirement
|
122
|
-
none: false
|
123
132
|
requirements:
|
124
|
-
- -
|
133
|
+
- - '>='
|
125
134
|
- !ruby/object:Gem::Version
|
126
135
|
version: '0'
|
127
136
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
|
-
none: false
|
129
137
|
requirements:
|
130
|
-
- -
|
138
|
+
- - '>='
|
131
139
|
- !ruby/object:Gem::Version
|
132
140
|
version: '0'
|
133
141
|
requirements: []
|
134
142
|
rubyforge_project:
|
135
|
-
rubygems_version:
|
143
|
+
rubygems_version: 2.0.3
|
136
144
|
signing_key:
|
137
|
-
specification_version:
|
145
|
+
specification_version: 4
|
138
146
|
summary: ''
|
139
147
|
test_files: []
|
140
|
-
has_rdoc:
|
data/README.rst
DELETED
@@ -1,216 +0,0 @@
|
|
1
|
-
==================
|
2
|
-
jenkins-capistrano
|
3
|
-
==================
|
4
|
-
|
5
|
-
The capistrano tasks for Jenkins CI Server. Supports to manage following things:
|
6
|
-
|
7
|
-
* Job
|
8
|
-
* Node
|
9
|
-
* View
|
10
|
-
* Plugins(Experimental)
|
11
|
-
|
12
|
-
Installation
|
13
|
-
============
|
14
|
-
|
15
|
-
Add this line to your application's Gemfile::
|
16
|
-
|
17
|
-
gem 'jenkins-capistrano'
|
18
|
-
|
19
|
-
And then execute::
|
20
|
-
|
21
|
-
$ bundle
|
22
|
-
|
23
|
-
Or install it yourself as::
|
24
|
-
|
25
|
-
$ gem install jenkins-capistrano
|
26
|
-
|
27
|
-
Example
|
28
|
-
=======
|
29
|
-
|
30
|
-
Job Configuration
|
31
|
-
~~~~~~~~~~~~~~~~~
|
32
|
-
|
33
|
-
The following code will creates or updates Jenkins jobs before each deploy task:
|
34
|
-
|
35
|
-
config directory structure(name your config.xml as a job name)::
|
36
|
-
|
37
|
-
config
|
38
|
-
├── deploy.rb
|
39
|
-
└── jenkins
|
40
|
-
└── jobs
|
41
|
-
├── job-name1.xml
|
42
|
-
├── job-name2.xml
|
43
|
-
└── job-name3.xml
|
44
|
-
|
45
|
-
|
46
|
-
deploy.rb::
|
47
|
-
|
48
|
-
set :application, "your-awesome-app"
|
49
|
-
set :scm, :git
|
50
|
-
set :repository, "https://github.com/your/repository.git"
|
51
|
-
|
52
|
-
set :jenkins_host, 'http://localhost:8080'
|
53
|
-
# set :jenkins_username, '' # default empty
|
54
|
-
# set :jenkins_password, '' # default empty
|
55
|
-
# set :jenkins_job_config_dir, 'config/jenkins/jobs'
|
56
|
-
|
57
|
-
before 'deploy', 'jenkins:deploy_jobs'
|
58
|
-
|
59
|
-
Want to disabling some jobs for specific environment?
|
60
|
-
-----------------------------------------------------
|
61
|
-
|
62
|
-
Since 0.0.5, you can disabling jobs using `disabled_jobs` option.
|
63
|
-
Use this option with `multistage-extension <https://github.com/capistrano/capistrano/wiki/2.x-Multistage-Extension>`_.
|
64
|
-
|
65
|
-
Put the following line into `config/deploy/<env>.rb`::
|
66
|
-
|
67
|
-
set :disabled_jobs, %w(job1 job2)
|
68
|
-
|
69
|
-
|
70
|
-
Node Configuration
|
71
|
-
~~~~~~~~~~~~~~~~~~
|
72
|
-
|
73
|
-
config directory structure(name your json file as a node name)::
|
74
|
-
|
75
|
-
config
|
76
|
-
├── deploy.rb
|
77
|
-
└── jenkins
|
78
|
-
└── nodes
|
79
|
-
├── node1.json
|
80
|
-
├── node2.json
|
81
|
-
└── node3.json
|
82
|
-
|
83
|
-
sample node configuration::
|
84
|
-
|
85
|
-
{
|
86
|
-
"name" : "example",
|
87
|
-
"type" : "hudson.slaves.DumbSlave$DescriptorImpl",
|
88
|
-
"description" : "some description",
|
89
|
-
"executors" : 2,
|
90
|
-
"labels" : "linux, java, ruby",
|
91
|
-
"slave_host" : "example.com",
|
92
|
-
"slave_port" : 22,
|
93
|
-
"slave_user" : "jenkins",
|
94
|
-
"master_key" : "/var/lib/jenkins/.ssh/id_rsa",
|
95
|
-
"slave_fs" : "/home/jenkins",
|
96
|
-
"exclusive" : true,
|
97
|
-
"java_path": "/opt/java/bin/java",
|
98
|
-
"jvm_options": "-Xmx512M",
|
99
|
-
"env_vars": {
|
100
|
-
"key1": "val1",
|
101
|
-
"key2": "val2"
|
102
|
-
}
|
103
|
-
}
|
104
|
-
|
105
|
-
deploy.rb::
|
106
|
-
|
107
|
-
set :application, "your-awesome-app"
|
108
|
-
set :scm, :git
|
109
|
-
set :repository, "https://github.com/your/repository.git"
|
110
|
-
|
111
|
-
set :jenkins_host, 'http://localhost:8080'
|
112
|
-
# set :jenkins_username, '' # default empty
|
113
|
-
# set :jenkins_password, '' # default empty
|
114
|
-
# set :jenkins_node_config_dir, 'config/jenkins/nodes'
|
115
|
-
|
116
|
-
before 'deploy', 'jenkins:config_nodes'
|
117
|
-
|
118
|
-
View Configuration
|
119
|
-
~~~~~~~~~~~~~~~~~~
|
120
|
-
|
121
|
-
config directory structure(name your json file as a node name)::
|
122
|
-
|
123
|
-
config
|
124
|
-
├── deploy.rb
|
125
|
-
└── jenkins
|
126
|
-
└── views
|
127
|
-
├── view1.xml
|
128
|
-
├── view2.xml
|
129
|
-
└── view3.xml
|
130
|
-
|
131
|
-
sample view configuration::
|
132
|
-
|
133
|
-
<listView>
|
134
|
-
<name>view1</name>
|
135
|
-
<filterExecutors>false</filterExecutors>
|
136
|
-
<filterQueue>false</filterQueue>
|
137
|
-
<properties class="hudson.model.View$PropertyList"/>
|
138
|
-
<jobNames class="tree-set">
|
139
|
-
<comparator class="hudson.util.CaseInsensitiveComparator" reference="../../../hudson.plugins.view.dashboard.Dashboard/jobNames/comparator"/>
|
140
|
-
</jobNames>
|
141
|
-
<jobFilters/>
|
142
|
-
<columns>
|
143
|
-
<hudson.views.StatusColumn/>
|
144
|
-
<hudson.views.WeatherColumn/>
|
145
|
-
<hudson.views.JobColumn/>
|
146
|
-
<hudson.views.LastSuccessColumn/>
|
147
|
-
<hudson.views.LastFailureColumn/>
|
148
|
-
<hudson.views.LastDurationColumn/>
|
149
|
-
<hudson.views.BuildButtonColumn/>
|
150
|
-
</columns>
|
151
|
-
<includeRegex>job.*</includeRegex>
|
152
|
-
</listView>
|
153
|
-
|
154
|
-
deploy.rb::
|
155
|
-
|
156
|
-
set :application, "your-awesome-app"
|
157
|
-
set :scm, :git
|
158
|
-
set :repository, "https://github.com/your/repository.git"
|
159
|
-
|
160
|
-
set :jenkins_host, 'http://localhost:8080'
|
161
|
-
# set :jenkins_username, '' # default empty
|
162
|
-
# set :jenkins_password, '' # default empty
|
163
|
-
# set :jenkins_node_config_dir, 'config/jenkins/nodes'
|
164
|
-
|
165
|
-
before 'deploy', 'jenkins:config_views'
|
166
|
-
|
167
|
-
|
168
|
-
Don't know how to write config.xml for view?
|
169
|
-
--------------------------------------------
|
170
|
-
|
171
|
-
Create or configure the view you want to manage via usual operation through the Jenkins UI.
|
172
|
-
Then, open the `JENKINS_HOME/config.xml` and copy the desired configuration from `<views>` section, and
|
173
|
-
ommit `<owner class="hudson" reference="../../.."/>` line.
|
174
|
-
|
175
|
-
Plugin Configuration(experimental)
|
176
|
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
177
|
-
|
178
|
-
Note
|
179
|
-
----
|
180
|
-
|
181
|
-
This feature is may change its API without any notice.
|
182
|
-
Use at your own risk.
|
183
|
-
|
184
|
-
deploy.rb::
|
185
|
-
|
186
|
-
set :application, "your-awesome-app"
|
187
|
-
set :scm, :git
|
188
|
-
set :repository, "https://github.com/your/repository.git"
|
189
|
-
|
190
|
-
set :jenkins_plugins, %w(cron_column envinject join)
|
191
|
-
# you can specify version as follows:
|
192
|
-
# set :jenkins_plugins, %w(cron_column@1.1.2 envinject join@1.0.0)
|
193
|
-
set :jenkins_install_timeout, 60 * 5 # default: 5min
|
194
|
-
set :jenkins_plugin_enable_update, false # dafault: false
|
195
|
-
set :jenkins_plugin_enable_restart, false # default: false
|
196
|
-
|
197
|
-
before 'deploy', 'jenkins:install_plugins'
|
198
|
-
|
199
|
-
Release Notes
|
200
|
-
=============
|
201
|
-
|
202
|
-
0.0.6
|
203
|
-
* Support view management (`726ad3ef <https://github.com/cynipe/jenkins-capistrano/commit/726ad3ef817ba15a2d66503ce0dd4bc961ed92e2>`_)
|
204
|
-
* Support plugin management(Experimental) (`4d9964c0 <https://github.com/cynipe/jenkins-capistrano/commit/4d9964c00ff95798915484ceb8b5c837b2aa03e8>`_)
|
205
|
-
|
206
|
-
0.0.5.2
|
207
|
-
* Fix cgi library loading error
|
208
|
-
|
209
|
-
Contributing
|
210
|
-
============
|
211
|
-
|
212
|
-
1. Fork it
|
213
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
214
|
-
3. Commit your changes (`git commit -am 'Added some feature'`)
|
215
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
216
|
-
5. Create new Pull Request
|