fastlane-plugin-testappio 2.0.0 → 2.0.1
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6a7fe42f065213d5302bc2f96bc4ec98819aba336138636779c6318572928e62
|
|
4
|
+
data.tar.gz: 5781ea6babf9903fb7b04e0b36c4b29b279a8b5be45e389267c350f48115048a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6e5c989a03a85931a2af4736618bd25e9dbf00538a7e10a90a339aad70615abf4826cf4f4e05d3d44de0bd97c4744256c58f2c929007107200165da35237de67
|
|
7
|
+
data.tar.gz: 572142f620cf0593da8d1250a57cecd4088284853884ac19c64b065b6a1bd59314293b9d6b2c848ff5197126276b7c0fb4072ee33f704b830bb517cbafe79478
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [2.0.1] - 2026-11-21
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
- The lane no longer crashes after a successful upload when the CI shell has no UTF-8 locale; ta-cli output is read as UTF-8.
|
|
14
|
+
- The ta-cli installer download is bounded (connect and total timeouts), so a stalled download cannot hang the lane.
|
|
15
|
+
- The plugin no longer sends its own error reports from customer CI.
|
|
16
|
+
- Fail the lane when ta-cli installation, version checking, updating, or upload fails, including signal termination and failures without stderr.
|
|
17
|
+
- With `self_update: true`, a mandatory-update notice triggers installation and a second version check even when the first check exits nonzero.
|
|
18
|
+
- Set both `TESTAPPIO_API_TOKEN` and `API_TOKEN` in the publish subprocess for compatibility with older CLIs and redact it from command logging and diagnostics.
|
|
19
|
+
|
|
10
20
|
## [2.0.0] - 2026-05-28
|
|
11
21
|
|
|
12
22
|
### Breaking
|
|
@@ -4,13 +4,9 @@ module Fastlane
|
|
|
4
4
|
SUPPORTED_FILE_EXTENSIONS = ["apk", "ipa"]
|
|
5
5
|
|
|
6
6
|
def self.run(params)
|
|
7
|
-
# Check if `ta_cli` exists, install it if not
|
|
8
|
-
unless Helper::TestappioHelper.check_ta_cli
|
|
9
|
-
UI.error("Error detecting ta-cli")
|
|
10
|
-
return
|
|
11
|
-
end
|
|
12
|
-
|
|
13
7
|
api_token = params[:api_token]
|
|
8
|
+
Helper::TestappioHelper.check_ta_cli(api_token)
|
|
9
|
+
|
|
14
10
|
app_id = params[:app_id]
|
|
15
11
|
apk_file = params[:apk_file]
|
|
16
12
|
ipa_file = params[:ipa_file]
|
|
@@ -21,17 +17,12 @@ module Fastlane
|
|
|
21
17
|
notify = params[:notify]
|
|
22
18
|
self_update = params[:self_update]
|
|
23
19
|
|
|
24
|
-
|
|
25
|
-
unless Helper::TestappioHelper.check_update(self_update)
|
|
26
|
-
UI.error("Error updating ta-cli")
|
|
27
|
-
return
|
|
28
|
-
end
|
|
20
|
+
Helper::TestappioHelper.check_update(self_update, api_token)
|
|
29
21
|
|
|
30
22
|
validate_file_path(apk_file) unless release == "ios"
|
|
31
23
|
validate_file_path(ipa_file) unless release == "android"
|
|
32
24
|
|
|
33
25
|
command = ["ta-cli", "publish",
|
|
34
|
-
"--api_token=#{api_token}",
|
|
35
26
|
"--app_id=#{app_id}",
|
|
36
27
|
"--release=#{release}"]
|
|
37
28
|
|
|
@@ -47,7 +38,7 @@ module Fastlane
|
|
|
47
38
|
"--source_version=#{Fastlane::Testappio::VERSION}"]
|
|
48
39
|
|
|
49
40
|
UI.message("Uploading to TestApp.io")
|
|
50
|
-
Helper::TestappioHelper.call_ta_cli(command)
|
|
41
|
+
Helper::TestappioHelper.call_ta_cli(command, api_token)
|
|
51
42
|
UI.success("Successfully uploaded to TestApp.io!")
|
|
52
43
|
end
|
|
53
44
|
|
|
@@ -56,7 +47,7 @@ module Fastlane
|
|
|
56
47
|
|
|
57
48
|
UI.user_error!("No file found at '#{file_path}'.") unless File.exist?(file_path)
|
|
58
49
|
|
|
59
|
-
file_ext = File.extname(file_path).
|
|
50
|
+
file_ext = File.extname(file_path).delete_prefix('.').downcase
|
|
60
51
|
unless SUPPORTED_FILE_EXTENSIONS.include?(file_ext)
|
|
61
52
|
UI.user_error!("file_path is invalid, only files with extensions #{SUPPORTED_FILE_EXTENSIONS} are allowed to be uploaded.")
|
|
62
53
|
end
|
|
@@ -89,6 +80,7 @@ module Fastlane
|
|
|
89
80
|
FastlaneCore::ConfigItem.new(key: :api_token,
|
|
90
81
|
env_name: "TESTAPPIO_API_TOKEN",
|
|
91
82
|
description: "You can get it from https://portal.testapp.io/profile/tokens",
|
|
83
|
+
sensitive: true,
|
|
92
84
|
verify_block: proc do |value|
|
|
93
85
|
UI.user_error!("No API token provided. You can get it from https://portal.testapp.io/profile/tokens") unless value && !value.empty?
|
|
94
86
|
end),
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
require 'fastlane_core/helper'
|
|
1
2
|
require 'fastlane_core/ui/ui'
|
|
2
3
|
require 'open3'
|
|
3
4
|
|
|
@@ -6,26 +7,34 @@ module Fastlane
|
|
|
6
7
|
|
|
7
8
|
module Helper
|
|
8
9
|
class TestappioHelper
|
|
10
|
+
INSTALL_COMMAND = ["bash", "-o", "pipefail", "-c", "curl -fLs --connect-timeout 10 --max-time 60 https://github.com/testappio/cli/releases/latest/download/install | bash"].freeze
|
|
11
|
+
VERSION_COMMAND = ["ta-cli", "version"].freeze
|
|
12
|
+
ENV_WITHOUT_TOKEN = { "TESTAPPIO_API_TOKEN" => nil, "API_TOKEN" => nil }.freeze
|
|
13
|
+
CURRENT_VERSION_NOTICE = /You are using the latest version|ta-cli is (?:already )?up-to-date/i
|
|
14
|
+
REQUIRED_UPDATE_NOTICE = "Update necessary".freeze
|
|
15
|
+
|
|
9
16
|
# Check if `ta_cli` exists, install it if not
|
|
10
|
-
def self.check_ta_cli
|
|
11
|
-
unless
|
|
17
|
+
def self.check_ta_cli(api_token = nil)
|
|
18
|
+
unless FastlaneCore::Helper.which("ta-cli")
|
|
12
19
|
UI.error("ta-cli not found, installing")
|
|
13
20
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
end
|
|
21
|
+
output, stderr, status = capture_cli(INSTALL_COMMAND, api_token)
|
|
22
|
+
fail_command("Error installing ta-cli", status, output, stderr) unless status.success?
|
|
23
|
+
UI.success("ta-cli installed")
|
|
18
24
|
end
|
|
19
25
|
|
|
20
26
|
return true
|
|
21
27
|
end
|
|
22
28
|
|
|
23
29
|
# Check if there is an update available for `ta_cli`, and install it if necessary
|
|
24
|
-
def self.check_update(self_update)
|
|
25
|
-
version_output =
|
|
26
|
-
|
|
30
|
+
def self.check_update(self_update, api_token = nil)
|
|
31
|
+
version_output, version_error, version_status = capture_cli(VERSION_COMMAND, api_token)
|
|
32
|
+
forced = [version_output, version_error].any? { |text| text.include?(REQUIRED_UPDATE_NOTICE) }
|
|
33
|
+
unless version_status.success? || (forced && !version_status.signaled?)
|
|
34
|
+
fail_command("Error checking ta-cli version", version_status, version_output, version_error)
|
|
35
|
+
end
|
|
27
36
|
|
|
28
|
-
if
|
|
37
|
+
if forced
|
|
29
38
|
if self_update
|
|
30
39
|
UI.message("Updating ta-cli due to breaking changes...")
|
|
31
40
|
else
|
|
@@ -40,75 +49,54 @@ module Fastlane
|
|
|
40
49
|
return true
|
|
41
50
|
end
|
|
42
51
|
else
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
update_command = "curl -Ls https://github.com/testappio/cli/releases/latest/download/install | bash"
|
|
48
|
-
update_output, = Open3.capture3(update_command)
|
|
49
|
-
UI.verbose(update_output)
|
|
50
|
-
|
|
51
|
-
if update_output.include?("ta-cli successfully installed") || update_output.include?("ta-cli has been updated")
|
|
52
|
-
version_output = `ta-cli version`
|
|
53
|
-
UI.verbose(version_output)
|
|
54
|
-
|
|
55
|
-
if version_output.include?("Update necessary due to breaking changes") || version_output.include?("New version available")
|
|
56
|
-
UI.user_error!("Error updating ta-cli: the version is still outdated")
|
|
52
|
+
if version_output.match?(CURRENT_VERSION_NOTICE)
|
|
53
|
+
UI.success("ta-cli is already up-to-date")
|
|
57
54
|
else
|
|
58
|
-
UI.
|
|
59
|
-
return true
|
|
55
|
+
UI.important("Version check unavailable. Continuing with the installed ta-cli.")
|
|
60
56
|
end
|
|
61
|
-
|
|
62
|
-
UI.user_error!("Error updating ta-cli: #{update_output}")
|
|
57
|
+
return true
|
|
63
58
|
end
|
|
64
|
-
end
|
|
65
59
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
if error.include?('Error')
|
|
75
|
-
UI.error(error.to_s)
|
|
76
|
-
else
|
|
77
|
-
UI.verbose(error.to_s)
|
|
78
|
-
end
|
|
60
|
+
update_output, update_error, update_status = capture_cli(INSTALL_COMMAND, api_token)
|
|
61
|
+
fail_command("Error updating ta-cli", update_status, update_output, update_error) unless update_status.success?
|
|
62
|
+
version_output, version_error, version_status = capture_cli(VERSION_COMMAND, api_token)
|
|
63
|
+
fail_command("Error checking ta-cli version", version_status, version_output, version_error) if version_status.signaled?
|
|
64
|
+
# A still-forced update exits nonzero, so check the notice before the exit code.
|
|
65
|
+
if [version_output, version_error].any? { |text| text.include?(REQUIRED_UPDATE_NOTICE) } || version_output.include?("New version available")
|
|
66
|
+
UI.user_error!("Error updating ta-cli: the version is still outdated")
|
|
79
67
|
end
|
|
68
|
+
fail_command("Error checking ta-cli version", version_status, version_output, version_error) unless version_status.success?
|
|
80
69
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
70
|
+
if version_output.match?(CURRENT_VERSION_NOTICE)
|
|
71
|
+
UI.success("ta-cli has been updated successfully")
|
|
72
|
+
else
|
|
73
|
+
UI.important("Update installed. Version check unavailable.")
|
|
74
|
+
end
|
|
75
|
+
true
|
|
85
76
|
end
|
|
86
77
|
|
|
87
|
-
#
|
|
88
|
-
#
|
|
89
|
-
|
|
90
|
-
# Uses Open3.popen3 with the command array form (no shell interpretation), so
|
|
91
|
-
# shell metacharacters in api_token / release_notes / file paths are passed
|
|
92
|
-
# literally to ta-cli without need for manual escaping.
|
|
93
|
-
def self.call_ta_cli(command)
|
|
78
|
+
# Stream stdout, keep the token in the child environment, and preserve
|
|
79
|
+
# release notes and file paths as literal arguments.
|
|
80
|
+
def self.call_ta_cli(command, api_token = nil)
|
|
94
81
|
UI.message("Starting ta-cli...")
|
|
95
82
|
if FastlaneCore::Globals.verbose?
|
|
96
83
|
UI.verbose("ta-cli command:\n\n")
|
|
97
|
-
UI.command(
|
|
84
|
+
UI.command(command.map { |argument| redact_token(argument, api_token) }.to_s)
|
|
98
85
|
UI.verbose("\n\n")
|
|
99
86
|
end
|
|
100
87
|
|
|
101
88
|
out = []
|
|
102
|
-
|
|
89
|
+
stderr_lines = []
|
|
103
90
|
out_thread = nil
|
|
104
91
|
err_thread = nil
|
|
105
|
-
Open3.popen3(*command) do |stdin, stdout, stderr, wait_thr|
|
|
92
|
+
Open3.popen3({ "TESTAPPIO_API_TOKEN" => api_token, "API_TOKEN" => api_token }, *command) do |stdin, stdout, stderr, wait_thr|
|
|
106
93
|
stdin.close
|
|
107
94
|
|
|
108
95
|
# Read stdout and stderr concurrently to avoid deadlock when ta-cli
|
|
109
96
|
# fills one buffer before we finish draining the other.
|
|
110
97
|
out_thread = Thread.new do
|
|
111
98
|
while (line = stdout.gets)
|
|
99
|
+
line = redact_token(line, api_token)
|
|
112
100
|
out << line
|
|
113
101
|
UI.message(line.strip) unless line.strip.empty?
|
|
114
102
|
end
|
|
@@ -116,7 +104,7 @@ module Fastlane
|
|
|
116
104
|
|
|
117
105
|
err_thread = Thread.new do
|
|
118
106
|
while (line = stderr.gets)
|
|
119
|
-
|
|
107
|
+
stderr_lines << redact_token(line, api_token)
|
|
120
108
|
end
|
|
121
109
|
end
|
|
122
110
|
|
|
@@ -124,23 +112,42 @@ module Fastlane
|
|
|
124
112
|
err_thread.join
|
|
125
113
|
|
|
126
114
|
exit_status = wait_thr.value
|
|
127
|
-
|
|
115
|
+
fail_command("Error while calling ta-cli", exit_status, stderr_lines.join) unless exit_status.success?
|
|
128
116
|
end
|
|
129
117
|
out.join
|
|
130
118
|
ensure
|
|
131
119
|
# If popen3's block raised before threads joined, make sure no readers
|
|
132
120
|
# are left holding pipe FDs.
|
|
133
|
-
out_thread
|
|
134
|
-
err_thread
|
|
121
|
+
out_thread.kill if out_thread&.alive?
|
|
122
|
+
err_thread.kill if err_thread&.alive?
|
|
135
123
|
end
|
|
136
124
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
125
|
+
def self.capture_cli(command, api_token)
|
|
126
|
+
output, stderr, status = Open3.capture3(ENV_WITHOUT_TOKEN, *command)
|
|
127
|
+
output = redact_token(output, api_token)
|
|
128
|
+
stderr = redact_token(stderr, api_token)
|
|
129
|
+
UI.verbose(output) unless output.empty?
|
|
130
|
+
UI.verbose(stderr) unless stderr.empty?
|
|
131
|
+
[output, stderr, status]
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
def self.fail_command(message, status, *diagnostics)
|
|
135
|
+
reason = status.signaled? ? "signal #{status.termsig}" : "exit status #{status.exitstatus}"
|
|
136
|
+
message = "#{message} (#{reason})"
|
|
137
|
+
diagnostic = diagnostics.flat_map(&:lines).map(&:strip).reject(&:empty?).join(" | ")
|
|
138
|
+
message = "#{message}: #{diagnostic}" unless diagnostic.empty?
|
|
139
|
+
UI.user_error!(message)
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
# ta-cli prints UTF-8. A CI shell without a UTF-8 locale tags its output
|
|
143
|
+
# US-ASCII, so read it as UTF-8 and replace bytes that are not valid.
|
|
144
|
+
def self.redact_token(text, api_token)
|
|
145
|
+
text = text.dup.force_encoding(Encoding::UTF_8).scrub
|
|
146
|
+
return text if api_token.to_s.empty?
|
|
147
|
+
|
|
148
|
+
text.gsub(api_token, "********")
|
|
142
149
|
end
|
|
143
|
-
private_class_method :
|
|
150
|
+
private_class_method :capture_cli, :fail_command, :redact_token
|
|
144
151
|
end
|
|
145
152
|
end
|
|
146
153
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fastlane-plugin-testappio
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.0.
|
|
4
|
+
version: 2.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- TestApp.io
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-11-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|