fastlane-plugin-airwatch_workspaceone 2.0.0 → 2.1.0

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
2
  SHA256:
3
- metadata.gz: 24d6f4778a212b4ecd777581295f7455de5d3feb8a6fc664017106b97c4e0455
4
- data.tar.gz: f26078ad12791c18fa6bde200e0c5e97633eec8f56f2cbc2868b00387515986c
3
+ metadata.gz: 32430ef06328d10cc7c98f4ceeaf4d336f608c4c3ce989db58e3aa1821fa1bdf
4
+ data.tar.gz: 7e13e86e2deb91aa853522884aae858f817e647a9683c8230f72534f02c5d7c3
5
5
  SHA512:
6
- metadata.gz: 5f03c8eaee4e59ea57e1043164eb728f45294591d87b5d177d43ecaf1adc670c350a79cc8fc481a07ee04c77cfa0b8470bf2ee62742145ea73139ca27d9915c3
7
- data.tar.gz: cf7bb83f7658e8eda12cf337ef3345c5fcb0c8de2235e8d8f6b239c50905a45becb1b2bd58588b9878d0c11378eb95a36c5ba263f818a1a56748adecf0d018ab
6
+ metadata.gz: d429bfa5873b2f9b6f447d415f4e2a4946bc05d09f589af5d9c0922df51d8141aec24c4e39cf7be71e284f62c88418b75f0f17f47f932374e4f5ca5d1e54e57f
7
+ data.tar.gz: 56b01be6d0a4e3ae334b7e363d4dcb0c17b19329d7c826a16869e478e3081bb91379230818907bde156485cde0298384eb4adbc8d3257e289c5466bba793e70d
data/README.md CHANGED
@@ -15,13 +15,14 @@ fastlane add_plugin airwatch_workspaceone
15
15
  The main purpose of this plugin is to upload an IPA or an APK file to an AirWatch or Workspace ONE enterprise instance/console. For Android, the plugin works only with legacy AirWatch console and not with Workspace ONE console.
16
16
 
17
17
  This plugin features following actions :-
18
- 1. deploy_build - To upload an iOS ipa to both legacy AirWatch and Workspace ONE console. Also, to upload an Android APK to legacy AirWatch console.
18
+ 1. deploy_build - The main purpose of this action is to upload an IPA or an APK file to an AirWatch or Workspace ONE enterprise console.
19
19
  2. retire_previous_versions - The main purpose of this action is to retire previous active versions of an application. This action takes a string parameter where you can specify the number of latest versions to keep if you do not want to retire all the previous active versions.
20
20
  3. delete_previous_versions - The main purpose of this action is to delete versions of an application. This action takes a string parameter where you can specify the number of latest versions to keep if you do not want to delete all the versions.
21
21
  4. retire_specific_version - The main purpose of this action is to retire a specific version of an application. This action takes a string parameter where you can specify the version number to retire.
22
22
  5. delete_specific_version - The main purpose of this action is to delete a specific version of an application. This action takes a string parameter where you can specify the version number to delete.
23
- 6. add_or_update_assignments_action - The main purpose of this action is to add a new smart group assignment to an application or to update an existing smart group assignment of an application with a given dictionary of deployment/assignment parameters. If a smart group name is provided which does not exist yet on Console, assignment for that smart group is ignored.
23
+ 6. add_or_update_assignments - The main purpose of this action is to add a new smart group assignment to an application or to update an existing smart group assignment of an application with a given dictionary of deployment/assignment parameters. If a smart group name is provided which does not exist yet on Console, assignment for that smart group is ignored.
24
24
  7. unretire_all_versions - The main purpose of this action is to unretire all retired versions of an application.
25
+ 8. unretire_specific_version - The main purpose of this action is to unretire a specific version of an application. This action takes a string parameter where you can specify the version number to unretire.
25
26
 
26
27
  ## Available options
27
28
 
@@ -48,10 +49,24 @@ fastlane action add_or_update_assignments
48
49
  ```bash
49
50
  fastlane action unretire_all_versions
50
51
  ```
51
-
52
+ ```bash
53
+ fastlane action unretire_specific_version
54
+ ```
55
+ Please do not append /API/ at the end of host_url option in any of the actions; you should pass something like - https://asxxx.awmdm.com. Thanks to [Willie Stewart](https://github.com/wstewartii) for facing an [issue](https://github.com/letsbondiway/fastlane-plugin-airwatch_workspaceone/issues/2) because of this due to which this gets documented.
52
56
  ## Example
53
57
 
54
- Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin.
58
+ Check out the [example `Fastfile`](fastlane/Fastfile) to see example lanes.
59
+
60
+ To make use of this plugin, run one of the lanes using the following command -
61
+
62
+ ```bash
63
+ bundle exec fastlane lane_name
64
+ ```
65
+ If you are using .env files (please find sample - .env.development at the same folder where Fastfile is located), please specify using --env parameter
66
+
67
+ ```bash
68
+ bundle exec fastlane lane_name --env development
69
+ ```
55
70
 
56
71
  ## Run tests for this plugin
57
72
 
@@ -112,6 +112,7 @@ module Fastlane
112
112
  exit
113
113
  end
114
114
 
115
+ app_versions.sort_by! { |app_version| app_version["Id"]["Value"] }
115
116
  latest_app_version = app_versions.last
116
117
  $app_id_int = latest_app_version['Id']['Value']
117
118
  app_smart_groups = latest_app_version['SmartGroups']
@@ -221,29 +222,29 @@ module Fastlane
221
222
  [
222
223
  FastlaneCore::ConfigItem.new(key: :host_url,
223
224
  env_name: "AIRWATCH_HOST_API_URL",
224
- description: "Host API URL of the AirWatch instance",
225
+ description: "Host API URL of the AirWatch/Workspace ONE instance without /API/ at the end",
225
226
  optional: false,
226
227
  type: String,
227
228
  verify_block: proc do |value|
228
- UI.user_error!("No AirWatch Host API URl given.") unless value and !value.empty?
229
+ UI.user_error!("No AirWatch/Workspace ONE Host API URl given, pass using `host_url: 'https://yourhost.com'`") unless value and !value.empty?
229
230
  end),
230
231
 
231
232
  FastlaneCore::ConfigItem.new(key: :aw_tenant_code,
232
233
  env_name: "AIRWATCH_API_KEY",
233
- description: "API key or the tenant code to access AirWatch Rest APIs",
234
+ description: "API key or the tenant code to access AirWatch/Workspace ONE Rest APIs",
234
235
  optional: false,
235
236
  type: String,
236
237
  verify_block: proc do |value|
237
- UI.user_error!("Api tenant code header is missing.") unless value and !value.empty?
238
+ UI.user_error!("Api tenant code header is missing, pass using `aw_tenant_code: 'yourapikey'`") unless value and !value.empty?
238
239
  end),
239
240
 
240
241
  FastlaneCore::ConfigItem.new(key: :b64_encoded_auth,
241
242
  env_name: "AIRWATCH_BASE64_ENCODED_BASIC_AUTH_STRING",
242
- description: "The base64 encoded Basic Auth string generated by authorizing username and password to the AirWatch instance",
243
+ description: "The base64 encoded Basic Auth string generated by authorizing username and password to the AirWatch/Workspace ONE instance",
243
244
  optional: false,
244
245
  type: String,
245
246
  verify_block: proc do |value|
246
- UI.user_error!("The authorization header is empty or the scheme is not basic") unless value and !value.empty?
247
+ UI.user_error!("The authorization header is empty or the scheme is not basic, pass using `b64_encoded_auth: 'yourb64encodedauthstring'`") unless value and !value.empty?
247
248
  end),
248
249
 
249
250
  FastlaneCore::ConfigItem.new(key: :org_group_id,
@@ -252,7 +253,7 @@ module Fastlane
252
253
  optional: false,
253
254
  type: String,
254
255
  verify_block: proc do |value|
255
- UI.user_error!("No Organization Group ID integer given, pass using `org_group_id: MyOrgGroupId`") unless value and !value.empty?
256
+ UI.user_error!("No Organization Group ID integer given, pass using `org_group_id: 'yourorggrpintid'`") unless value and !value.empty?
256
257
  end),
257
258
 
258
259
  FastlaneCore::ConfigItem.new(key: :app_identifier,
@@ -266,11 +267,11 @@ module Fastlane
266
267
 
267
268
  FastlaneCore::ConfigItem.new(key: :smart_groups_to_assign,
268
269
  env_name: "AIRWATCH_SMART_GROUPS_TO_ASSIGN",
269
- description: "Name of the smart group to assign to",
270
+ description: "Names of the smart groups to assign the app to",
270
271
  optional: false,
271
272
  type: Array,
272
273
  verify_block: proc do |value|
273
- UI.user_error!("No smart group given, pass using `smart_group_to_assign: 'MyAppDevTeam'`") unless value and !value.empty?
274
+ UI.user_error!("No smart group names given, pass using `smart_groups_to_assign: ['yoursmartgrp1', 'yoursmartgroup2']` or `smart_groups_to_assign: 'yoursmartgrp1'`") unless value and !value.empty?
274
275
  end),
275
276
 
276
277
  FastlaneCore::ConfigItem.new(key: :assignment_parameters,
@@ -279,7 +280,7 @@ module Fastlane
279
280
  optional: false,
280
281
  is_string: false,
281
282
  verify_block: proc do |value|
282
- UI.user_error!("No deployment parameters given, pass using `assignment_parameters: '{key1: value1, key2: value2}'`") unless value and !value.empty?
283
+ UI.user_error!("No smart group assignment parameters given, pass using `assignment_parameters: '{key1: value1, key2: value2}'`") unless value and !value.empty?
283
284
  end),
284
285
 
285
286
  FastlaneCore::ConfigItem.new(key: :debug,
@@ -82,6 +82,8 @@ module Fastlane
82
82
  end
83
83
  end
84
84
 
85
+ retired_app_versions.sort_by! { |app_version| app_version["Id"] }
86
+ active_app_versions.sort_by! { |app_version| app_version["Id"] }
85
87
  app_versions.push(*retired_app_versions)
86
88
  app_versions.push(*active_app_versions)
87
89
  return app_versions
@@ -140,36 +142,36 @@ module Fastlane
140
142
 
141
143
  def self.details
142
144
  # Optional:
143
- "delete_previous_versions - To delete versions of an application on the AirWatch console."
145
+ "delete_previous_versions - To delete versions of an application on the AirWatch/Workspace ONE console."
144
146
  end
145
147
 
146
148
  def self.available_options
147
149
  [
148
150
  FastlaneCore::ConfigItem.new(key: :host_url,
149
151
  env_name: "AIRWATCH_HOST_API_URL",
150
- description: "Host API URL of the AirWatch instance",
152
+ description: "Host API URL of the AirWatch/Workspace ONE instance without /API/ at the end",
151
153
  optional: false,
152
154
  type: String,
153
155
  verify_block: proc do |value|
154
- UI.user_error!("No AirWatch Host API URl given.") unless value and !value.empty?
156
+ UI.user_error!("No AirWatch/Workspace ONE Host API URl given, pass using `host_url: 'https://yourhost.com'`") unless value and !value.empty?
155
157
  end),
156
158
 
157
159
  FastlaneCore::ConfigItem.new(key: :aw_tenant_code,
158
160
  env_name: "AIRWATCH_API_KEY",
159
- description: "API key to access AirWatch Rest APIs",
161
+ description: "API key or the tenant code to access AirWatch/Workspace ONE Rest APIs",
160
162
  optional: false,
161
163
  type: String,
162
164
  verify_block: proc do |value|
163
- UI.user_error!("Api tenant code header is missing.") unless value and !value.empty?
165
+ UI.user_error!("Api tenant code header is missing, pass using `aw_tenant_code: 'yourapikey'`") unless value and !value.empty?
164
166
  end),
165
167
 
166
168
  FastlaneCore::ConfigItem.new(key: :b64_encoded_auth,
167
169
  env_name: "AIRWATCH_BASE64_ENCODED_BASIC_AUTH_STRING",
168
- description: "The base64 encoded Basic Auth string generated by authorizing username and password to the AirWatch instance",
170
+ description: "The base64 encoded Basic Auth string generated by authorizing username and password to the AirWatch/Workspace ONE instance",
169
171
  optional: false,
170
172
  type: String,
171
173
  verify_block: proc do |value|
172
- UI.user_error!("The authorization header is empty or the scheme is not basic") unless value and !value.empty?
174
+ UI.user_error!("The authorization header is empty or the scheme is not basic, pass using `b64_encoded_auth: 'yourb64encodedauthstring'`") unless value and !value.empty?
173
175
  end),
174
176
 
175
177
  FastlaneCore::ConfigItem.new(key: :app_identifier,
@@ -188,7 +190,7 @@ module Fastlane
188
190
  type: String,
189
191
  default_value: "0",
190
192
  verify_block: proc do |value|
191
- UI.user_error!("The number of latest versions to keep can not be negative") unless value.to_i >= 0
193
+ UI.user_error!("The number of latest versions to keep can not be negative, pass using `keep_latest_versions_count: 'count'`") unless value.to_i >= 0
192
194
  end),
193
195
 
194
196
  FastlaneCore::ConfigItem.new(key: :debug,
@@ -71,6 +71,7 @@ module Fastlane
71
71
  app_versions << app_version
72
72
  end
73
73
 
74
+ app_versions.sort_by! { |app_version| app_version["Id"] }
74
75
  return app_versions
75
76
  end
76
77
 
@@ -127,36 +128,36 @@ module Fastlane
127
128
 
128
129
  def self.details
129
130
  # Optional:
130
- "delete_specific_version - To delete specific version of an application on the AirWatch console."
131
+ "delete_specific_version - To delete specific version of an application on the AirWatch/Workspace ONE console."
131
132
  end
132
133
 
133
134
  def self.available_options
134
135
  [
135
136
  FastlaneCore::ConfigItem.new(key: :host_url,
136
137
  env_name: "AIRWATCH_HOST_API_URL",
137
- description: "Host API URL of the AirWatch instance",
138
+ description: "Host API URL of the AirWatch/Workspace ONE instance without /API/ at the end",
138
139
  optional: false,
139
140
  type: String,
140
141
  verify_block: proc do |value|
141
- UI.user_error!("No AirWatch Host API URl given.") unless value and !value.empty?
142
+ UI.user_error!("No AirWatch/Workspace ONE Host API URl given, pass using `host_url: 'https://yourhost.com'`") unless value and !value.empty?
142
143
  end),
143
144
 
144
145
  FastlaneCore::ConfigItem.new(key: :aw_tenant_code,
145
146
  env_name: "AIRWATCH_API_KEY",
146
- description: "API key to access AirWatch Rest APIs",
147
+ description: "API key or the tenant code to access AirWatch/Workspace ONE Rest APIs",
147
148
  optional: false,
148
149
  type: String,
149
150
  verify_block: proc do |value|
150
- UI.user_error!("Api tenant code header is missing.") unless value and !value.empty?
151
+ UI.user_error!("Api tenant code header is missing, pass using `aw_tenant_code: 'yourapikey'`") unless value and !value.empty?
151
152
  end),
152
153
 
153
154
  FastlaneCore::ConfigItem.new(key: :b64_encoded_auth,
154
155
  env_name: "AIRWATCH_BASE64_ENCODED_BASIC_AUTH_STRING",
155
- description: "The base64 encoded Basic Auth string generated by authorizing username and password to the AirWatch instance",
156
+ description: "The base64 encoded Basic Auth string generated by authorizing username and password to the AirWatch/Workspace ONE instance",
156
157
  optional: false,
157
158
  type: String,
158
159
  verify_block: proc do |value|
159
- UI.user_error!("The authorization header is empty or the scheme is not basic") unless value and !value.empty?
160
+ UI.user_error!("The authorization header is empty or the scheme is not basic, pass using `b64_encoded_auth: 'yourb64encodedauthstring'`") unless value and !value.empty?
160
161
  end),
161
162
 
162
163
  FastlaneCore::ConfigItem.new(key: :app_identifier,
@@ -170,7 +171,7 @@ module Fastlane
170
171
 
171
172
  FastlaneCore::ConfigItem.new(key: :version_number,
172
173
  env_name: "AIRWATCH_VERSION_NUMBER",
173
- description: "Version number of the application to retire",
174
+ description: "Version number of the application to delete",
174
175
  optional: false,
175
176
  type: String,
176
177
  verify_block: proc do |value|
@@ -76,9 +76,9 @@ module Fastlane
76
76
  end
77
77
 
78
78
  # step 4: deploying app version
79
- UI.message("------------------------------------")
79
+ UI.message("-----------------------------------")
80
80
  UI.message("4. Deploying app version on console")
81
- UI.message("------------------------------------")
81
+ UI.message("-----------------------------------")
82
82
  deploy_app(blobID, app_name, push_mode)
83
83
  UI.success("Successfully deployed the app version")
84
84
  end
@@ -191,7 +191,7 @@ module Fastlane
191
191
  end
192
192
 
193
193
  def self.description
194
- "The main purpose of this action is to upload an IPA or an APK file to an AirWatch or Workspace ONE enterprise instance/console."
194
+ "The main purpose of this action is to upload an IPA or an APK file to an AirWatch or Workspace ONE enterprise console."
195
195
  end
196
196
 
197
197
  def self.authors
@@ -204,36 +204,36 @@ module Fastlane
204
204
 
205
205
  def self.details
206
206
  # Optional:
207
- "deploy_build - To upload an iOS ipa OR Android APK to AirWatch/WorkspaceOne console."
207
+ "deploy_build - To upload an iOS ipa OR Android APK to AirWatch/Workspace One console."
208
208
  end
209
209
 
210
210
  def self.available_options
211
211
  [
212
212
  FastlaneCore::ConfigItem.new(key: :host_url,
213
213
  env_name: "AIRWATCH_HOST_API_URL",
214
- description: "Host API URL of the AirWatch instance",
214
+ description: "Host API URL of the AirWatch/Workspace ONE instance without /API/ at the end",
215
215
  optional: false,
216
216
  type: String,
217
217
  verify_block: proc do |value|
218
- UI.user_error!("No AirWatch Host API URl given.") unless value and !value.empty?
218
+ UI.user_error!("No AirWatch/Workspace ONE Host API URl given, pass using `host_url: 'https://yourhost.com'`") unless value and !value.empty?
219
219
  end),
220
220
 
221
221
  FastlaneCore::ConfigItem.new(key: :aw_tenant_code,
222
222
  env_name: "AIRWATCH_API_KEY",
223
- description: "API key or the tenant code to access AirWatch Rest APIs",
223
+ description: "API key or the tenant code to access AirWatch/Workspace ONE Rest APIs",
224
224
  optional: false,
225
225
  type: String,
226
226
  verify_block: proc do |value|
227
- UI.user_error!("Api tenant code header is missing.") unless value and !value.empty?
227
+ UI.user_error!("Api tenant code header is missing, pass using `aw_tenant_code: 'yourapikey'`") unless value and !value.empty?
228
228
  end),
229
229
 
230
230
  FastlaneCore::ConfigItem.new(key: :b64_encoded_auth,
231
231
  env_name: "AIRWATCH_BASE64_ENCODED_BASIC_AUTH_STRING",
232
- description: "The base64 encoded Basic Auth string generated by authorizing username and password to the AirWatch instance",
232
+ description: "The base64 encoded Basic Auth string generated by authorizing username and password to the AirWatch/Workspace ONE instance",
233
233
  optional: false,
234
234
  type: String,
235
235
  verify_block: proc do |value|
236
- UI.user_error!("The authorization header is empty or the scheme is not basic") unless value and !value.empty?
236
+ UI.user_error!("The authorization header is empty or the scheme is not basic, pass using `b64_encoded_auth: 'yourb64encodedauthstring'`") unless value and !value.empty?
237
237
  end),
238
238
 
239
239
  FastlaneCore::ConfigItem.new(key: :org_group_id,
@@ -242,7 +242,7 @@ module Fastlane
242
242
  optional: false,
243
243
  type: String,
244
244
  verify_block: proc do |value|
245
- UI.user_error!("No Organization Group ID integer given, pass using `org_group_id: MyOrgGroupId`") unless value and !value.empty?
245
+ UI.user_error!("No Organization Group ID integer given, pass using `org_group_id: 'yourorggrpintid'`") unless value and !value.empty?
246
246
  end),
247
247
 
248
248
  FastlaneCore::ConfigItem.new(key: :app_name,
@@ -274,11 +274,11 @@ module Fastlane
274
274
 
275
275
  FastlaneCore::ConfigItem.new(key: :push_mode,
276
276
  env_name: "AIRWATCH_APP_PUSH_MODE",
277
- description: "Push mode for the application",
277
+ description: "Push mode for the application. Values are Auto or On demand",
278
278
  optional: false,
279
279
  type: String,
280
280
  verify_block: proc do |value|
281
- UI.user_error!("No push mode given, pass using `push_mode: 'Auto'` or pass using `push_mode: 'On demand'`") unless value and !value.empty?
281
+ UI.user_error!("No push mode given, pass using `push_mode: 'Auto'` or `push_mode: 'On demand'`") unless value and !value.empty?
282
282
  end),
283
283
 
284
284
  FastlaneCore::ConfigItem.new(key: :debug,
@@ -75,6 +75,7 @@ module Fastlane
75
75
  end
76
76
  end
77
77
 
78
+ active_app_versions.sort_by! { |app_version| app_version["Id"] }
78
79
  return active_app_versions
79
80
  end
80
81
 
@@ -136,36 +137,36 @@ module Fastlane
136
137
 
137
138
  def self.details
138
139
  # Optional:
139
- "retire_previous_versions - To retire previous active versions of an application on the AirWatch console except the latest version."
140
+ "retire_previous_versions - To retire previous active versions of an application on the AirWatch/Workspace ONE console except the latest version."
140
141
  end
141
142
 
142
143
  def self.available_options
143
144
  [
144
145
  FastlaneCore::ConfigItem.new(key: :host_url,
145
146
  env_name: "AIRWATCH_HOST_API_URL",
146
- description: "Host API URL of the AirWatch instance",
147
+ description: "Host API URL of the AirWatch/Workspace ONE instance without /API/ at the end",
147
148
  optional: false,
148
149
  type: String,
149
150
  verify_block: proc do |value|
150
- UI.user_error!("No AirWatch Host API URl given.") unless value and !value.empty?
151
+ UI.user_error!("No AirWatch/Workspace ONE Host API URl given, pass using `host_url: 'https://yourhost.com'`") unless value and !value.empty?
151
152
  end),
152
153
 
153
154
  FastlaneCore::ConfigItem.new(key: :aw_tenant_code,
154
155
  env_name: "AIRWATCH_API_KEY",
155
- description: "API key to access AirWatch Rest APIs",
156
+ description: "API key or the tenant code to access AirWatch/Workspace ONE Rest APIs",
156
157
  optional: false,
157
158
  type: String,
158
159
  verify_block: proc do |value|
159
- UI.user_error!("Api tenant code header is missing.") unless value and !value.empty?
160
+ UI.user_error!("Api tenant code header is missing, pass using `aw_tenant_code: 'yourapikey'`") unless value and !value.empty?
160
161
  end),
161
162
 
162
163
  FastlaneCore::ConfigItem.new(key: :b64_encoded_auth,
163
164
  env_name: "AIRWATCH_BASE64_ENCODED_BASIC_AUTH_STRING",
164
- description: "The base64 encoded Basic Auth string generated by authorizing username and password to the AirWatch instance",
165
+ description: "The base64 encoded Basic Auth string generated by authorizing username and password to the AirWatch/Workspace ONE instance",
165
166
  optional: false,
166
167
  type: String,
167
168
  verify_block: proc do |value|
168
- UI.user_error!("The authorization header is empty or the scheme is not basic") unless value and !value.empty?
169
+ UI.user_error!("The authorization header is empty or the scheme is not basic, pass using `b64_encoded_auth: 'yourb64encodedauthstring'`") unless value and !value.empty?
169
170
  end),
170
171
 
171
172
  FastlaneCore::ConfigItem.new(key: :app_identifier,
@@ -184,7 +185,7 @@ module Fastlane
184
185
  type: String,
185
186
  default_value: "1",
186
187
  verify_block: proc do |value|
187
- UI.user_error!("The number of latest versions to keep can not be zero or negative") unless value.to_i > 0
188
+ UI.user_error!("The number of latest versions to keep can not be negative, pass using `keep_latest_versions_count: 'count'`") unless value.to_i > 0
188
189
  end),
189
190
 
190
191
  FastlaneCore::ConfigItem.new(key: :debug,
@@ -73,6 +73,7 @@ module Fastlane
73
73
  end
74
74
  end
75
75
 
76
+ active_app_versions.sort_by! { |app_version| app_version["Id"] }
76
77
  return active_app_versions
77
78
  end
78
79
 
@@ -134,36 +135,36 @@ module Fastlane
134
135
 
135
136
  def self.details
136
137
  # Optional:
137
- "retire_specific_version - To retire specific version of an application on the AirWatch console."
138
+ "retire_specific_version - To retire specific version of an application on the AirWatch/Workspace ONE console."
138
139
  end
139
140
 
140
141
  def self.available_options
141
142
  [
142
143
  FastlaneCore::ConfigItem.new(key: :host_url,
143
144
  env_name: "AIRWATCH_HOST_API_URL",
144
- description: "Host API URL of the AirWatch instance",
145
+ description: "Host API URL of the AirWatch/Workspace ONE instance without /API/ at the end",
145
146
  optional: false,
146
147
  type: String,
147
148
  verify_block: proc do |value|
148
- UI.user_error!("No AirWatch Host API URl given.") unless value and !value.empty?
149
+ UI.user_error!("No AirWatch/Workspace ONE Host API URl given, pass using `host_url: 'https://yourhost.com'`") unless value and !value.empty?
149
150
  end),
150
151
 
151
152
  FastlaneCore::ConfigItem.new(key: :aw_tenant_code,
152
153
  env_name: "AIRWATCH_API_KEY",
153
- description: "API key to access AirWatch Rest APIs",
154
+ description: "API key or the tenant code to access AirWatch/Workspace ONE Rest APIs",
154
155
  optional: false,
155
156
  type: String,
156
157
  verify_block: proc do |value|
157
- UI.user_error!("Api tenant code header is missing.") unless value and !value.empty?
158
+ UI.user_error!("Api tenant code header is missing, pass using `aw_tenant_code: 'yourapikey'`") unless value and !value.empty?
158
159
  end),
159
160
 
160
161
  FastlaneCore::ConfigItem.new(key: :b64_encoded_auth,
161
162
  env_name: "AIRWATCH_BASE64_ENCODED_BASIC_AUTH_STRING",
162
- description: "The base64 encoded Basic Auth string generated by authorizing username and password to the AirWatch instance",
163
+ description: "The base64 encoded Basic Auth string generated by authorizing username and password to the AirWatch/Workspace ONE instance",
163
164
  optional: false,
164
165
  type: String,
165
166
  verify_block: proc do |value|
166
- UI.user_error!("The authorization header is empty or the scheme is not basic") unless value and !value.empty?
167
+ UI.user_error!("The authorization header is empty or the scheme is not basic, pass using `b64_encoded_auth: 'yourb64encodedauthstring'`") unless value and !value.empty?
167
168
  end),
168
169
 
169
170
  FastlaneCore::ConfigItem.new(key: :app_identifier,
@@ -70,6 +70,7 @@ module Fastlane
70
70
  end
71
71
  end
72
72
 
73
+ retired_app_versions.sort_by! { |app_version| app_version["Id"] }
73
74
  return retired_app_versions
74
75
  end
75
76
 
@@ -131,36 +132,36 @@ module Fastlane
131
132
 
132
133
  def self.details
133
134
  # Optional:
134
- "unretire_all_versions - To unretire all retired versions of an application on the AirWatch console."
135
+ "unretire_all_versions - To unretire all retired versions of an application on the AirWatch/Workspace ONE console."
135
136
  end
136
137
 
137
138
  def self.available_options
138
139
  [
139
140
  FastlaneCore::ConfigItem.new(key: :host_url,
140
141
  env_name: "AIRWATCH_HOST_API_URL",
141
- description: "Host API URL of the AirWatch instance",
142
+ description: "Host API URL of the AirWatch/Workspace ONE instance without /API/ at the end",
142
143
  optional: false,
143
144
  type: String,
144
145
  verify_block: proc do |value|
145
- UI.user_error!("No AirWatch Host API URl given.") unless value and !value.empty?
146
+ UI.user_error!("No AirWatch/Workspace ONE Host API URl given, pass using `host_url: 'https://yourhost.com'`") unless value and !value.empty?
146
147
  end),
147
148
 
148
149
  FastlaneCore::ConfigItem.new(key: :aw_tenant_code,
149
150
  env_name: "AIRWATCH_API_KEY",
150
- description: "API key to access AirWatch Rest APIs",
151
+ description: "API key or the tenant code to access AirWatch/Workspace ONE Rest APIs",
151
152
  optional: false,
152
153
  type: String,
153
154
  verify_block: proc do |value|
154
- UI.user_error!("Api tenant code header is missing.") unless value and !value.empty?
155
+ UI.user_error!("Api tenant code header is missing, pass using `aw_tenant_code: 'yourapikey'`") unless value and !value.empty?
155
156
  end),
156
157
 
157
158
  FastlaneCore::ConfigItem.new(key: :b64_encoded_auth,
158
159
  env_name: "AIRWATCH_BASE64_ENCODED_BASIC_AUTH_STRING",
159
- description: "The base64 encoded Basic Auth string generated by authorizing username and password to the AirWatch instance",
160
+ description: "The base64 encoded Basic Auth string generated by authorizing username and password to the AirWatch/Workspace ONE instance",
160
161
  optional: false,
161
162
  type: String,
162
163
  verify_block: proc do |value|
163
- UI.user_error!("The authorization header is empty or the scheme is not basic") unless value and !value.empty?
164
+ UI.user_error!("The authorization header is empty or the scheme is not basic, pass using `b64_encoded_auth: 'yourb64encodedauthstring'`") unless value and !value.empty?
164
165
  end),
165
166
 
166
167
  FastlaneCore::ConfigItem.new(key: :app_identifier,
@@ -0,0 +1,218 @@
1
+ require 'fastlane/action'
2
+ require_relative '../helper/airwatch_workspaceone_helper'
3
+
4
+ module Fastlane
5
+ module Actions
6
+ class UnretireSpecificVersionAction < Action
7
+
8
+ APP_VERSIONS_LIST_SUFFIX = "/API/mam/apps/search?bundleid=%s"
9
+ INTERNAL_APP_UNRETIRE_SUFFIX = "/API/mam/apps/internal/%d/unretire"
10
+
11
+ $is_debug = false
12
+
13
+ def self.run(params)
14
+ UI.message("The airwatch_workspaceone plugin is working!")
15
+
16
+ # check if debug is enabled
17
+ $is_debug = params[:debug]
18
+
19
+ if debug
20
+ UI.message("-----------------------------------------------")
21
+ UI.message("UnretireSpecificVersionAction debug information")
22
+ UI.message("-----------------------------------------------")
23
+ UI.message(" host_url: #{params[:host_url]}")
24
+ UI.message(" aw_tenant_code: #{params[:aw_tenant_code]}")
25
+ UI.message(" b64_encoded_auth: #{params[:b64_encoded_auth]}")
26
+ UI.message(" app_identifier: #{params[:app_identifier]}")
27
+ UI.message(" version_number: #{params[:version_number]}")
28
+ end
29
+
30
+ $host_url = params[:host_url]
31
+ $aw_tenant_code = params[:aw_tenant_code]
32
+ $b64_encoded_auth = params[:b64_encoded_auth]
33
+ app_identifier = params[:app_identifier]
34
+ version_number = params[:version_number]
35
+
36
+ # step 1: find app
37
+ UI.message("-------------------------------")
38
+ UI.message("1. Finding retired app versions")
39
+ UI.message("-------------------------------")
40
+
41
+ retired_app_versions = find_app(app_identifier)
42
+ if retired_app_versions.count <= 0
43
+ UI.important("No retired app versions found for application with bundle identifier given: %s" % [app_identifier])
44
+ return
45
+ end
46
+
47
+ retired_version_numbers = retired_app_versions.map {|retired_app_version| retired_app_version.values[1]}
48
+ UI.success("Found %d retired app version(s)" % [retired_app_versions.count])
49
+ UI.success("Version number(s): %s" % [retired_version_numbers])
50
+
51
+ # step 2: retire specific version
52
+ UI.message("----------------------------------")
53
+ UI.message("2. UnRetiring specific app version")
54
+ UI.message("----------------------------------")
55
+
56
+ if retired_version_numbers.include? version_number
57
+ version_index = retired_version_numbers.index(version_number)
58
+ app_version_to_unretire = retired_app_versions[version_index]
59
+ unretire_app(app_version_to_unretire)
60
+ else
61
+ UI.user_error!("A version with the given version number: %s does not exist on the console for this application or is already Active." % [version_number])
62
+ end
63
+
64
+ UI.success("Version %s successfully unretired" % [version_number])
65
+ end
66
+
67
+ def self.find_app(app_identifier)
68
+ # get the list of apps
69
+ data = list_app_versions(app_identifier)
70
+ retired_app_versions = Array.new
71
+
72
+ data['Application'].each do |app|
73
+ if app['Status'] == "Retired"
74
+ retired_app_version = Hash.new
75
+ retired_app_version['Id'] = app['Id']['Value']
76
+ retired_app_version['Version'] = app['AppVersion']
77
+ retired_app_versions << retired_app_version
78
+ end
79
+ end
80
+
81
+ retired_app_versions.sort_by! { |app_version| app_version["Id"] }
82
+ return retired_app_versions
83
+ end
84
+
85
+ def self.list_app_versions(app_identifier)
86
+ require 'rest-client'
87
+ require 'json'
88
+
89
+ response = RestClient.get($host_url + APP_VERSIONS_LIST_SUFFIX % [app_identifier], {accept: :json, 'aw-tenant-code': $aw_tenant_code, 'Authorization': "Basic " + $b64_encoded_auth})
90
+
91
+ if debug
92
+ UI.message("Response code: %d" % [response.code])
93
+ UI.message("Response body:")
94
+ UI.message(response.body)
95
+ end
96
+
97
+ if response.code != 200
98
+ UI.user_error!("There was an error in finding app versions. One possible reason is that an app with the bundle identifier given does not exist on Console.")
99
+ exit
100
+ end
101
+
102
+ json = JSON.parse(response.body)
103
+ return json
104
+ end
105
+
106
+ def self.unretire_app(app_version)
107
+ require 'rest-client'
108
+ require 'json'
109
+
110
+ body = {
111
+ "applicationid" => app_version['Id']
112
+ }
113
+
114
+ UI.message("Starting to unretire app version: %s" % [app_version['Version']])
115
+ response = RestClient.post($host_url + INTERNAL_APP_UNRETIRE_SUFFIX % [app_version['Id']], body.to_json, {accept: :json, 'aw-tenant-code': $aw_tenant_code, 'Authorization': "Basic " + $b64_encoded_auth})
116
+
117
+ if debug
118
+ UI.message("Response code: %d" % [response.code])
119
+ end
120
+
121
+ if response.code == 202
122
+ UI.message("Successfully unretired app version: %s" % [app_version['Version']])
123
+ else
124
+ json = JSON.parse(response.body)
125
+ UI.message("Failed to unretire app version: %s" % [app_version['Version']])
126
+ end
127
+ end
128
+
129
+ def self.description
130
+ "The main purpose of this action is to unretire a specific version of an application. This action takes a string parameter where you can specify the version number to unretire."
131
+ end
132
+
133
+ def self.authors
134
+ ["Ram Awadhesh Sharan"]
135
+ end
136
+
137
+ def self.return_value
138
+ # If your method provides a return value, you can describe here what it does
139
+ end
140
+
141
+ def self.details
142
+ # Optional:
143
+ "unretire_specific_version - To unretire specific version of an application on the AirWatch/Workspace ONE console."
144
+ end
145
+
146
+ def self.available_options
147
+ [
148
+ FastlaneCore::ConfigItem.new(key: :host_url,
149
+ env_name: "AIRWATCH_HOST_API_URL",
150
+ description: "Host API URL of the AirWatch/Workspace ONE instance without /API/ at the end",
151
+ optional: false,
152
+ type: String,
153
+ verify_block: proc do |value|
154
+ UI.user_error!("No AirWatch/Workspace ONE Host API URl given, pass using `host_url: 'https://yourhost.com'`") unless value and !value.empty?
155
+ end),
156
+
157
+ FastlaneCore::ConfigItem.new(key: :aw_tenant_code,
158
+ env_name: "AIRWATCH_API_KEY",
159
+ description: "API key or the tenant code to access AirWatch/Workspace ONE Rest APIs",
160
+ optional: false,
161
+ type: String,
162
+ verify_block: proc do |value|
163
+ UI.user_error!("Api tenant code header is missing, pass using `aw_tenant_code: 'yourapikey'`") unless value and !value.empty?
164
+ end),
165
+
166
+ FastlaneCore::ConfigItem.new(key: :b64_encoded_auth,
167
+ env_name: "AIRWATCH_BASE64_ENCODED_BASIC_AUTH_STRING",
168
+ description: "The base64 encoded Basic Auth string generated by authorizing username and password to the AirWatch/Workspace ONE instance",
169
+ optional: false,
170
+ type: String,
171
+ verify_block: proc do |value|
172
+ UI.user_error!("The authorization header is empty or the scheme is not basic, pass using `b64_encoded_auth: 'yourb64encodedauthstring'`") unless value and !value.empty?
173
+ end),
174
+
175
+ FastlaneCore::ConfigItem.new(key: :app_identifier,
176
+ env_name: "APP_IDENTIFIER",
177
+ description: "Bundle identifier of your app",
178
+ optional: false,
179
+ type: String,
180
+ verify_block: proc do |value|
181
+ UI.user_error!("No app identifier given, pass using `app_identifier: 'com.example.app'`") unless value and !value.empty?
182
+ end),
183
+
184
+ FastlaneCore::ConfigItem.new(key: :version_number,
185
+ env_name: "AIRWATCH_VERSION_NUMBER",
186
+ description: "Version number of the application to unretire",
187
+ optional: false,
188
+ type: String,
189
+ verify_block: proc do |value|
190
+ UI.user_error!("No version number given, pass using `version_number: '1.0'`") unless value and !value.empty?
191
+ end),
192
+
193
+ FastlaneCore::ConfigItem.new(key: :debug,
194
+ env_name: "AIRWATCH_DEBUG",
195
+ description: "Debug flag, set to true to show extended output. default: false",
196
+ optional: true,
197
+ is_string: false,
198
+ default_value: false)
199
+ ]
200
+ end
201
+
202
+ def self.is_supported?(platform)
203
+ # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
204
+ # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
205
+
206
+ [:ios, :android].include?(platform)
207
+ true
208
+ end
209
+
210
+ # helpers
211
+
212
+ def self.debug
213
+ $is_debug
214
+ end
215
+
216
+ end
217
+ end
218
+ end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module AirwatchWorkspaceone
3
- VERSION = "2.0.0"
3
+ VERSION = "2.1.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-airwatch_workspaceone
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ram Awadhesh Sharan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-11 00:00:00.000000000 Z
11
+ date: 2019-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -180,6 +180,7 @@ files:
180
180
  - lib/fastlane/plugin/airwatch_workspaceone/actions/retire_previous_versions_action.rb
181
181
  - lib/fastlane/plugin/airwatch_workspaceone/actions/retire_specific_version_action.rb
182
182
  - lib/fastlane/plugin/airwatch_workspaceone/actions/unretire_all_versions.rb
183
+ - lib/fastlane/plugin/airwatch_workspaceone/actions/unretire_specific_version_action.rb
183
184
  - lib/fastlane/plugin/airwatch_workspaceone/helper/airwatch_workspaceone_helper.rb
184
185
  - lib/fastlane/plugin/airwatch_workspaceone/version.rb
185
186
  homepage: https://github.com/letsbondiway/fastlane-plugin-airwatch_workspaceone