jenkins-builder 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +30 -0
- data/lib/jenkins/builder/app.rb +19 -0
- data/lib/jenkins/builder/config.rb +6 -0
- data/lib/jenkins/builder/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa73cdb92828d5e151cc9a8b78c72a8541383c86600576b9d706247413c7dc4c
|
4
|
+
data.tar.gz: 16ff0f621a460a3866cc1d5ed79b485ac694877400bdfa5a0a80b0498cd8db05
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57b091506ea5e682173a4246c876b06d810c29f26ab89756c01a9ad26593d034cce4d7850b114bcad3fa8f5154e70485aa14a40d57f9169ea427d0af155449cc
|
7
|
+
data.tar.gz: f33aedd9b5e1b8755f6a9e02db5b50ce06cc24a43cd1d9870816fe7812ef01b866e7db1915f4a33ec592948b9a4fa9989b9c01f2e1780475471d98f590326242
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -92,6 +92,36 @@ it's equivalent to run `jk build project1:origin/develop`
|
|
92
92
|
#### Delete an alias
|
93
93
|
|
94
94
|
$ jk unalias p1
|
95
|
+
|
96
|
+
### Hooks
|
97
|
+
|
98
|
+
You can add hooks into configuration, which will be executed after a job build finished, the console output will be sent to the hook process as STDIN. See Config Example.
|
99
|
+
|
100
|
+
|
101
|
+
### Config Example
|
102
|
+
|
103
|
+
```
|
104
|
+
---
|
105
|
+
url: http://jenkins.example.com
|
106
|
+
username: lululau
|
107
|
+
branches:
|
108
|
+
- origin/develop
|
109
|
+
- origin/staging
|
110
|
+
- origin/master
|
111
|
+
aliases:
|
112
|
+
kd: build kubernetes:origin/develop
|
113
|
+
km: build kubernetes:origin/master
|
114
|
+
lc: build linux_core
|
115
|
+
hooks:
|
116
|
+
linux_core: "ssh my_server 'cd /var/logs/ && tail -f $(ls -t | head -1)'"
|
117
|
+
kubernetes: "/my/local/machine/clean.sh"
|
118
|
+
jobs-cache:
|
119
|
+
expire: '2018-12-16 11:25:11'
|
120
|
+
jobs:
|
121
|
+
- kubernetes
|
122
|
+
- linux_core
|
123
|
+
- my_e_shop
|
124
|
+
```
|
95
125
|
|
96
126
|
## Development
|
97
127
|
|
data/lib/jenkins/builder/app.rb
CHANGED
@@ -149,8 +149,12 @@ module Jenkins
|
|
149
149
|
spinner = TTY::Spinner.new(':spinner Building ...', format: :bouncing_ball)
|
150
150
|
spinner.auto_spin
|
151
151
|
end
|
152
|
+
|
153
|
+
all_console_output = ''
|
154
|
+
|
152
155
|
loop do
|
153
156
|
console_output = @client.job.get_console_output(job_name, build_no, printed_size, 'text')
|
157
|
+
all_console_output << console_output['output']
|
154
158
|
print console_output['output'].gsub("\r", '') unless @options[:silent]
|
155
159
|
printed_size += console_output['size'].to_i
|
156
160
|
break unless console_output['more']
|
@@ -168,6 +172,21 @@ module Jenkins
|
|
168
172
|
puts pastel.red.bold(msg)
|
169
173
|
end
|
170
174
|
|
175
|
+
if hooks = @config.hooks_of(job_name)
|
176
|
+
hooks.each do |hook|
|
177
|
+
puts pastel.green('Execute hook: "%s"' % hook)
|
178
|
+
begin
|
179
|
+
IO.popen(hook, 'r+') do |process|
|
180
|
+
process.print(all_console_output)
|
181
|
+
process.each { |line| print line }
|
182
|
+
end
|
183
|
+
rescue Interrupt
|
184
|
+
puts
|
185
|
+
puts pastel.red('User Canceld hook: "%s"' % hook)
|
186
|
+
end
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
171
190
|
msg =~ /SUCCESS/
|
172
191
|
end
|
173
192
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jenkins-builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Liu Xiang
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-11-
|
11
|
+
date: 2018-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|