fastlane-plugin-update_jenkins_build 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -0
- data/lib/fastlane/plugin/update_jenkins_build/actions/update_jenkins_build_action.rb +16 -7
- data/lib/fastlane/plugin/update_jenkins_build/helper/update_jenkins_build_helper.rb +12 -0
- data/lib/fastlane/plugin/update_jenkins_build/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 379bae5a03fd9f67c520ff6d51c1bf28f2aefbee8c7d97437e9b657a699c388a
|
4
|
+
data.tar.gz: 85c42f4ff0ae2c6e7466ea7b5a47fdfb1dc9dafc0cfdce7cca45f8d4d6ea6e82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a63f53734a4ca7a874434326ffa2b09e8de5f870172b5b1df99b516a35f4b72bc1125be221869cf1cd994a3eff21827c30eda0724f14f9fcd1939dce0a59124
|
7
|
+
data.tar.gz: 985c794df73f7975877a2304fe076504f36a461bbf2ef4c0adb808d64032a6a27ccad942b2df24c434a5889558580ab083cceab15414481f79f80e92794a7f62
|
data/README.md
CHANGED
@@ -10,6 +10,15 @@ This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To
|
|
10
10
|
fastlane add_plugin update_jenkins_build
|
11
11
|
```
|
12
12
|
|
13
|
+
![screenshot](screenshot.png)
|
14
|
+
|
15
|
+
### Configure Jenkins
|
16
|
+
|
17
|
+
⚠️ **READ ME FRIST**
|
18
|
+
|
19
|
+
Jenkins version below 2.221, you need disable CSRF Protection in Global Security Settings page or
|
20
|
+
else you must append '-Dhudson.security.csrf.GlobalCrumbIssuerConfiguration.DISABLE_CSRF_PROTECTION=true' into Jenkins startup argument, [Check more details](https://github.com/icyleaf/fastlane-plugin-update_jenkins_build/issues/2).
|
21
|
+
|
13
22
|
## About update_jenkins_build
|
14
23
|
|
15
24
|
Update build's description of jenkins.
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'fastlane/action'
|
2
2
|
require_relative '../helper/update_jenkins_build_helper'
|
3
|
+
require 'rubygems'
|
3
4
|
require 'http'
|
4
5
|
require 'uri'
|
5
6
|
|
@@ -25,15 +26,14 @@ module Fastlane
|
|
25
26
|
})
|
26
27
|
end
|
27
28
|
|
28
|
-
|
29
|
-
|
30
|
-
else
|
31
|
-
"#{res.code} fail"
|
32
|
-
end
|
29
|
+
# Submit form succesed it will 302 to the build url.
|
30
|
+
result = res.code == 302 ? 'success' : "#{res.code} fail"
|
33
31
|
|
32
|
+
jenkins_version = Helper::UpdateJenkinsBuildHelper.jenkins_version(@url, @user, @password)
|
34
33
|
params = {
|
35
34
|
title: "Summary for update_jenkins_build #{UpdateJenkinsBuild::VERSION}".green,
|
36
35
|
rows: {
|
36
|
+
jenkins_version: jenkins_version,
|
37
37
|
result: result,
|
38
38
|
url: "#{base_uri}/editDescription",
|
39
39
|
auth: @user ? true : false,
|
@@ -41,9 +41,18 @@ module Fastlane
|
|
41
41
|
}
|
42
42
|
}
|
43
43
|
|
44
|
-
puts ""
|
45
44
|
puts Terminal::Table.new(params)
|
46
|
-
|
45
|
+
|
46
|
+
if res.code != 302
|
47
|
+
UI.error "Detect `update_jenkins_build` ran fail."
|
48
|
+
if jenkins_version && Gem::Version.new(jenkins_version) > Gem::Version.new('2.221')
|
49
|
+
UI.error "Because Jenkins v#{jenkins_version} removed 'disable CSRF Protection' option since 2.222,"
|
50
|
+
UI.error "You need append '-Dhudson.security.csrf.GlobalCrumbIssuerConfiguration.DISABLE_CSRF_PROTECTION=true' into Jenkins startup argument."
|
51
|
+
UI.error "Please check https://github.com/icyleaf/fastlane-plugin-update_jenkins_build/issues/2"
|
52
|
+
else
|
53
|
+
UI.error "Please 'disable CSRF Protection' in 'Global Security Settings' page from Jenkins."
|
54
|
+
end
|
55
|
+
end
|
47
56
|
|
48
57
|
[result, res.body]
|
49
58
|
end
|
@@ -5,6 +5,18 @@ module Fastlane
|
|
5
5
|
|
6
6
|
module Helper
|
7
7
|
class UpdateJenkinsBuildHelper
|
8
|
+
|
9
|
+
def self.jenkins_version(url, user, password)
|
10
|
+
url = "#{url}/api/json"
|
11
|
+
res = if user && password
|
12
|
+
HTTP.basic_auth(user: user, pass: password)
|
13
|
+
.get(url)
|
14
|
+
else
|
15
|
+
HTTP.get(url)
|
16
|
+
end
|
17
|
+
|
18
|
+
res.headers['X-Jenkins']
|
19
|
+
end
|
8
20
|
end
|
9
21
|
end
|
10
22
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-update_jenkins_build
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- icyleaf
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|
@@ -195,8 +195,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
195
195
|
- !ruby/object:Gem::Version
|
196
196
|
version: '0'
|
197
197
|
requirements: []
|
198
|
-
|
199
|
-
rubygems_version: 2.7.3
|
198
|
+
rubygems_version: 3.0.6
|
200
199
|
signing_key:
|
201
200
|
specification_version: 4
|
202
201
|
summary: Update Description of Build
|