bumperok 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Manifest.txt +1 -0
- data/Rakefile +1 -0
- data/bin/bumper +23 -2
- data/config/jenkins.yml +27 -0
- data/lib/bumper.rb +24 -1
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af6cce691f8bbb11bb6223153036ce906064cbfe
|
4
|
+
data.tar.gz: fd99cf9b4a93c5815f179d0ff176c9def9264f25
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4262d79427ebe11ac83178ad34a39085d7bf9a11a7aaa951cbb2be26feae421b894b55d1dba0670049737d3ae223d5e3ae263a94265aa24780cbbe6daf7aaf59
|
7
|
+
data.tar.gz: 1353a73524664b47014b83dcc740baec91bdd11a5a089ca100a140d07eb907b13a5671c8419b4cdb357d328e73a7318a764ce7cc83a21f30a040ed17a56e6201
|
data/Manifest.txt
CHANGED
data/Rakefile
CHANGED
data/bin/bumper
CHANGED
@@ -21,14 +21,35 @@ OptionParser.new do |opts|
|
|
21
21
|
options.git_path = g
|
22
22
|
end
|
23
23
|
|
24
|
+
opts.on("-pPROJECT", "--project-name=PROJECT", "Project name for jenkins prefix") do |p|
|
25
|
+
options.project_name = p
|
26
|
+
end
|
27
|
+
|
28
|
+
opts.on("-sGIT_URL", "--git-url=GIT_URL", "Access url to git server") do |g|
|
29
|
+
options.git_url = g
|
30
|
+
end
|
31
|
+
|
32
|
+
opts.on("-mSUBMODULE", "--git-submodule=SUBMODULE", "The name of git submodule") do |m|
|
33
|
+
options.git_submodule = m
|
34
|
+
end
|
35
|
+
|
24
36
|
end.parse!
|
25
37
|
|
26
|
-
|
38
|
+
case options.cmd
|
39
|
+
when 'tag'
|
27
40
|
if options.tag and options.git_path
|
28
41
|
Bumper.tag options.git_path, options.tag
|
29
42
|
else
|
30
43
|
p "Bad options"
|
31
44
|
end
|
32
|
-
|
45
|
+
when 'build'
|
46
|
+
if options.project_name
|
47
|
+
print Bumper.jenkins_build_number(options.project_name)
|
48
|
+
end
|
49
|
+
when 'submodule'
|
50
|
+
if options.git_url and options.git_submodule
|
51
|
+
Bumper.submodule_update_version(options.git_submodule, options.git_submodule, options.git_url)
|
52
|
+
end
|
53
|
+
eelse
|
33
54
|
raise "#{options.cmd} is unsupported command"
|
34
55
|
end
|
data/config/jenkins.yml
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# The Jenkins server and login information can be stored in a YAML file like this
|
2
|
+
# so we don't have to pass in the parameters every we login to the server
|
3
|
+
# through this API client.
|
4
|
+
|
5
|
+
# This file contains the following four parameters
|
6
|
+
|
7
|
+
# The IP address of the Jenkins CI Server
|
8
|
+
|
9
|
+
:server_ip: 0.0.0.0
|
10
|
+
|
11
|
+
# The port number on which the Jenkins listens on. The default is 8080
|
12
|
+
|
13
|
+
:server_port: 8080
|
14
|
+
|
15
|
+
# If there is a web server routing your Jenkins requests you might need this
|
16
|
+
|
17
|
+
:jenkins_path: ""
|
18
|
+
|
19
|
+
# The username and password to authenticate to the server
|
20
|
+
|
21
|
+
:username: my_username
|
22
|
+
|
23
|
+
:password: my_password
|
24
|
+
|
25
|
+
# The private key file for Jenkins CLI authentication
|
26
|
+
# remember to upload the public key to http://#{server_ip}:#{server_port}/user/#{my_username}/configure
|
27
|
+
:identity_file: ~/.ssh/id_rsa
|
data/lib/bumper.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
require 'git'
|
2
2
|
require 'logger'
|
3
3
|
require 'git-ssh-wrapper'
|
4
|
+
require 'jenkins_api_client'
|
4
5
|
|
5
6
|
class Bumper
|
6
|
-
VERSION = "0.0.
|
7
|
+
VERSION = "0.0.3"
|
7
8
|
|
8
9
|
def self.tag git_path, tag_name
|
9
10
|
wrapper = GitSSHWrapper.with_wrapper(private_key_path: '~/.ssh/bumber_at_sibext', log_level: 'ERROR') do |w|
|
@@ -12,5 +13,27 @@ class Bumper
|
|
12
13
|
`git '--git-dir=#{git_path}/.git' '--work-tree=#{git_path}' push '--force' 'origin' 'refs/tags/#{tag_name}'`
|
13
14
|
end
|
14
15
|
end
|
16
|
+
|
17
|
+
def self.jenkins_build_number job_name
|
18
|
+
@client = JenkinsApi::Client.new YAML.load_file(File.expand_path("../config/jenkins.yml", __FILE__))
|
19
|
+
@client.logger = Logger.new('jenkins_build_number.log', 10, 1024000)
|
20
|
+
begin
|
21
|
+
number = @client.job.get_current_build_number(job_name)
|
22
|
+
rescue JenkinsApi::Exceptions::NotFound => e
|
23
|
+
end
|
24
|
+
number
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.submodule_update_version display, name, git
|
28
|
+
wrapper = GitSSHWrapper.with_wrapper(private_key_path: '~/.ssh/bumber_at_sibext', log_level: 'ERROR') do |w|
|
29
|
+
w.set_env
|
30
|
+
`rm -Rf git_with_submodule`
|
31
|
+
`git clone --recursive #{git} git_with_submodule`
|
32
|
+
`git submodule update --remote #{name}`
|
33
|
+
`git checkout -b UpdateFrom#{display}`
|
34
|
+
`git commit -am'New updates from #{display}'`
|
35
|
+
`git push -f origin UpdateFrom#{display}`
|
36
|
+
end
|
15
37
|
|
38
|
+
end
|
16
39
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bumperok
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nikolay Moskvin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: git
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0.2'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: jenkins_api_client
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.2'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.2'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: rdoc
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,6 +100,7 @@ files:
|
|
86
100
|
- README.txt
|
87
101
|
- Rakefile
|
88
102
|
- bin/bumper
|
103
|
+
- config/jenkins.yml
|
89
104
|
- lib/bumper.rb
|
90
105
|
- test/test_bumper.rb
|
91
106
|
homepage: http://git.sibext.com/snacks/bumper
|