jenkins2-api 1.0.13 → 1.0.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +28 -0
- data/lib/commands/job.rb +7 -0
- data/lib/endpoints/job.rb +22 -0
- data/lib/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb7adfa9fee666dfd820c9335817339c5811050a
|
4
|
+
data.tar.gz: 935de4c49948e3366d473d3d9939b8b3f5d8ba1f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 039408941cef2b5ea1cb82305cd2fd966fa2e7b8c1a8593ce9590f120935890cfae8b08bbb3ccc84681fe9f8b7c24a49e14bcef42e3c2ecac4a240cace5236a5
|
7
|
+
data.tar.gz: 7c2d3d47d2f2edb6694643075a4bfbcd5a1c1e37510ac960d32781e2c273d8ebe7e52d50cdb964d13ae918e681f3e2ff24d42236f5f6995439b18790daa30108
|
data/README.md
CHANGED
@@ -123,3 +123,31 @@ failed_tests.each do |failed|
|
|
123
123
|
puts " [✘] #{failed['name']} on #{failed['classname']}"
|
124
124
|
end
|
125
125
|
```
|
126
|
+
|
127
|
+
#### List and Install plugins
|
128
|
+
|
129
|
+
```
|
130
|
+
p client.configuration.plugin_list
|
131
|
+
|
132
|
+
client.configuration.plugin_install(
|
133
|
+
'Blue Ocean Pipeline Editor', # Plugin name
|
134
|
+
'blueocean-pipeline-editor' # Plugin ID
|
135
|
+
)
|
136
|
+
|
137
|
+
# Safe restart our jenkins master when all plugins are installed.
|
138
|
+
client.configuration.safe_restart
|
139
|
+
```
|
140
|
+
|
141
|
+
#### Trigger a build
|
142
|
+
|
143
|
+
```
|
144
|
+
client.job.build('test-project', { GIT_BRANCH: 'experiment' })
|
145
|
+
client.job.build('test-project-clone')
|
146
|
+
```
|
147
|
+
|
148
|
+
From CLI
|
149
|
+
|
150
|
+
```
|
151
|
+
jenkins2api job build test-project-clone
|
152
|
+
jenkins2api job build test-project --params=GIT_BRANCH:experiment GIT_REPO:customrepo
|
153
|
+
```
|
data/lib/commands/job.rb
CHANGED
@@ -5,6 +5,13 @@ module Jenkins2API
|
|
5
5
|
module Command
|
6
6
|
# Contains all the commands under +job+ namespace
|
7
7
|
class Job < Jenkins2API::ThorCommand
|
8
|
+
desc 'build JOB_NAME', 'Start a build for a specific job'
|
9
|
+
method_option :params, default: {}, type: :hash
|
10
|
+
method_option :delay, default: 0, type: :numeric
|
11
|
+
# Start a build
|
12
|
+
def build(name)
|
13
|
+
client.job.build(name, options[:params], options[:delay])
|
14
|
+
end
|
8
15
|
end
|
9
16
|
end
|
10
17
|
end
|
data/lib/endpoints/job.rb
CHANGED
@@ -31,6 +31,28 @@ module Jenkins2API
|
|
31
31
|
@client.api_request(:get, "/job/#{name}")['builds']
|
32
32
|
end
|
33
33
|
|
34
|
+
# Trigger a build on a specific job
|
35
|
+
#
|
36
|
+
# ==== Params:
|
37
|
+
# +name+:: Name of the job
|
38
|
+
# +parameters+:: Hash with build parameters,
|
39
|
+
# key => valule pairs
|
40
|
+
# +delay+:: Delay the build in seconds
|
41
|
+
def build(name, parameters = {}, delay = 0)
|
42
|
+
post = { parameter: [] }
|
43
|
+
parameters.each do |key, value|
|
44
|
+
post[:parameter] << { name: key, value: value }
|
45
|
+
end
|
46
|
+
|
47
|
+
@client.api_request(
|
48
|
+
:post,
|
49
|
+
"/job/#{name}/build?delay=#{delay}sec",
|
50
|
+
:raw,
|
51
|
+
json: post.to_json
|
52
|
+
)
|
53
|
+
end
|
54
|
+
|
55
|
+
# Compatibility with jenkins-api gem (for Jenkins1)
|
34
56
|
alias get_builds builds
|
35
57
|
end
|
36
58
|
end
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jenkins2-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Balazs Nadasdi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05-
|
11
|
+
date: 2017-05-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -158,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
158
158
|
version: '0'
|
159
159
|
requirements: []
|
160
160
|
rubyforge_project:
|
161
|
-
rubygems_version: 2.
|
161
|
+
rubygems_version: 2.6.11
|
162
162
|
signing_key:
|
163
163
|
specification_version: 4
|
164
164
|
summary: API client for Jenkins 2.
|