capistrano-scm-bamboo 1.0.4 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +21 -42
- data/lib/capistrano-scm-bamboo/version.rb +1 -1
- data/lib/capistrano/recipes/deploy/scm/bamboo.rb +0 -107
- data/spec/capistrano/recipes/deploy/scm/bamboo_spec.rb +0 -22
- metadata +10 -11
- data/NEWS.md +0 -13
data/README.md
CHANGED
@@ -1,52 +1,31 @@
|
|
1
|
-
# capistrano-scm-
|
1
|
+
# capistrano-scm-bamboo
|
2
2
|
|
3
|
-
With this plugin, you can use
|
4
|
-
deploy your build
|
3
|
+
With this plugin, you can use Atlassian Bamboo build artifacts as a repository,
|
4
|
+
and deploy your build with Capistrano.
|
5
5
|
|
6
6
|
## INSTALL
|
7
7
|
|
8
|
-
gem install capistrano-scm-
|
8
|
+
gem install capistrano-scm-bamboo
|
9
9
|
|
10
10
|
## USAGE
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
require 'capistrano-scm-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
#
|
30
|
-
# if you use netrc, add the following line in your $HOME/.netrc
|
31
|
-
# machine jenkins.example.com login USERNAME password secret
|
32
|
-
|
33
|
-
|
34
|
-
set :user, 'lidaobing'
|
35
|
-
set :use_sudo, false
|
36
|
-
set :deploy_to, "/home/#{user}/apps/#{application}"
|
37
|
-
|
38
|
-
role :web, "test.example.com" # Your HTTP server, Apache/etc
|
39
|
-
role :app, "test.example.com" # This may be the same as your `Web` server
|
40
|
-
role :db, "test.example.com", :primary => true # This is where Rails migrations will run
|
41
|
-
|
42
|
-
for more information about capistrano, check https://github.com/capistrano/capistrano
|
43
|
-
|
44
|
-
### maven module
|
45
|
-
|
46
|
-
for the maven module, you should include the module name in your repository url. for example:
|
47
|
-
|
48
|
-
set :repository, "http://jenkins.example.com/job/example/com.example.helloworld$helloworld/"
|
49
|
-
|
12
|
+
Sample extract from config/deploy.rb
|
13
|
+
|
14
|
+
require 'capistrano-scm-bamboo'
|
15
|
+
|
16
|
+
set :application, "example"
|
17
|
+
|
18
|
+
set :scm, bamboo
|
19
|
+
set :repository, "http://bamboo.local/rest/api/latest"
|
20
|
+
|
21
|
+
set :scm_username, ENV['CAP_BUILD_USER'] || "build"
|
22
|
+
set :scm_passphrase, ENV['CAP_BUILD_PASS'] || Proc.new { Capistrano::CLI.password_prompt("Please enter the Bamboo password for '#{scm_username}': ") }
|
23
|
+
|
24
|
+
# If calling Cap from within Bamboo, these can be passed via -s options on the Cap call itself to override
|
25
|
+
set :plan_key, "PROJECT-PLAN"
|
26
|
+
set :build_number, "latest"
|
27
|
+
set :artifact, "artifact"
|
28
|
+
|
50
29
|
## LICENSE
|
51
30
|
|
52
31
|
Permission is hereby granted, free of charge, to any person obtaining
|
@@ -42,113 +42,6 @@ module Capistrano
|
|
42
42
|
logger.info 'bamboo does not support diff'
|
43
43
|
'true'
|
44
44
|
end
|
45
|
-
|
46
|
-
private
|
47
|
-
|
48
|
-
# def authentication
|
49
|
-
# if variable(:jenkins_use_netrc)
|
50
|
-
# "--netrc"
|
51
|
-
# elsif variable(:scm_username) and variable(:scm_password)
|
52
|
-
# "--user '#{variable(:scm_username)}:#{variable(:scm_password)}'"
|
53
|
-
# else
|
54
|
-
# ""
|
55
|
-
# end
|
56
|
-
# end
|
57
|
-
|
58
|
-
# def use_unstable?
|
59
|
-
# !!variable(:jenkins_use_unstable)
|
60
|
-
# end
|
61
|
-
|
62
|
-
# def log_build_message(from, to=nil, message=nil)
|
63
|
-
# message = rss_all if message.nil?
|
64
|
-
# doc = REXML::Document.new(message).root
|
65
|
-
# logger.info ''
|
66
|
-
# logger.info "BUILD LOG"
|
67
|
-
# logger.info '========='
|
68
|
-
# REXML::XPath.each(doc,"./entry") do |entry|
|
69
|
-
# title = REXML::XPath.first(entry, "./title").text
|
70
|
-
# time = REXML::XPath.first(entry, "./updated").text
|
71
|
-
# build_number = get_build_number_from_rss_all_title(title).to_i
|
72
|
-
# if build_number > from.to_i and (to.nil? or build_number <= to.to_i)
|
73
|
-
# logger.info "#{time}\t#{title}"
|
74
|
-
# end
|
75
|
-
# end
|
76
|
-
# end
|
77
|
-
|
78
|
-
# def log_scm_message(from, to=nil, message=nil)
|
79
|
-
# message = rss_changelog if message.nil?
|
80
|
-
# doc = REXML::Document.new(message).root
|
81
|
-
# logger.info "SCM LOG"
|
82
|
-
# logger.info '======='
|
83
|
-
# REXML::XPath.each(doc,"./entry") do |entry|
|
84
|
-
# title = REXML::XPath.first(entry, "./title").text
|
85
|
-
# time = REXML::XPath.first(entry, "./updated").text
|
86
|
-
# content = REXML::XPath.first(entry, "./content").text
|
87
|
-
# build_number = get_build_number_from_rss_changelog_title(title).to_i
|
88
|
-
# if build_number > from.to_i and (to.nil? or build_number <= to.to_i)
|
89
|
-
# logger.info "#{time}\t#{title}"
|
90
|
-
# logger.info "#{content}"
|
91
|
-
# end
|
92
|
-
# end
|
93
|
-
# end
|
94
|
-
|
95
|
-
# def last_deploy_build(message = nil, opts={})
|
96
|
-
# message = rss_all if message.nil?
|
97
|
-
# use_unstable = opts[:use_unstable]
|
98
|
-
# use_unstable = use_unstable? if use_unstable.nil?
|
99
|
-
# doc = REXML::Document.new(message).root
|
100
|
-
# valid_end_strings = ['(back to normal)', '(stable)']
|
101
|
-
# if use_unstable
|
102
|
-
# valid_end_strings << '(unstable)'
|
103
|
-
# end
|
104
|
-
# REXML::XPath.each(doc,"./entry/title") do |title|
|
105
|
-
# title = title.text
|
106
|
-
# for x in valid_end_strings
|
107
|
-
# return get_build_number_from_rss_all_title(title) if title.end_with? x
|
108
|
-
# end
|
109
|
-
# end
|
110
|
-
# raise 'can not find a build suitable for deploy'
|
111
|
-
# end
|
112
|
-
|
113
|
-
# def auth_opts
|
114
|
-
# if jenkins_username and jenkins_password
|
115
|
-
# {:http_basic_authentication => [jenkins_username, jenkins_password]}
|
116
|
-
# else
|
117
|
-
# {}
|
118
|
-
# end
|
119
|
-
# end
|
120
|
-
|
121
|
-
# def artifact_zip_url(revision)
|
122
|
-
# "#{repository}/#{revision}/artifact/*zip*/archive.zip"
|
123
|
-
# end
|
124
|
-
|
125
|
-
# def jenkins_username
|
126
|
-
# @jenkins_username ||= begin
|
127
|
-
# if variable(:jenkins_use_netrc)
|
128
|
-
# rc = Net::Netrc.locate(jenkins_hostname)
|
129
|
-
# raise ".netrc missing or no entry found" if rc.nil?
|
130
|
-
# rc.login
|
131
|
-
# elsif variable(:scm_username)
|
132
|
-
# variable(:scm_username)
|
133
|
-
# else
|
134
|
-
# nil
|
135
|
-
# end
|
136
|
-
# end
|
137
|
-
# end
|
138
|
-
|
139
|
-
# def jenkins_password
|
140
|
-
# @jenkins_password ||= begin
|
141
|
-
# if variable(:jenkins_use_netrc)
|
142
|
-
# rc = Net::Netrc.locate(jenkins_hostname)
|
143
|
-
# raise ".netrc missing or no entry found" if rc.nil?
|
144
|
-
# rc.password
|
145
|
-
# elsif variable(:scm_password)
|
146
|
-
# variable(:scm_password)
|
147
|
-
# else
|
148
|
-
# nil
|
149
|
-
# end
|
150
|
-
# end
|
151
|
-
# end
|
152
45
|
end
|
153
46
|
end
|
154
47
|
end
|
@@ -6,27 +6,5 @@ module Capistrano::Deploy::SCM
|
|
6
6
|
before :each do
|
7
7
|
@bamboo = Bamboo.new
|
8
8
|
end
|
9
|
-
|
10
|
-
context "last_deploy_build" do
|
11
|
-
it "should support back to normal" do
|
12
|
-
msg = %Q{<?xml version="1.0" encoding="UTF-8"?>
|
13
|
-
<feed xmlns="http://www.w3.org/2005/Atom"><title>estore-nginx all builds</title><link type="text/html" href="http://ci.eb.in.sdo.com/view/eStore/job/estore-nginx/" rel="alternate"/><updated>2011-11-24T07:11:06Z</updated><author><name>Jenkins Server</name></author><id>urn:uuid:903deee0-7bfa-11db-9fe1-0800200c9a66</id><entry><title>estore-nginx #2 (back to normal)</title><link type="text/html" href="http://ci.eb.in.sdo.com/view/eStore/job/estore-nginx/2/" rel="alternate"/><id>tag:hudson.dev.java.net,2011:estore-nginx:2011-11-24_15-11-06</id><published>2011-11-24T07:11:06Z</published><updated>2011-11-24T07:11:06Z</updated></entry><entry><title>estore-nginx #1 (broken for a long time)</title><link type="text/html" href="http://ci.eb.in.sdo.com/view/eStore/job/estore-nginx/1/" rel="alternate"/><id>tag:hudson.dev.java.net,2011:estore-nginx:2011-11-24_15-09-18</id><published>2011-11-24T07:09:18Z</published><updated>2011-11-24T07:09:18Z</updated></entry></feed>}
|
14
|
-
@jenkins.send(:last_deploy_build, msg).should == '2'
|
15
|
-
end
|
16
|
-
|
17
|
-
it "should support stable" do
|
18
|
-
msg = %Q{<?xml version="1.0" encoding="UTF-8"?>
|
19
|
-
<feed xmlns="http://www.w3.org/2005/Atom"><title>cerl all builds</title><link type="text/html" href="http://ci.eb.in.sdo.com/view/eStore/job/cerl/" rel="alternate"/><updated>2011-11-17T05:17:58Z</updated><author><name>Jenkins Server</name></author><id>urn:uuid:903deee0-7bfa-11db-9fe1-0800200c9a66</id><entry><title>cerl #98 (stable)</title><link type="text/html" href="http://ci.eb.in.sdo.com/view/eStore/job/cerl/98/" rel="alternate"/><id>tag:hudson.dev.java.net,2011:cerl:2011-11-17_13-17-58</id><published>2011-11-17T05:17:58Z</published><updated>2011-11-17T05:17:58Z</updated></entry><entry><title>cerl #97 (stable)</title><link type="text/html" href="http://ci.eb.in.sdo.com/view/eStore/job/cerl/97/" rel="alternate"/><id>tag:hudson.dev.java.net,2011:cerl:2011-11-12_18-27-58</id><published>2011-11-12T10:27:58Z</published><updated>2011-11-12T10:27:58Z</updated></entry></feed>}
|
20
|
-
@jenkins.send(:last_deploy_build, msg).should == '98'
|
21
|
-
end
|
22
|
-
|
23
|
-
it "should honor unstable" do
|
24
|
-
msg = %Q{<?xml version="1.0" encoding="UTF-8"?>
|
25
|
-
<feed xmlns="http://www.w3.org/2005/Atom"><title>IndexCoordinator all builds</title><link type="text/html" href="http://ci.eb.in.sdo.com/job/IndexCoordinator/" rel="alternate"/><updated>2011-11-24T09:22:32Z</updated><author><name>Jenkins Server</name></author><id>urn:uuid:903deee0-7bfa-11db-9fe1-0800200c9a66</id><entry><title>IndexCoordinator #1450 (unstable)</title><link type="text/html" href="http://ci.eb.in.sdo.com/job/IndexCoordinator/1450/" rel="alternate"/><id>tag:hudson.dev.java.net,2011:IndexCoordinator:2011-11-22_19-44-23</id><published>2011-11-22T11:44:23Z</published><updated>2011-11-22T11:44:23Z</updated></entry><entry><title>IndexCoordinator #1449 (back to normal)</title><link type="text/html" href="http://ci.eb.in.sdo.com/job/IndexCoordinator/1449/" rel="alternate"/><id>tag:hudson.dev.java.net,2011:IndexCoordinator:2011-11-22_19-23-22</id><published>2011-11-22T11:23:22Z</published><updated>2011-11-22T11:23:22Z</updated></entry><entry><title>IndexCoordinator #1448 (broken since this build)</title><link type="text/html" href="http://ci.eb.in.sdo.com/job/IndexCoordinator/1448/" rel="alternate"/><id>tag:hudson.dev.java.net,2011:IndexCoordinator:2011-11-22_19-10-50</id><published>2011-11-22T11:10:50Z</published><updated>2011-11-22T11:10:50Z</updated></entry></feed>
|
26
|
-
}
|
27
|
-
@jenkins.send(:last_deploy_build, msg).should == '1449'
|
28
|
-
@jenkins.send(:last_deploy_build, msg, :use_unstable => true).should == '1450'
|
29
|
-
end
|
30
|
-
end
|
31
9
|
end
|
32
10
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-scm-bamboo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-04-
|
12
|
+
date: 2012-04-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: capistrano
|
16
|
-
requirement: &
|
16
|
+
requirement: &70260535479740 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70260535479740
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: json
|
27
|
-
requirement: &
|
27
|
+
requirement: &70260535479220 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70260535479220
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: typhoeus
|
38
|
-
requirement: &
|
38
|
+
requirement: &70260535495000 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70260535495000
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rspec
|
49
|
-
requirement: &
|
49
|
+
requirement: &70260535494340 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70260535494340
|
58
58
|
description: ! "\nWith this plugin, you can use Bamboo build artifacts as a repository,
|
59
59
|
and\ndeploy your build artifact with Capistrano.\n "
|
60
60
|
email:
|
@@ -67,7 +67,6 @@ files:
|
|
67
67
|
- .rspec
|
68
68
|
- Gemfile
|
69
69
|
- Gemfile.lock
|
70
|
-
- NEWS.md
|
71
70
|
- README.md
|
72
71
|
- Rakefile
|
73
72
|
- capistrano-scm-bamboo.gemspec
|