winci 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/Gemfile +4 -0
- data/History.txt +4 -0
- data/PostInstall.txt +6 -0
- data/README.txt +61 -0
- data/Rakefile +2 -0
- data/examples/basic.rb +19 -0
- data/examples/extended.rb +24 -0
- data/examples/retrieving_info.rb +8 -0
- data/lib/winci.rb +5 -0
- data/lib/winci/jenkins_ext/job_config_builder.rb +9 -0
- data/lib/winci/job.rb +60 -0
- data/lib/winci/tasks.rb +10 -0
- data/lib/winci/version.rb +3 -0
- data/winci.gemspec +23 -0
- metadata +97 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/History.txt
ADDED
data/PostInstall.txt
ADDED
data/README.txt
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
winci
|
2
|
+
======
|
3
|
+
|
4
|
+
[WinCI] Simplifies mplementation of a full continuous deployment pipeline the Agile way with Jenkins/Hudson continuous integration server under Windows.
|
5
|
+
|
6
|
+
Install
|
7
|
+
=======
|
8
|
+
|
9
|
+
gem install winci
|
10
|
+
|
11
|
+
|
12
|
+
Introduction
|
13
|
+
=======
|
14
|
+
|
15
|
+
The purpose of this project is to simplify implementation of the full continuous deployment pipeline the Agile way with Jenkins/Hudson continuous integration server under Windows.
|
16
|
+
It will let Windows developers get quickly up and running with continuous deployment pipeline and
|
17
|
+
continuous integration by incorporating convention-over-configuration paradigm, so that the novice is first presented with
|
18
|
+
working setup with the click of a button and after he see it working and have overall empirical knowledge under his belt,
|
19
|
+
only then is he introduced to some configuration options.
|
20
|
+
|
21
|
+
WinCI is written in Ruby and uses Jenkins.rb gem to automate installation and interaction with Jenkins CI and also ruby-git gem to automate CI provisioning.
|
22
|
+
|
23
|
+
WinCI is intended to be be used in conjunction with WinCI-server, which is another gem containing functionality necessary
|
24
|
+
to setup Jenkins CI and enabling to create installation bundle used in provisioning process.
|
25
|
+
|
26
|
+
|
27
|
+
Usage
|
28
|
+
=====
|
29
|
+
|
30
|
+
First download and run WinCI-server.
|
31
|
+
Then you can start using this gem, first take a look at examples directory.
|
32
|
+
Keep in mind that so far this project is mostly a wrapper for functionality contained in Jenkins.rb gem,
|
33
|
+
so if you would like to create nodes in Jenkins or create rake build steps then you should look at Jenkins.rb gem's docs or API file.
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
License
|
38
|
+
=======
|
39
|
+
|
40
|
+
(The MIT License)
|
41
|
+
|
42
|
+
Copyright (c) 2011 Kamil Sobieraj, ksob\at\rubyforge.org
|
43
|
+
|
44
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
45
|
+
a copy of this software and associated documentation files (the
|
46
|
+
'Software'), to deal in the Software without restriction, including
|
47
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
48
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
49
|
+
permit persons to whom the Software is furnished to do so, subject to
|
50
|
+
the following conditions:
|
51
|
+
|
52
|
+
The above copyright notice and this permission notice shall be
|
53
|
+
included in all copies or substantial portions of the Software.
|
54
|
+
|
55
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
56
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
57
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
58
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
59
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
60
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
61
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
data/examples/basic.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'jenkins'
|
2
|
+
require 'winci'
|
3
|
+
|
4
|
+
project_name = 'files'
|
5
|
+
|
6
|
+
cfg = Jenkins::JobConfigBuilder.new(:ruby) do |c|
|
7
|
+
c.scm = "C:/repos/#{project_name}.git"
|
8
|
+
c.steps = [
|
9
|
+
# below makes sense when your Rakefile run rspec/cucumber by default
|
10
|
+
[:build_bat_step, "bundle exec rake"],
|
11
|
+
# this will send current code to production repo only after rspec/cucumber passed
|
12
|
+
[:build_bat_step, "git push c:/repos/production/files.git HEAD:master"]
|
13
|
+
]
|
14
|
+
end
|
15
|
+
|
16
|
+
job = WinCI::Job.new project_name, cfg
|
17
|
+
|
18
|
+
# by default creates job on localhost:3010
|
19
|
+
job.create
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'jenkins'
|
2
|
+
require 'winci'
|
3
|
+
|
4
|
+
project_name = 'files'
|
5
|
+
|
6
|
+
cfg = Jenkins::JobConfigBuilder.new(:ruby) do |c|
|
7
|
+
c.scm = "C:/repos/#{project_name}.git"
|
8
|
+
c.steps = [
|
9
|
+
# in this way we can ensure that the PATH is the same as in production environment
|
10
|
+
[:build_shell_step, "export PATH=C:/Ruby/bin;\r\n" + "echo PATH is now : $PATH"],
|
11
|
+
# then we can run some installation script
|
12
|
+
[:build_bat_step, "ruby install.rb"],
|
13
|
+
# see basic.rb
|
14
|
+
[:build_bat_step, "bundle exec rake"],
|
15
|
+
# some adjustments to git before pushing
|
16
|
+
[:build_bat_step, "git config core.hidedotfiles false"],
|
17
|
+
# see basic.rb
|
18
|
+
[:build_bat_step, "git push c:/repos/production/files.git HEAD:master"]
|
19
|
+
]
|
20
|
+
end
|
21
|
+
|
22
|
+
job = WinCI::Job.new project_name, cfg
|
23
|
+
|
24
|
+
job.create '192.168.1.10', '3010'
|
data/lib/winci.rb
ADDED
data/lib/winci/job.rb
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require 'jenkins'
|
3
|
+
require 'winci/jenkins_ext/job_config_builder'
|
4
|
+
|
5
|
+
module WinCI
|
6
|
+
|
7
|
+
class Job
|
8
|
+
attr_accessor :project_name, :config
|
9
|
+
|
10
|
+
def initialize(project_name='files', config=std_config)
|
11
|
+
@project_name = project_name
|
12
|
+
@config = config
|
13
|
+
end
|
14
|
+
|
15
|
+
def std_config
|
16
|
+
Jenkins::JobConfigBuilder.new(:ruby) do |c|
|
17
|
+
c.scm = "C:/repos/files.git"
|
18
|
+
c.steps = [
|
19
|
+
[:build_bat_step, "bundle exec rake"],
|
20
|
+
[:build_bat_step, "git push C:/repos/production/files.git HEAD:master"]
|
21
|
+
]
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
def create server='127.0.0.1', port='3010'
|
27
|
+
Jenkins::Api.setup_base_url(:host => server, :port => port)
|
28
|
+
|
29
|
+
if Jenkins::Api.create_job(name=@project_name, @config, options = {:override => true}) == true
|
30
|
+
puts "#{@project_name} project created on jenkins"
|
31
|
+
else
|
32
|
+
puts "#{@project_name} project not created, something gone wrong or it already exist"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def last_successful_build
|
37
|
+
Jenkins::Api.job(@project_name)["lastSuccessfulBuild"]
|
38
|
+
end
|
39
|
+
|
40
|
+
def get_build_sha build
|
41
|
+
# Retrieve information about the actual build, and grab the last built revision out of it
|
42
|
+
build_info = Jenkins::Api.get("/job/#{@project_name}/#{build["number"]}/api/json")
|
43
|
+
build_info['actions'].detect { |h| h["lastBuiltRevision"] }["lastBuiltRevision"]["SHA1"]
|
44
|
+
end
|
45
|
+
|
46
|
+
def last_successful_build_sha
|
47
|
+
if last_successful_build
|
48
|
+
return get_build_sha last_successful_build
|
49
|
+
else
|
50
|
+
raise 'There is none successful build yet!'
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def provide_build(build=last_successful_build_sha, environments=['production'])
|
55
|
+
# TODO provide this build to selected environments
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
data/lib/winci/tasks.rb
ADDED
data/winci.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "winci/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "winci"
|
7
|
+
s.version = WinCI::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Kamil Sobieraj"]
|
10
|
+
s.email = ["ksob@rubyforge.org"]
|
11
|
+
s.homepage = ""
|
12
|
+
s.summary = %q{Simplifies continuous integration under Windows}
|
13
|
+
s.description = %q{Implements full continuous deployment pipeline the Agile way with Jenkins/Hudson continuous integration server under Windows.}
|
14
|
+
|
15
|
+
s.rubyforge_project = "winci"
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
+
s.require_paths = ["lib"]
|
21
|
+
|
22
|
+
s.add_dependency('jenkins', '>= 0.6.2')
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: winci
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Kamil Sobieraj
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-04-30 00:00:00 +02:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: jenkins
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
- 6
|
33
|
+
- 2
|
34
|
+
version: 0.6.2
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id001
|
37
|
+
description: Implements full continuous deployment pipeline the Agile way with Jenkins/Hudson continuous integration server under Windows.
|
38
|
+
email:
|
39
|
+
- ksob@rubyforge.org
|
40
|
+
executables: []
|
41
|
+
|
42
|
+
extensions: []
|
43
|
+
|
44
|
+
extra_rdoc_files: []
|
45
|
+
|
46
|
+
files:
|
47
|
+
- .gitignore
|
48
|
+
- Gemfile
|
49
|
+
- History.txt
|
50
|
+
- PostInstall.txt
|
51
|
+
- README.txt
|
52
|
+
- Rakefile
|
53
|
+
- examples/basic.rb
|
54
|
+
- examples/extended.rb
|
55
|
+
- examples/retrieving_info.rb
|
56
|
+
- lib/winci.rb
|
57
|
+
- lib/winci/jenkins_ext/job_config_builder.rb
|
58
|
+
- lib/winci/job.rb
|
59
|
+
- lib/winci/tasks.rb
|
60
|
+
- lib/winci/version.rb
|
61
|
+
- winci.gemspec
|
62
|
+
has_rdoc: true
|
63
|
+
homepage: ""
|
64
|
+
licenses: []
|
65
|
+
|
66
|
+
post_install_message:
|
67
|
+
rdoc_options: []
|
68
|
+
|
69
|
+
require_paths:
|
70
|
+
- lib
|
71
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
hash: 3
|
77
|
+
segments:
|
78
|
+
- 0
|
79
|
+
version: "0"
|
80
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
hash: 3
|
86
|
+
segments:
|
87
|
+
- 0
|
88
|
+
version: "0"
|
89
|
+
requirements: []
|
90
|
+
|
91
|
+
rubyforge_project: winci
|
92
|
+
rubygems_version: 1.5.2
|
93
|
+
signing_key:
|
94
|
+
specification_version: 3
|
95
|
+
summary: Simplifies continuous integration under Windows
|
96
|
+
test_files: []
|
97
|
+
|