fastlane-plugin-jenkins_job_config 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 0b2a6033b57a8b32cab6cef860e49d954394e7ca
4
- data.tar.gz: 8bed5f4d8f0ca8b69a05055f4ea01cc9093a2ffe
2
+ SHA256:
3
+ metadata.gz: 866cd01cbb7cc6a4d0810e9c4e5d3646b894ad8bf4e27ea60a83d5220d7ada69
4
+ data.tar.gz: c2e1254ce824589e79d64d94363904742d75c44874311208d183959bcb6b40d5
5
5
  SHA512:
6
- metadata.gz: '0850fa399f43768347c9c42c434ba2b1853117b619ea2ec81fc90ce2ab57178fd6cc47e56226305a09c46d4ed545fa6ddb93a23f8820f428854d8e48d494cd07'
7
- data.tar.gz: 8593837c05755144892eea9ffbc8d4239f20ed0352d226f4f8618fc1b7b94cbddee0f163630fb49d255fc023e99df7615aebc2488640c67c6453e1b1453b6f8c
6
+ metadata.gz: cca490976a4abbc7dcad8016de0cebc6562f4ed2ee273806135c9ca6cd31ed136b86dcc3005c2b605fd975998aa98787ece937d8e6f605f2cf247eaf8ba384ea
7
+ data.tar.gz: 43aaff1d764d4acdf6bf0b10172e9a9f6aae50adce76c2d2c42f4bc59eb04798548194394d84c961af37799e17e44c004927d6681354a23a774653f3b0e1c84b
data/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2017 Jerome Lacoste <jerome.lacoste@gmail.com>
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Jerome Lacoste <jerome.lacoste@gmail.com>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md CHANGED
@@ -1,52 +1,52 @@
1
- # jenkins_job_config plugin
2
-
3
- [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-jenkins_job_config)
4
-
5
- ## Getting Started
6
-
7
- This project is a [fastlane](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-jenkins_job_config`, add it to your project by running:
8
-
9
- ```bash
10
- fastlane add_plugin jenkins_job_config
11
- ```
12
-
13
- ## About jenkins_job_config
14
-
15
- Generate the config for a Jenkins job
16
-
17
- **Note to author:** Add a more detailed description about this plugin here. If your plugin contains multiple actions, make sure to mention them here.
18
-
19
- ## Example
20
-
21
- Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin. Try it by cloning the repo, running `fastlane install_plugins` and `bundle exec fastlane test`.
22
-
23
- **Note to author:** Please set up a sample project to make it easy for users to explore what your plugin does. Provide everything that is necessary to try out the plugin in this project (including a sample Xcode/Android project if necessary)
24
-
25
- ## Run tests for this plugin
26
-
27
- To run both the tests, and code style validation, run
28
-
29
- ```
30
- rake
31
- ```
32
-
33
- To automatically fix many of the styling issues, use
34
- ```
35
- rubocop -a
36
- ```
37
-
38
- ## Issues and Feedback
39
-
40
- For any other issues and feedback about this plugin, please submit it to this repository.
41
-
42
- ## Troubleshooting
43
-
44
- If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
45
-
46
- ## Using `fastlane` Plugins
47
-
48
- For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
49
-
50
- ## About `fastlane`
51
-
52
- `fastlane` is the easiest way to automate beta deployments and releases for your iOS and Android apps. To learn more, check out [fastlane.tools](https://fastlane.tools).
1
+ # jenkins_job_config plugin
2
+
3
+ [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-jenkins_job_config)
4
+
5
+ ## Getting Started
6
+
7
+ This project is a [fastlane](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-jenkins_job_config`, add it to your project by running:
8
+
9
+ ```bash
10
+ fastlane add_plugin jenkins_job_config
11
+ ```
12
+
13
+ ## About jenkins_job_config
14
+
15
+ Generate the config for a Jenkins job
16
+
17
+ **Note to author:** Add a more detailed description about this plugin here. If your plugin contains multiple actions, make sure to mention them here.
18
+
19
+ ## Example
20
+
21
+ Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin. Try it by cloning the repo, running `fastlane install_plugins` and `bundle exec fastlane test`.
22
+
23
+ **Note to author:** Please set up a sample project to make it easy for users to explore what your plugin does. Provide everything that is necessary to try out the plugin in this project (including a sample Xcode/Android project if necessary)
24
+
25
+ ## Run tests for this plugin
26
+
27
+ To run both the tests, and code style validation, run
28
+
29
+ ```
30
+ rake
31
+ ```
32
+
33
+ To automatically fix many of the styling issues, use
34
+ ```
35
+ rubocop -a
36
+ ```
37
+
38
+ ## Issues and Feedback
39
+
40
+ For any other issues and feedback about this plugin, please submit it to this repository.
41
+
42
+ ## Troubleshooting
43
+
44
+ If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
45
+
46
+ ## Using `fastlane` Plugins
47
+
48
+ For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
49
+
50
+ ## About `fastlane`
51
+
52
+ `fastlane` is the easiest way to automate beta deployments and releases for your iOS and Android apps. To learn more, check out [fastlane.tools](https://fastlane.tools).
@@ -1,16 +1,16 @@
1
- require 'fastlane/plugin/jenkins_job_config/version'
2
-
3
- module Fastlane
4
- module JenkinsJobConfig
5
- # Return all .rb files inside the "actions" and "helper" directory
6
- def self.all_classes
7
- Dir[File.expand_path('**/{actions,helper}/*.rb', File.dirname(__FILE__))]
8
- end
9
- end
10
- end
11
-
12
- # By default we want to import all available actions and helpers
13
- # A plugin can contain any number of actions and plugins
14
- Fastlane::JenkinsJobConfig.all_classes.each do |current|
15
- require current
16
- end
1
+ require 'fastlane/plugin/jenkins_job_config/version'
2
+
3
+ module Fastlane
4
+ module JenkinsJobConfig
5
+ # Return all .rb files inside the "actions" and "helper" directory
6
+ def self.all_classes
7
+ Dir[File.expand_path('**/{actions,helper}/*.rb', File.dirname(__FILE__))]
8
+ end
9
+ end
10
+ end
11
+
12
+ # By default we want to import all available actions and helpers
13
+ # A plugin can contain any number of actions and plugins
14
+ Fastlane::JenkinsJobConfig.all_classes.each do |current|
15
+ require current
16
+ end
@@ -1,183 +1,183 @@
1
- module Fastlane
2
- module Actions
3
- class JenkinsJobConfigAction < Action
4
- def self.run(params)
5
- params = params.values if params.kind_of?(FastlaneCore::Configuration)
6
- UI.verbose("Generating config with the following parameters: #{params}")
7
-
8
- git_url = params[:git_url].strip
9
- git_branch = params[:git_branch].strip
10
- git_project = git_url.split('/').last
11
-
12
- product = params[:product].to_s.strip
13
- platform = params[:platform]
14
- # if a user specifies a platform, it better exists!
15
- UI.user_error!("Empty platform") if platform && platform.empty?
16
- UI.verbose("Getting template for #{platform}") if platform
17
-
18
- # search for template by platform name
19
- template = self.find_template("#{platform}_config.xml.erb") if platform
20
- # fallsback
21
- template = self.find_template("default_config.xml.erb") unless template
22
- UI.user_error!("Template file not found") unless template
23
-
24
- suffix = platform || params[:task]
25
- project_name = "game_#{product}-#{git_branch}_#{suffix}"
26
- dest_dir = "target/#{project_name}"
27
- FileUtils.mkdir_p(dest_dir)
28
- destination = "#{dest_dir}/config.xml"
29
-
30
- UI.verbose("Using template #{template} for #{project_name}")
31
-
32
- # relevant configuration for descriptive_text
33
- present_keys = [:product, :platform, :lanes, :command, :task] & params.keys
34
- descriptive_text = present_keys.map { |key| "#{key} <strong>#{params[key]}</strong>" }.join(" and ")
35
-
36
- description = "Builds: #{descriptive_text}" \
37
- "<p><strong>This config was AUTOGENERATED using <code>bundle exec fastlane generate_jenkins_configs</code></strong></p>" \
38
- "<p><strong>Be careful if you modify this</strong>. Your changes might get rewritten. Consider contributing to <a href='https://bitbucket.org/WeWantToKnow/fastlane-plugin-jenkins_job_config'>fastlane-plugin-jenkins_job_config</a> instead.</p>"
39
- require 'cgi' # change to lowercase to allow execution on windows
40
- description = CGI.escapeHTML(description)
41
-
42
- parameters = {}
43
- if params[:command].nil?
44
- lanes = params[:lanes]
45
- if lanes and lanes.count > 1
46
- parameters['JENKINS_PARAM_LANE_ENV'] = lanes if lanes.count > 1
47
- params[:command] ||= "./ci_build.sh #{product} #{platform} $JENKINS_PARAM_LANE_ENV"
48
- else
49
- params[:command] ||= "./ci_build.sh #{product} #{platform} #{lanes[0]}"
50
- end
51
- UI.message("No command specified, used default command: #{params[:command]}")
52
- else
53
- UI.message("Using specified command: #{params[:command]}")
54
- end
55
-
56
- params.merge!({
57
- parameters: parameters,
58
- description: description,
59
- git_project: git_project,
60
- timeout_param: params[:timeout] # Else it will try to call the ruby method timeout in the .erb
61
- })
62
- Fastlane::Actions::ErbAction.run(
63
- template: template,
64
- placeholders: params,
65
- destination: destination
66
- )
67
- end
68
-
69
- # find the template file, or nil if not found
70
- def self.find_template(filename)
71
- template = File.join(File.expand_path("../../templates", __FILE__), filename)
72
- UI.verbose("Looking for template under #{template}")
73
- unless File.exist? template
74
- UI.verbose("Template #{template} not found")
75
- template = nil
76
- end
77
- template
78
- end
79
-
80
- def self.description
81
- "Generate the config for a Jenkins job"
82
- end
83
-
84
- def self.authors
85
- ["Jerome Lacoste"]
86
- end
87
-
88
- def self.return_value
89
- # If your method provides a return value, you can describe here what it does
90
- end
91
-
92
- def self.details
93
- # Optional:
94
- "Given a set of inbuilt ERB templates, maintains our Jenkins job configs"
95
- end
96
-
97
- def self.available_options
98
- [
99
- FastlaneCore::ConfigItem.new(key: :platform,
100
- optional: true,
101
- is_string: false,
102
- default_value: nil,
103
- description: "The platform to generate the config for"),
104
- FastlaneCore::ConfigItem.new(key: :product,
105
- optional: false,
106
- is_string: false,
107
- default_value: "",
108
- description: "The product to generate the config for"),
109
- FastlaneCore::ConfigItem.new(key: :task,
110
- optional: true,
111
- is_string: true,
112
- default_value: "",
113
- description: "The name of the task, used if platform not specified"),
114
- FastlaneCore::ConfigItem.new(key: :command,
115
- optional: true,
116
- is_string: true,
117
- description: "The command to wrap"),
118
- FastlaneCore::ConfigItem.new(key: :lanes,
119
- optional: false,
120
- type: Array,
121
- default_value: "",
122
- description: "The lanes to generate the config for"),
123
- FastlaneCore::ConfigItem.new(key: :git_url,
124
- optional: false,
125
- is_string: true,
126
- default_value: "",
127
- description: "The git url to generate the config for"),
128
- FastlaneCore::ConfigItem.new(key: :git_branch,
129
- optional: false,
130
- is_string: true,
131
- default_value: "",
132
- description: "The git branch to generate the config for"),
133
- FastlaneCore::ConfigItem.new(key: :extra_tasks,
134
- optional: true,
135
- type: Hash,
136
- default_value: {},
137
- description: "The additional tasks to generate the config with"),
138
- FastlaneCore::ConfigItem.new(key: :extra_credentials,
139
- optional: true,
140
- type: Hash,
141
- default_value: {},
142
- description: "The additional credentials to generate the config with"),
143
- FastlaneCore::ConfigItem.new(key: :artifacts,
144
- optional: true,
145
- type: Array,
146
- default_value: [],
147
- description: "The artifacts to keep in the config"),
148
- FastlaneCore::ConfigItem.new(key: :timeout,
149
- optional: true,
150
- type: Integer,
151
- default_value: 30,
152
- description: "The timeout of the build")
153
- ]
154
- end
155
-
156
- def self.is_supported?(platform)
157
- # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
158
- # See: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Platforms.md
159
- #
160
- # [:ios, :mac, :android].include?(platform)
161
- true
162
- end
163
-
164
- def self.example_code
165
- [
166
- 'jenkins_job_config(
167
- platform: "android",
168
- product: "BigNumbers",
169
- git_url: "git:///...",
170
- lanes: [:Hockey, :GooglePlay, :Amazon],
171
- extra_tasks: { "Clean target directory" => "rm -rf $WORKSPACE/target/*" },
172
- extra_credentials: { "FASTLANE_PASSWORD" => "FASTLANE_PASSWORD" },
173
- artifacts: [ "*.log", "*.data" ]
174
- )'
175
- ]
176
- end
177
-
178
- def self.category
179
- :misc
180
- end
181
- end
182
- end
183
- end
1
+ module Fastlane
2
+ module Actions
3
+ class JenkinsJobConfigAction < Action
4
+ def self.run(params)
5
+ params = params.values if params.kind_of?(FastlaneCore::Configuration)
6
+ UI.verbose("Generating config with the following parameters: #{params}")
7
+
8
+ git_url = params[:git_url].strip
9
+ git_branch = params[:git_branch].strip
10
+ git_project = git_url.split('/').last
11
+
12
+ product = params[:product].to_s.strip
13
+ platform = params[:platform]
14
+ # if a user specifies a platform, it better exists!
15
+ UI.user_error!("Empty platform") if platform && platform.empty?
16
+ UI.verbose("Getting template for #{platform}") if platform
17
+
18
+ # search for template by platform name
19
+ template = self.find_template("#{platform}_config.xml.erb") if platform
20
+ # fallsback
21
+ template = self.find_template("default_config.xml.erb") unless template
22
+ UI.user_error!("Template file not found") unless template
23
+
24
+ suffix = platform || params[:task]
25
+ project_name = "game_#{product}-#{git_branch}_#{suffix}"
26
+ dest_dir = "target/#{project_name}"
27
+ FileUtils.mkdir_p(dest_dir)
28
+ destination = "#{dest_dir}/config.xml"
29
+
30
+ UI.verbose("Using template #{template} for #{project_name}")
31
+
32
+ # relevant configuration for descriptive_text
33
+ present_keys = [:product, :platform, :lanes, :command, :task] & params.keys
34
+ descriptive_text = present_keys.map { |key| "#{key} <strong>#{params[key]}</strong>" }.join(" and ")
35
+
36
+ description = "Builds: #{descriptive_text}" \
37
+ "<p><strong>This config was AUTOGENERATED using <code>bundle exec fastlane generate_jenkins_configs</code></strong></p>" \
38
+ "<p><strong>Be careful if you modify this</strong>. Your changes might get rewritten. Consider contributing to <a href='https://bitbucket.org/WeWantToKnow/fastlane-plugin-jenkins_job_config'>fastlane-plugin-jenkins_job_config</a> instead.</p>"
39
+ require 'cgi' # change to lowercase to allow execution on windows
40
+ description = CGI.escapeHTML(description)
41
+
42
+ parameters = {}
43
+ if params[:command].nil?
44
+ lanes = params[:lanes]
45
+ if lanes and lanes.count > 1
46
+ parameters['JENKINS_PARAM_LANE_ENV'] = lanes if lanes.count > 1
47
+ params[:command] ||= "./ci_build.sh #{product} #{platform} $JENKINS_PARAM_LANE_ENV"
48
+ else
49
+ params[:command] ||= "./ci_build.sh #{product} #{platform} #{lanes[0]}"
50
+ end
51
+ UI.message("No command specified, used default command: #{params[:command]}")
52
+ else
53
+ UI.message("Using specified command: #{params[:command]}")
54
+ end
55
+
56
+ params.merge!({
57
+ parameters: parameters,
58
+ description: description,
59
+ git_project: git_project,
60
+ timeout_param: params[:timeout] # Else it will try to call the ruby method timeout in the .erb
61
+ })
62
+ Fastlane::Actions::ErbAction.run(
63
+ template: template,
64
+ placeholders: params,
65
+ destination: destination
66
+ )
67
+ end
68
+
69
+ # find the template file, or nil if not found
70
+ def self.find_template(filename)
71
+ template = File.join(File.expand_path("../../templates", __FILE__), filename)
72
+ UI.verbose("Looking for template under #{template}")
73
+ unless File.exist? template
74
+ UI.verbose("Template #{template} not found")
75
+ template = nil
76
+ end
77
+ template
78
+ end
79
+
80
+ def self.description
81
+ "Generate the config for a Jenkins job"
82
+ end
83
+
84
+ def self.authors
85
+ ["Jerome Lacoste"]
86
+ end
87
+
88
+ def self.return_value
89
+ # If your method provides a return value, you can describe here what it does
90
+ end
91
+
92
+ def self.details
93
+ # Optional:
94
+ "Given a set of inbuilt ERB templates, maintains our Jenkins job configs"
95
+ end
96
+
97
+ def self.available_options
98
+ [
99
+ FastlaneCore::ConfigItem.new(key: :platform,
100
+ optional: true,
101
+ is_string: false,
102
+ default_value: nil,
103
+ description: "The platform to generate the config for"),
104
+ FastlaneCore::ConfigItem.new(key: :product,
105
+ optional: false,
106
+ is_string: false,
107
+ default_value: "",
108
+ description: "The product to generate the config for"),
109
+ FastlaneCore::ConfigItem.new(key: :task,
110
+ optional: true,
111
+ is_string: true,
112
+ default_value: "",
113
+ description: "The name of the task, used if platform not specified"),
114
+ FastlaneCore::ConfigItem.new(key: :command,
115
+ optional: true,
116
+ is_string: true,
117
+ description: "The command to wrap"),
118
+ FastlaneCore::ConfigItem.new(key: :lanes,
119
+ optional: false,
120
+ type: Array,
121
+ default_value: "",
122
+ description: "The lanes to generate the config for"),
123
+ FastlaneCore::ConfigItem.new(key: :git_url,
124
+ optional: false,
125
+ is_string: true,
126
+ default_value: "",
127
+ description: "The git url to generate the config for"),
128
+ FastlaneCore::ConfigItem.new(key: :git_branch,
129
+ optional: false,
130
+ is_string: true,
131
+ default_value: "",
132
+ description: "The git branch to generate the config for"),
133
+ FastlaneCore::ConfigItem.new(key: :extra_tasks,
134
+ optional: true,
135
+ type: Hash,
136
+ default_value: {},
137
+ description: "The additional tasks to generate the config with"),
138
+ FastlaneCore::ConfigItem.new(key: :extra_credentials,
139
+ optional: true,
140
+ type: Hash,
141
+ default_value: {},
142
+ description: "The additional credentials to generate the config with"),
143
+ FastlaneCore::ConfigItem.new(key: :artifacts,
144
+ optional: true,
145
+ type: Array,
146
+ default_value: [],
147
+ description: "The artifacts to keep in the config"),
148
+ FastlaneCore::ConfigItem.new(key: :timeout,
149
+ optional: true,
150
+ type: Integer,
151
+ default_value: 30,
152
+ description: "The timeout of the build")
153
+ ]
154
+ end
155
+
156
+ def self.is_supported?(platform)
157
+ # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
158
+ # See: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Platforms.md
159
+ #
160
+ # [:ios, :mac, :android].include?(platform)
161
+ true
162
+ end
163
+
164
+ def self.example_code
165
+ [
166
+ 'jenkins_job_config(
167
+ platform: "android",
168
+ product: "BigNumbers",
169
+ git_url: "git:///...",
170
+ lanes: [:Hockey, :GooglePlay, :Amazon],
171
+ extra_tasks: { "Clean target directory" => "rm -rf $WORKSPACE/target/*" },
172
+ extra_credentials: { "FASTLANE_PASSWORD" => "FASTLANE_PASSWORD" },
173
+ artifacts: [ "*.log", "*.data" ]
174
+ )'
175
+ ]
176
+ end
177
+
178
+ def self.category
179
+ :misc
180
+ end
181
+ end
182
+ end
183
+ end