fastlane-plugin-waldo 3.2.0 → 3.4.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
2
  SHA256:
3
- metadata.gz: 8382365c0ea6f5bbeb6bf55302d06ff08b9c2b58f20b70a65a7519b6c6b19a7d
4
- data.tar.gz: 6e9cadfb12cea129d362cda805ced4e6b3bb96b4b075af5345ce794f886d6b88
3
+ metadata.gz: 262f2c56bf49ff9cc6896fa725a266eab835f5a99d9f92cabdefd51c0068be7c
4
+ data.tar.gz: c901f8111d55dbe421985e1e0b149f48e5a2141c3c20002b637782aea9a44ed9
5
5
  SHA512:
6
- metadata.gz: c53abad57353855c54c9dec994b3af36234db443df0552c7a8e3e9fe7e52d1414359b3dd5f59bcb445d9dfeabf457ab1a52eac891ba5f9a0dd78a604b9e875ff
7
- data.tar.gz: 2baeb36edcc08caf4a51318eb6d6d9b0566ba9bfdfc035b8cb5c3a2378474b7c17788951792664ba0d0bfb7b08df3dfa76b0d4823f5fb7b67eb8b7f10a7201fa
6
+ metadata.gz: 07fcae2e1d6786e5cf0a474369cc3be9e698fc2bafac5eb97786c4b6b7505bdd64e6b3950e3c9659784ea3c5668d851f8deecae9b4eac06b31641c56963d999c
7
+ data.tar.gz: 7dd6cb3c6ed22aecc2233e8b6c14e4ce3976a63276c7f7d214dae0469d4cfb15064dde550b87138e2419bb622cdf25910769e829069a988bd8c54889bdf0bcec
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- © 2018–2022 Amolo Atelier, Inc.
3
+ © 2018–2024 Amolo Atelier, Inc.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -19,7 +19,7 @@ which allows you to upload an iOS or Android build to Waldo for processing.
19
19
 
20
20
  ## Usage
21
21
 
22
- To get started, first obtain an upload token from Waldo for your app. These are
22
+ To get started, first obtain a CI token from Waldo for your app. These are
23
23
  used to authenticate with the Waldo backend on each call.
24
24
 
25
25
  ### Uploading an iOS Simulator Build
@@ -44,7 +44,7 @@ You can then find your app relative to the derived data path:
44
44
  app_path = File.join(derived_data_path,
45
45
  'Build',
46
46
  'Products',
47
- 'ReleaseSim-iphonesimulator',
47
+ 'Release-iphonesimulator',
48
48
  'YourApp.app')
49
49
  ```
50
50
 
@@ -56,30 +56,9 @@ waldo(upload_token: '0123456789abcdef0123456789abcdef',
56
56
  app_path: '/path/to/YourApp.app')
57
57
  ```
58
58
 
59
- > **Note:** You _must_ specify _both_ the Waldo upload token _and_ the path of
59
+ > **Note:** You _must_ specify _both_ the Waldo CI token _and_ the path of
60
60
  > the `.app`.
61
61
 
62
- ### Uploading an iOS Device Build
63
-
64
- Build a new IPA for your app. If you use `gym` (aka `build_ios_app`) to build
65
- your IPA, `waldo` will automatically find and upload the generated IPA.
66
-
67
- ```ruby
68
- gym(export_method: 'ad-hoc') # or 'development'
69
-
70
- waldo(upload_token: '0123456789abcdef0123456789abcdef')
71
- ```
72
-
73
- > **Note:** You _must_ specify the Waldo upload token.
74
-
75
- If you do _not_ use `gym` to build your IPA, you will need to explicitly
76
- specify the IPA path to `waldo`:
77
-
78
- ```ruby
79
- waldo(upload_token: '0123456789abcdef0123456789abcdef',
80
- ipa_path: '/path/to/YourApp.ipa')
81
- ```
82
-
83
62
  ### Uploading an Android Build
84
63
 
85
64
  Build a new APK for your app. If you use `gradle` to build your APK, `waldo`
@@ -92,7 +71,7 @@ gradle(task: 'assemble',
92
71
  waldo(upload_token: '0123456789abcdef0123456789abcdef')
93
72
  ```
94
73
 
95
- > **Note:** You _must_ specify the Waldo upload token.
74
+ > **Note:** You _must_ specify the Waldo CI token.
96
75
 
97
76
  If you do _not_ use `gradle` to build your APK, you will need to explicitly
98
77
  specify the APK path to `waldo`:
@@ -1,5 +1,9 @@
1
1
  module Fastlane
2
2
  module Actions
3
+ module SharedValues
4
+ WALDO_BUILD_ID = :WALDO_BUILD_ID
5
+ end
6
+
3
7
  class WaldoAction < Action
4
8
  def self.run(params)
5
9
  mparams = Helper::WaldoHelper.filter_parameters(params)
@@ -21,12 +25,6 @@ module Fastlane
21
25
  env_name: 'WALDO_APP_PATH',
22
26
  description: 'Path to your app file',
23
27
  optional: true),
24
- FastlaneCore::ConfigItem.new(key: :ipa_path,
25
- env_name: 'WALDO_IPA_PATH',
26
- description: 'Path to your IPA file (optional if you use the _gym_ or _xcodebuild_ action)',
27
- default_value: Actions.lane_context[Actions::SharedValues::IPA_OUTPUT_PATH],
28
- default_value_dynamic: true,
29
- optional: true),
30
28
  # Android-specific
31
29
  FastlaneCore::ConfigItem.new(key: :apk_path,
32
30
  env_name: 'WALDO_APK_PATH',
@@ -73,10 +71,6 @@ module Fastlane
73
71
  apk_path: './YourApp.apk',
74
72
  upload_token: '...'
75
73
  )",
76
- "waldo(
77
- ipa_path: './YourApp.ipa',
78
- upload_token: '...'
79
- )",
80
74
  "waldo(
81
75
  app_path: './YourApp.app',
82
76
  upload_token: '...'
@@ -87,6 +81,12 @@ module Fastlane
87
81
  def self.is_supported?(platform)
88
82
  [:android, :ios].include?(platform)
89
83
  end
84
+
85
+ def self.output
86
+ [
87
+ ['WALDO_BUILD_ID', 'ID of the uploaded build']
88
+ ]
89
+ end
90
90
  end
91
91
  end
92
92
  end
@@ -1,6 +1,7 @@
1
1
  module Fastlane
2
2
  module Helper
3
3
  class WaldoHelper
4
+ require 'json'
4
5
  require 'net/http'
5
6
 
6
7
  def self.determine_asset_name
@@ -30,7 +31,7 @@ module Fastlane
30
31
  "waldo-agent-#{os}-#{arch}#{ext}"
31
32
  end
32
33
 
33
- def self.download(uri, path)
34
+ def self.download(uri, path, retryAllowed)
34
35
  begin
35
36
  request_uri = uri.request_uri
36
37
  response = nil
@@ -43,14 +44,26 @@ module Fastlane
43
44
  uri = URI.parse(response['location'])
44
45
  end
45
46
 
47
+ code = response.code.to_i
48
+
49
+ if code < 200 || code > 299
50
+ UI.error("Unable to download #{request_uri}, HTTP status: #{response.code}")
51
+
52
+ return retryAllowed && shouldRetry?(response)
53
+ end
54
+
46
55
  fp = File.open(path, 'wb')
47
56
 
48
57
  fp.write(response.body)
49
58
  rescue => exc
50
59
  UI.error("Unable to download #{request_uri}: #{exc.inspect.to_s}")
60
+
61
+ return retryAllowed
51
62
  ensure
52
63
  fp.close if fp
53
64
  end
65
+
66
+ return false
54
67
  end
55
68
 
56
69
  def self.download_binary
@@ -62,13 +75,27 @@ module Fastlane
62
75
 
63
76
  binary_path = File.join(Dir.tmpdir, 'waldo-agent')
64
77
 
65
- download(URI(uri_string), binary_path)
78
+ maxDownloadAttempts = 2
79
+
80
+ for attempts in 1..maxDownloadAttempts do
81
+ doRetry = download(URI(uri_string), binary_path, attempts < maxDownloadAttempts)
82
+
83
+ break unless doRetry
84
+
85
+ UI.message("Failed download attempts: #{attempts} -- retrying…")
86
+ end
66
87
 
67
88
  File.chmod(0755, binary_path)
68
89
 
69
90
  binary_path
70
91
  end
71
92
 
93
+ def self.extract_build_id(output)
94
+ last_line = output.lines(chomp: true).last
95
+
96
+ JSON.parse(last_line, {symbolize_names: true})[:appVersionID]
97
+ end
98
+
72
99
  def self.filter_parameters(in_params)
73
100
  out_params = {}
74
101
 
@@ -76,39 +103,14 @@ module Fastlane
76
103
  app_path = in_params[:app_path]
77
104
  git_branch = in_params[:git_branch]
78
105
  git_commit = in_params[:git_commit]
79
- ipa_path = in_params[:ipa_path]
80
106
  upload_token = in_params[:upload_token]
81
107
  variant_name = in_params[:variant_name] || Actions.lane_context[Actions::SharedValues::GRADLE_BUILD_TYPE]
82
108
 
83
109
  apk_path.gsub!('\\ ', ' ') if apk_path
84
110
  app_path.gsub!('\\ ', ' ') if app_path
85
- ipa_path.gsub!('\\ ', ' ') if ipa_path
86
111
 
87
112
  out_params[:apk_path] = apk_path if apk_path
88
-
89
- if app_path && ipa_path
90
- if !File.exist?(app_path)
91
- out_params[:ipa_path] = ipa_path
92
-
93
- app_path = nil
94
- elsif !File.exist?(ipa_path)
95
- out_params[:app_path] = app_path
96
-
97
- ipa_path = nil
98
- elsif File.mtime(app_path) < File.mtime(ipa_path)
99
- out_params[:ipa_path] = ipa_path
100
-
101
- app_path = nil
102
- else
103
- out_params[:app_path] = app_path
104
-
105
- ipa_path = nil
106
- end
107
- else
108
- out_params[:app_path] = app_path if app_path
109
- out_params[:ipa_path] = ipa_path if ipa_path
110
- end
111
-
113
+ out_params[:app_path] = app_path if app_path
112
114
  out_params[:git_branch] = git_branch if git_branch
113
115
  out_params[:git_commit] = git_commit if git_commit
114
116
  out_params[:upload_token] = upload_token if upload_token
@@ -117,17 +119,18 @@ module Fastlane
117
119
  out_params
118
120
  end
119
121
 
122
+ def self.shouldRetry?(response)
123
+ [408, 429, 500, 502, 503, 504].include?(response.code.to_i)
124
+ end
125
+
120
126
  def self.upload_build(params)
121
127
  apk_path = params[:apk_path]
122
128
  app_path = params[:app_path]
123
- ipa_path = params[:ipa_path]
124
129
 
125
130
  if apk_path
126
131
  build_path = apk_path
127
132
  elsif app_path
128
133
  build_path = app_path
129
- elsif ipa_path
130
- build_path = ipa_path
131
134
  else
132
135
  build_path = ''
133
136
  end
@@ -164,11 +167,11 @@ module Fastlane
164
167
 
165
168
  command << build_path.shellescape
166
169
 
167
- Actions.sh_control_output(command.join(' '),
168
- print_command: FastlaneCore::Globals.verbose?,
169
- print_command_output: true) do |error|
170
- # do nothing special, for now
171
- end
170
+ output = Actions.sh_control_output(command.join(' '),
171
+ print_command: FastlaneCore::Globals.verbose?,
172
+ print_command_output: true)
173
+
174
+ Actions.lane_context[Actions::SharedValues::WALDO_BUILD_ID] = extract_build_id(output)
172
175
  end
173
176
  end
174
177
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Waldo
3
- VERSION = "3.2.0"
3
+ VERSION = "3.4.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-waldo
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0
4
+ version: 3.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Pusey
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-26 00:00:00.000000000 Z
11
+ date: 2024-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -67,7 +67,7 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  description:
70
- email: john@waldo.io
70
+ email: j.pusey@tricentis.com
71
71
  executables: []
72
72
  extensions: []
73
73
  extra_rdoc_files: []
@@ -97,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
97
97
  - !ruby/object:Gem::Version
98
98
  version: '0'
99
99
  requirements: []
100
- rubygems_version: 3.0.3.1
100
+ rubygems_version: 3.2.3
101
101
  signing_key:
102
102
  specification_version: 4
103
103
  summary: Upload build to Waldo