capistrano-scm-jenkins 0.3.3 → 0.4.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.
- checksums.yaml +4 -4
- data/.travis.yml +9 -9
- data/Gemfile.lock +17 -15
- data/NEWS.md +9 -1
- data/README.md +3 -0
- data/lib/capistrano-scm-jenkins/version.rb +1 -1
- data/lib/capistrano/jenkins.rb +35 -14
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 330c9690618bd67702215220bd3405cca27dc320
|
4
|
+
data.tar.gz: 321660d2fc8ced158e36f833d3706358a3fab91d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33b8df5ecd0997e78c1518a954172889c5179b83fc2afbd20f160b628c1d7cbeb5adcabbfe5ec2b6a4d3ce012c0cc00a3944964b76275043f73b9faa8441a761
|
7
|
+
data.tar.gz: 678b9004ac4fa0b71b5dd066f0ae3a3daeb75c1e6e7b389dcf0fe27603e3ab7de3cd61a74e523f0dcfbbaa089c3398dad24709bccad818390cd3017fc98a8cac
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
capistrano-scm-jenkins (0.
|
4
|
+
capistrano-scm-jenkins (0.4.0)
|
5
5
|
capistrano (~> 3.2.1)
|
6
6
|
|
7
7
|
GEM
|
@@ -11,8 +11,9 @@ GEM
|
|
11
11
|
i18n
|
12
12
|
rake (>= 10.0.0)
|
13
13
|
sshkit (~> 1.3)
|
14
|
+
colorize (0.7.3)
|
14
15
|
diff-lcs (1.2.5)
|
15
|
-
i18n (0.6.
|
16
|
+
i18n (0.6.11)
|
16
17
|
metaclass (0.0.4)
|
17
18
|
mocha (1.1.0)
|
18
19
|
metaclass (~> 0.0.1)
|
@@ -20,21 +21,22 @@ GEM
|
|
20
21
|
net-ssh (>= 2.6.5)
|
21
22
|
net-ssh (2.9.1)
|
22
23
|
rake (10.3.2)
|
23
|
-
rspec (
|
24
|
-
rspec-core (~>
|
25
|
-
rspec-expectations (~>
|
26
|
-
rspec-mocks (~>
|
27
|
-
rspec-core (
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
24
|
+
rspec (3.1.0)
|
25
|
+
rspec-core (~> 3.1.0)
|
26
|
+
rspec-expectations (~> 3.1.0)
|
27
|
+
rspec-mocks (~> 3.1.0)
|
28
|
+
rspec-core (3.1.7)
|
29
|
+
rspec-support (~> 3.1.0)
|
30
|
+
rspec-expectations (3.1.2)
|
31
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
32
|
+
rspec-support (~> 3.1.0)
|
33
|
+
rspec-mocks (3.1.3)
|
34
|
+
rspec-support (~> 3.1.0)
|
35
|
+
rspec-support (3.1.2)
|
36
|
+
sshkit (1.5.1)
|
37
|
+
colorize
|
32
38
|
net-scp (>= 1.1.2)
|
33
39
|
net-ssh (>= 2.8.0)
|
34
|
-
term-ansicolor
|
35
|
-
term-ansicolor (1.3.0)
|
36
|
-
tins (~> 1.0)
|
37
|
-
tins (1.3.0)
|
38
40
|
|
39
41
|
PLATFORMS
|
40
42
|
ruby
|
data/NEWS.md
CHANGED
@@ -1,7 +1,15 @@
|
|
1
|
-
## 0.
|
1
|
+
## 0.4.0 (2014-10-29)
|
2
|
+
|
3
|
+
* Change default for `:jenkins_artifact_file` to `*zip*/archive.zip` (h/t @lostintime on #22)
|
4
|
+
|
5
|
+
## 0.3.3 (2014-05-23)
|
2
6
|
|
3
7
|
* Fix bypassing of SSL verification using cURL (thanks @xsk)
|
4
8
|
|
9
|
+
## 0.3.2 (2014-05-21)
|
10
|
+
|
11
|
+
* Properly bump gem version (same changes as v0.3.1)
|
12
|
+
|
5
13
|
## 0.3.1 (2014-05-21)
|
6
14
|
|
7
15
|
* Ensure gemspec dependencies are properly set for Cap ~> 3.2.1
|
data/README.md
CHANGED
@@ -49,6 +49,9 @@ set :jenkins_pass, 'pass'
|
|
49
49
|
# Deploy a single file.
|
50
50
|
# set :jenkins_artifact_file, 'my-api/target/webapp.war'
|
51
51
|
#
|
52
|
+
# Deploy a specific build number
|
53
|
+
# set(:jenkins_build_number, ENV['REVISION']) if ENV['REVISION']
|
54
|
+
#
|
52
55
|
# Bypass SSL verification
|
53
56
|
# set :jenkins_insecure, true
|
54
57
|
```
|
data/lib/capistrano/jenkins.rb
CHANGED
@@ -63,31 +63,36 @@ class Capistrano::Jenkins < Capistrano::SCM
|
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
|
+
def artifact_is_zip?
|
67
|
+
artifact_ext == ".zip"
|
68
|
+
end
|
69
|
+
|
70
|
+
def artifact_file_opt
|
71
|
+
fetch(:jenkins_artifact_file, "*zip*/archive.zip")
|
72
|
+
end
|
73
|
+
|
66
74
|
def artifact_filename
|
67
|
-
@artifact_filename = File.basename(
|
75
|
+
@artifact_filename = File.basename(artifact_file_opt)
|
68
76
|
end
|
69
77
|
|
70
78
|
def artifact_ext
|
71
79
|
@artifact_ext = File.extname(artifact_filename)
|
72
80
|
end
|
73
81
|
|
74
|
-
def
|
75
|
-
|
76
|
-
|
82
|
+
def artifact_build_number_opt
|
83
|
+
fetch(:jenkins_build_number, 'lastBuild')
|
84
|
+
end
|
77
85
|
|
78
|
-
|
79
|
-
|
80
|
-
else
|
81
|
-
"#{artifact_url_prefix}/*zip*/archive.zip"
|
82
|
-
end
|
86
|
+
def artifact_build_number
|
87
|
+
@artifact_build_number ||= jenkins_api_res['number']
|
83
88
|
end
|
84
89
|
|
85
|
-
def
|
86
|
-
|
90
|
+
def artifact_url
|
91
|
+
"#{repo_url}/#{artifact_build_number_opt}/artifact/#{artifact_file_opt}"
|
87
92
|
end
|
88
93
|
|
89
94
|
def jenkins_api_res
|
90
|
-
jenkins_job_api_url = "#{repo_url}/
|
95
|
+
jenkins_job_api_url = "#{repo_url}/#{artifact_build_number_opt}/api/json"
|
91
96
|
|
92
97
|
res ||= open(jenkins_job_api_url, auth_opts.merge(ssl_opts)).read
|
93
98
|
|
@@ -107,6 +112,12 @@ class Capistrano::Jenkins < Capistrano::SCM
|
|
107
112
|
build_status = res['result'].downcase
|
108
113
|
|
109
114
|
if allowed_statuses.include? build_status
|
115
|
+
if artifact_is_zip?
|
116
|
+
unless test! "hash unzip 2>/dev/null"
|
117
|
+
abort 'unzip required, but not found'
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
110
121
|
true
|
111
122
|
else
|
112
123
|
abort 'Latest build status isn\'t green!'
|
@@ -128,11 +139,21 @@ class Capistrano::Jenkins < Capistrano::SCM
|
|
128
139
|
end
|
129
140
|
|
130
141
|
def release
|
131
|
-
|
142
|
+
downloaded_artifact = "#{fetch(:application)}#{artifact_ext}"
|
143
|
+
|
144
|
+
if artifact_is_zip?
|
145
|
+
# is an archive - unpack and deploy
|
146
|
+
context.execute :rm, "-rf \"out/\""
|
147
|
+
context.execute :unzip, "\"#{downloaded_artifact}\" -d out/"
|
148
|
+
context.execute :mv, "out/#{fetch(:jenkins_artifact_path, "*")} \"#{release_path}\""
|
149
|
+
context.execute :rm, "-rf \"out/\""
|
150
|
+
else
|
151
|
+
context.execute :cp, downloaded_artifact, release_path
|
152
|
+
end
|
132
153
|
end
|
133
154
|
|
134
155
|
def fetch_revision
|
135
|
-
"build
|
156
|
+
"build-#{artifact_build_number}"
|
136
157
|
end
|
137
158
|
end
|
138
159
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-scm-jenkins
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- LI Daobing
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-10-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: capistrano
|