fastlane-plugin-update_jenkins_build 0.1.4 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 97103e6d6d332d6f40d11e45175040bad3be978c
4
- data.tar.gz: f168d93cff6a8217f9411255047c85cfe774ff58
2
+ SHA256:
3
+ metadata.gz: 05467a2ae78b51994f3c96e4952779432d1a017473ca3e6cef71185e868df21e
4
+ data.tar.gz: 02c971802b4b00e384a8ad8eeba2bc0277b3a036512744475b18a48b83ab7ceb
5
5
  SHA512:
6
- metadata.gz: 50fabbb72666689bf4ed48a44ccbc74f7ae257719532a9f4185cb72e58ff66911fc1ef14b86756c5998d5ae148549fe3a063011a8d768e671240749c4b36a3c7
7
- data.tar.gz: 6331ce118460695e45fb2949b3a5c3693a6cae686b8bfb54bc89906d07a00a3c3185fc8f7aad598841687b1303fc7a2cc005f32c2a29ffa8edc0b50e6e15764b
6
+ metadata.gz: 44a7414ad1b89f503a758b0da1ff4d6c588de466bb35fbf0c72ce066e7fda802961d3e5671c3e3e65400fe2ec2f62e8e38ea2c709b8ca9c71ed0f09ad6a287be
7
+ data.tar.gz: 312432f67a91c4f58a59b90deafe0e50aa08d292e450f28fb755e35c44e16a6ff509d55a198dce789c27eecc6f90f13715073771cc22d6d701c8a1ab28009f63
data/README.md CHANGED
@@ -22,6 +22,7 @@ $ bundle exec fastlane action update_jenkins_build
22
22
  | Key | Description | Env Var | Default |
23
23
  +--------------+---------------------------------------------+-----------------------------------+---------+
24
24
  | description | the description of current build | UPDATE_JENKINS_BUILD_DESCRIPTION | |
25
+ | url | the url of jenkins | UPDATE_JENKINS_BUILD_URL | |
25
26
  | project | the name of project(job) | UPDATE_JENKINS_BUILD_PROJECT | |
26
27
  | build_number | the build number of project(job) | UPDATE_JENKINS_BUILD_BUILD_NUMBER | |
27
28
  | user | the user of jenkins if enabled security | UPDATE_JENKINS_BUILD_USER | |
@@ -31,7 +32,7 @@ $ bundle exec fastlane action update_jenkins_build
31
32
  +-----------------------------------+
32
33
  | update_jenkins_build Return Value |
33
34
  +-----------------------------------+
34
- | ture/false |
35
+ | [ture/false, response_body] |
35
36
  +-----------------------------------+
36
37
  ```
37
38
 
@@ -9,24 +9,32 @@ module Fastlane
9
9
  def self.run(params)
10
10
  @user = params[:user]
11
11
  @password = params[:password]
12
+ @url = params[:url]
12
13
  @project = params[:project]
13
14
  @build_number = params[:build_number]
14
15
  @description = params[:description]
15
16
 
16
17
  url = "#{base_uri}/submitDescription"
17
- res = if @user
18
+ res = if @user || @password
18
19
  HTTP.basic_auth(user: @user, pass: @password)
19
20
  .post(url, form: {description: @description})
20
21
  else
21
- HTTP.post(url, form: {description: @description})
22
+ HTTP.post(url, form: {
23
+ "description" => @description,
24
+ "Jenkins-Crumb" => "234234234234234234"
25
+ })
22
26
  end
23
27
 
24
- result = res.status == 302 ? true : false
28
+ result = if res.code == 302
29
+ 'success'
30
+ else
31
+ "#{res.code} fail"
32
+ end
25
33
 
26
34
  params = {
27
35
  title: "Summary for update_jenkins_build #{UpdateJenkinsBuild::VERSION}".green,
28
36
  rows: {
29
- result: (result ? 'success' : 'fail'),
37
+ result: result,
30
38
  url: "#{base_uri}/editDescription",
31
39
  auth: @user ? true : false,
32
40
  description: @description,
@@ -37,21 +45,21 @@ module Fastlane
37
45
  puts Terminal::Table.new(params)
38
46
  puts ""
39
47
 
40
- result
48
+ [result, res.body]
41
49
  end
42
50
 
43
51
  def self.base_uri
44
- uri = URI(ENV['JENKINS_URL'])
52
+ uri = URI(@url)
45
53
  uri.path = "/job/#{@project}/#{@build_number}"
46
54
  uri.to_s
47
55
  end
48
56
 
49
57
  def self.return_value
50
- "ture/false"
58
+ "[ture/false, response_body]"
51
59
  end
52
60
 
53
61
  def self.return_type
54
- :boolean
62
+ :array
55
63
  end
56
64
 
57
65
  def self.example_code
@@ -60,6 +68,7 @@ module Fastlane
60
68
  description: "AdHoc v1.0 (1.0.1)"
61
69
  )',
62
70
  'update_jenkins_build(
71
+ url: "http://127.0.0.1:8080/", # specify specific jenkins url
63
72
  project: "foobar", # specify specific project name
64
73
  build_number: 75, # specify specific build number
65
74
  description: "AdHoc v1.0 (1.0.1)",
@@ -76,6 +85,10 @@ module Fastlane
76
85
  "Update build's description of jenkins"
77
86
  end
78
87
 
88
+ def self.details
89
+ "MUST disable CSRF in Security configure"
90
+ end
91
+
79
92
  def self.available_options
80
93
  [
81
94
  FastlaneCore::ConfigItem.new(key: :description,
@@ -83,6 +96,12 @@ module Fastlane
83
96
  description: "the description of current build",
84
97
  optional: false,
85
98
  type: String),
99
+ FastlaneCore::ConfigItem.new(key: :url,
100
+ env_name: "UPDATE_JENKINS_BUILD_URL",
101
+ description: "the url of jenkins",
102
+ default_value: ENV['JENKINS_URL'],
103
+ optional: true,
104
+ type: String),
86
105
  FastlaneCore::ConfigItem.new(key: :project,
87
106
  env_name: "UPDATE_JENKINS_BUILD_PROJECT",
88
107
  description: "the name of project(job)",
@@ -5,12 +5,6 @@ module Fastlane
5
5
 
6
6
  module Helper
7
7
  class UpdateJenkinsBuildHelper
8
- # class methods that you define here become available in your action
9
- # as `Helper::UpdateJenkinsBuildHelper.your_method`
10
- #
11
- def self.show_message
12
- UI.message("Hello from the update_jenkins_build plugin helper!")
13
- end
14
8
  end
15
9
  end
16
10
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module UpdateJenkinsBuild
3
- VERSION = "0.1.4"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  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.1.4
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - icyleaf
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-26 00:00:00.000000000 Z
11
+ date: 2018-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http
@@ -196,7 +196,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
196
196
  version: '0'
197
197
  requirements: []
198
198
  rubyforge_project:
199
- rubygems_version: 2.6.12
199
+ rubygems_version: 2.7.3
200
200
  signing_key:
201
201
  specification_version: 4
202
202
  summary: Update Description of Build