Skip to content

Commit 8355581

Browse files
authored
feat!: Remove deprecated parameters api_key and force_foreground (#376)
BREAKING CHANGE: Remove deprecated parameters api_key and force_foreground. - Remove api_key parameter from sentry_config.rb - Remove SENTRY_API_KEY environment variable support - Remove force_foreground parameter from sentry_debug_files_upload.rb - Update all spec files to use auth_token instead of api_key - Remove force_foreground test from spec - Update README.md to remove api_key and force_foreground mentions - Update CHANGELOG.md with breaking changes Users should migrate from api_key to auth_token for authentication. Users should remove force_foreground parameter from their Fastfiles.
1 parent 362aa77 commit 8355581

File tree

8 files changed

+33
-86
lines changed

8 files changed

+33
-86
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ Due to sentry-cli 3.0.0 upgrade, the following breaking changes have been made (
88

99
- **`sentry_upload_file` action has been removed**: The `releases files` commands were removed in sentry-cli 3.0.0. Users should migrate to `sentry_upload_sourcemap` for source maps or other specialized upload actions.
1010
- **`android_manifest_path` parameter in `sentry_upload_proguard` has been removed**: The `--android-manifest` argument was removed in sentry-cli 3.0.0 and is no longer needed. Any Fastfiles still using this parameter will need to remove it.
11+
- **`api_key` parameter has been removed**: The `api_key` parameter has been removed in favor of `auth_token`. All actions now require `auth_token` for authentication. Users should update their Fastfiles to use `auth_token` instead of `api_key`. ([#376](https://github.com/getsentry/sentry-fastlane-plugin/pull/376))
12+
- **`force_foreground` parameter has been removed**: This parameter was deprecated as a no-op since v1.26.0 and has now been removed from `sentry_debug_files_upload`. Users should remove this parameter from their Fastfiles. ([#376](https://github.com/getsentry/sentry-fastlane-plugin/pull/376))
1113
- **`sentry_upload_dsym` action has been removed**: This action has been deprecated in favor of `sentry_debug_files_upload`. Users should migrate to `sentry_debug_files_upload` with the appropriate `path` parameter. ([#375](https://github.com/getsentry/sentry-fastlane-plugin/pull/375))
1214
- **`sentry_upload_dif` action has been removed**: This action has been deprecated in favor of `sentry_debug_files_upload`. Users should migrate to `sentry_debug_files_upload` with the appropriate `path` parameter. ([#375](https://github.com/getsentry/sentry-fastlane-plugin/pull/375))
1315

README.md

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,16 @@ A subset of actions provided by the CLI: https://docs.sentry.io/learn/cli/
5050

5151
### Authentication & Configuration
5252

53-
`auth_token` is the preferred authentication method with Sentry. This can be obtained on https://sentry.io/api/.
54-
`api_key` still works but will eventually become deprecated. This can be obtained through the settings of your project.
53+
`auth_token` is the authentication method with Sentry. This can be obtained on https://sentry.io/api/.
5554
Also note that as of version `1.2.0` you no longer have to provide the required parameters, we will try to fallback to your `.sentryclirc` config file if possible.
5655

57-
The following environment variables may be used in place of parameters: `SENTRY_API_KEY`, `SENTRY_AUTH_TOKEN`, `SENTRY_ORG_SLUG`, and `SENTRY_PROJECT_SLUG`.
56+
The following environment variables may be used in place of parameters: `SENTRY_AUTH_TOKEN`, `SENTRY_ORG_SLUG`, and `SENTRY_PROJECT_SLUG`.
5857

5958
### Uploading Debug Information Files
6059

6160
```ruby
6261
sentry_debug_files_upload(
63-
api_key: '...', # Do not use if using auth_token
64-
auth_token: '...', # Do not use if using api_key
62+
auth_token: '...',
6563
org_slug: '...',
6664
project_slug: '...',
6765
path: '/path/to/files', # Optional. Defaults to '.' when no value is provided. Path(s) can be a string, a comma-separated string, or an array of strings.
@@ -83,7 +81,6 @@ Further options:
8381
- __no_zips__: Do not search in ZIP files.
8482
- __info_plist__: Optional. Optional path to the Info.plist. We will try to find this automatically if run from Xcode. Providing this information will associate the debug symbols with a specific ITC application and build in Sentry. Note that if you provide the plist explicitly it must already be processed.
8583
- __no_reprocessing__: Optional. Do not trigger reprocessing after uploading.
86-
- __force_foreground__: Optional. __Deprecated NoOp since 1.26.0. Before v 1.26.0__: Wait for the process to finish. By default, the upload process will detach and continue in the background when triggered from Xcode. When an error happens, a dialog is shown. If this parameter is passed Xcode will wait for the process to finish before the build finishes and output will be shown in the Xcode build output.
8784
- __include_sources__: Optional. Include sources from the local file system and upload them as source bundles.
8885
- __wait__: Wait for the server to fully process uploaded files. Errors can only be displayed if --wait is specified, but this will significantly slow down the upload process.
8986
- __upload_symbol_maps__: Optional. Upload any BCSymbolMap files found to allow Sentry to resolve hidden symbols, e.g. when it downloads dSYMs directly from App Store Connect or when you upload dSYMs without first resolving the hidden symbols using --symbol-maps.
@@ -94,8 +91,7 @@ Upload iOS build archives (.xcarchive) to Sentry for improved symbolication and
9491

9592
```ruby
9693
sentry_upload_build(
97-
api_key: '...', # Do not use if using auth_token
98-
auth_token: '...', # Do not use if using api_key
94+
auth_token: '...',
9995
org_slug: '...',
10096
project_slug: '...',
10197
xcarchive_path: './build/MyApp.xcarchive', # Path to your .xcarchive file
@@ -120,7 +116,6 @@ This action is only supported on iOS platform.
120116

121117
```ruby
122118
sentry_create_release(
123-
api_key: '...',
124119
auth_token: '...',
125120
org_slug: '...',
126121
project_slug: '...',
@@ -136,7 +131,6 @@ Useful for uploading build artifacts and JS sourcemaps for react-native apps bui
136131

137132
```ruby
138133
sentry_upload_sourcemap(
139-
api_key: '...',
140134
auth_token: '...',
141135
org_slug: '...',
142136
project_slug: '...',
@@ -153,8 +147,7 @@ sentry_upload_sourcemap(
153147

154148
```ruby
155149
sentry_upload_proguard(
156-
api_key: '...', # Do not use if using auth_token
157-
auth_token: '...', # Do not use if using api_key
150+
auth_token: '...',
158151
org_slug: '...',
159152
project_slug: '...',
160153
android_manifest_path: 'path to merged AndroidManifest file', # found in `app/build/intermediates/manifests/full`
@@ -184,8 +177,7 @@ Creates a new release deployment for a project on Sentry.
184177

185178
```ruby
186179
sentry_create_deploy(
187-
api_key: '...', # Do not use if using auth_token
188-
auth_token: '...', # Do not use if using api_key
180+
auth_token: '...',
189181
org_slug: '...',
190182
project_slug: '...',
191183
version: '...',

lib/fastlane/plugin/sentry/actions/sentry_debug_files_upload.rb

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ def self.run(params)
2626
command.push('--no-zips') unless params[:no_zips].nil?
2727
command.push('--info-plist').push(params[:info_plist]) unless params[:info_plist].nil?
2828
command.push('--no-reprocessing') unless params[:no_reprocessing].nil?
29-
command.push('--force-foreground') unless params[:force_foreground].nil?
3029
command.push('--include-sources') unless params[:include_sources] != true
3130
command.push('--wait') unless params[:wait].nil?
3231
command.push('--upload-symbol-maps') unless params[:upload_symbol_maps].nil?
@@ -120,15 +119,6 @@ def self.available_options
120119
description: "Do not trigger reprocessing after uploading",
121120
is_string: false,
122121
optional: true),
123-
FastlaneCore::ConfigItem.new(key: :force_foreground,
124-
description: "Wait for the process to finish.{n}\
125-
By default, the upload process will detach and continue in the \
126-
background when triggered from Xcode. When an error happens, \
127-
a dialog is shown. If this parameter is passed Xcode will wait \
128-
for the process to finish before the build finishes and output \
129-
will be shown in the Xcode build output",
130-
is_string: false,
131-
optional: true),
132122
FastlaneCore::ConfigItem.new(key: :include_sources,
133123
description: "Include sources from the local file system and upload \
134124
them as source bundles",

lib/fastlane/plugin/sentry/helper/sentry_config.rb

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ def self.common_api_config_items
2424
env_name: "SENTRY_AUTH_TOKEN",
2525
description: "Authentication token for Sentry",
2626
optional: true),
27-
FastlaneCore::ConfigItem.new(key: :api_key,
28-
env_name: "SENTRY_API_KEY",
29-
description: "API key for Sentry",
30-
optional: true),
3127
FastlaneCore::ConfigItem.new(key: :org_slug,
3228
env_name: "SENTRY_ORG_SLUG",
3329
description: "Organization slug for Sentry project",
@@ -51,14 +47,12 @@ def self.parse_api_params(params)
5147

5248
url = params[:url]
5349
auth_token = params[:auth_token]
54-
api_key = params[:api_key]
5550
org = params[:org_slug]
5651
project = params[:project_slug]
5752
log_level = params[:log_level]
5853

5954
has_org = !org.to_s.empty?
6055
has_project = !project.to_s.empty?
61-
has_api_key = !api_key.to_s.empty?
6256
has_auth_token = !auth_token.to_s.empty?
6357

6458
ENV['SENTRY_URL'] = url unless url.to_s.empty?
@@ -70,18 +64,13 @@ def self.parse_api_params(params)
7064
end
7165

7266
# Fallback to .sentryclirc if possible when no auth token is provided
73-
if !has_api_key && !has_auth_token && fallback_sentry_cli_auth(params)
67+
if !has_auth_token && fallback_sentry_cli_auth(params)
7468
UI.important("No auth config provided, will fallback to .sentryclirc")
7569
else
76-
# Will fail if none or both authentication methods are provided
77-
if !has_api_key && !has_auth_token
78-
UI.user_error!("No API key or authentication token found for SentryAction given, pass using `api_key: 'key'` or `auth_token: 'token'`")
79-
elsif has_api_key && has_auth_token
80-
UI.user_error!("Both API key and authentication token found for SentryAction given, please only give one")
81-
elsif has_api_key && !has_auth_token
82-
UI.deprecated("Please consider switching to auth_token ... api_key will be removed in the future")
70+
# Will fail if no authentication token is provided
71+
unless has_auth_token
72+
UI.user_error!("No authentication token found for SentryAction given, pass using `auth_token: 'token'`")
8373
end
84-
ENV['SENTRY_API_KEY'] = api_key unless api_key.to_s.empty?
8574
ENV['SENTRY_AUTH_TOKEN'] = auth_token unless auth_token.to_s.empty?
8675
end
8776

spec/sentry_config_spec.rb

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,46 +8,47 @@
88

99
describe "parse_api_params" do
1010
it "does not set env if no value" do
11-
Fastlane::Helper::SentryConfig.parse_api_params({ api_key: 'fixture-api-key' })
11+
Fastlane::Helper::SentryConfig.parse_api_params({ auth_token: 'fixture-auth-token' })
1212
expect(ENV['SENTRY_LOG_LEVEL']).to be_nil
1313
end
1414

1515
it "sets debug env if Fastlane is set to verbose" do
1616
FastlaneCore::Globals.verbose = true
17-
Fastlane::Helper::SentryConfig.parse_api_params({ api_key: 'fixture-api-key' })
17+
Fastlane::Helper::SentryConfig.parse_api_params({ auth_token: 'fixture-auth-token' })
1818
expect(ENV['SENTRY_LOG_LEVEL']).to eq('debug')
1919
end
2020

2121
it "sets trace env" do
22-
Fastlane::Helper::SentryConfig.parse_api_params({ api_key: 'fixture-api-key', log_level: 'trace' })
22+
Fastlane::Helper::SentryConfig.parse_api_params({ auth_token: 'fixture-auth-token', log_level: 'trace' })
2323
expect(ENV['SENTRY_LOG_LEVEL']).to eq('trace')
2424
end
2525

2626
it "sets debug env" do
27-
Fastlane::Helper::SentryConfig.parse_api_params({ api_key: 'fixture-api-key', log_level: 'debug' })
27+
Fastlane::Helper::SentryConfig.parse_api_params({ auth_token: 'fixture-auth-token', log_level: 'debug' })
2828
expect(ENV['SENTRY_LOG_LEVEL']).to eq('debug')
2929
end
3030

3131
it "sets info env" do
32-
Fastlane::Helper::SentryConfig.parse_api_params({ api_key: 'fixture-api-key', log_level: 'info' })
32+
Fastlane::Helper::SentryConfig.parse_api_params({ auth_token: 'fixture-auth-token', log_level: 'info' })
3333
expect(ENV['SENTRY_LOG_LEVEL']).to eq('info')
3434
end
3535

3636
it "sets warn env" do
37-
Fastlane::Helper::SentryConfig.parse_api_params({ api_key: 'fixture-api-key', log_level: 'warn' })
37+
Fastlane::Helper::SentryConfig.parse_api_params({ auth_token: 'fixture-auth-token', log_level: 'warn' })
3838
expect(ENV['SENTRY_LOG_LEVEL']).to eq('warn')
3939
end
4040

4141
it "sets error env" do
42-
Fastlane::Helper::SentryConfig.parse_api_params({ api_key: 'fixture-api-key', log_level: 'error' })
42+
Fastlane::Helper::SentryConfig.parse_api_params({ auth_token: 'fixture-auth-token', log_level: 'error' })
4343
expect(ENV['SENTRY_LOG_LEVEL']).to eq('error')
4444
end
4545

4646
it "raise error on invalid log_level" do
4747
expect do
4848
Fastlane::FastFile.new.parse("lane :test do
4949
sentry_debug_files_upload(
50-
api_key: 'fixture-api-key',
50+
auth_token: 'fixture-auth-token',
51+
path: 'fixture-path',
5152
log_level: 'unknown'
5253
)
5354
end").runner.execute(:test)

spec/sentry_debug_files_upload_spec.rb

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -260,18 +260,6 @@
260260
end").runner.execute(:test)
261261
end
262262

263-
it "includes --force_foreground when true" do
264-
expect(Fastlane::Helper::SentryConfig).to receive(:parse_api_params).and_return(true)
265-
expect(Fastlane::Helper::SentryHelper).to receive(:call_sentry_cli).with(anything, ["debug-files", "upload", "fixture-path", "--force-foreground"]).and_return(true)
266-
267-
Fastlane::FastFile.new.parse("lane :test do
268-
sentry_debug_files_upload(
269-
path: 'fixture-path',
270-
force_foreground: true
271-
)
272-
end").runner.execute(:test)
273-
end
274-
275263
it "includes --include_sources when true" do
276264
expect(Fastlane::Helper::SentryConfig).to receive(:parse_api_params).and_return(true)
277265
expect(Fastlane::Helper::SentryHelper).to receive(:call_sentry_cli).with(anything, ["debug-files", "upload", "fixture-path", "--include-sources"]).and_return(true)

spec/sentry_upload_proguard_spec.rb

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,14 @@
11
describe Fastlane do
22
describe Fastlane::FastFile do
33
describe "upload proguard" do
4-
it "fails with API key and auth token" do
5-
mapping_path = File.absolute_path './assets/AndroidExample.mapping.txt'
6-
7-
expect do
8-
Fastlane::FastFile.new.parse("lane :test do
9-
sentry_upload_proguard(
10-
org_slug: 'some_org',
11-
api_key: 'something123',
12-
auth_token: 'something123',
13-
project_slug: 'some_project',
14-
mapping_path: '#{mapping_path}')
15-
end").runner.execute(:test)
16-
end.to raise_error("Both API key and authentication token found for SentryAction given, please only give one")
17-
end
18-
194
it "fails with invalid mapping path" do
205
mapping_path = File.absolute_path './assets/this.does.not.exist.mapping.txt'
216

227
expect do
238
Fastlane::FastFile.new.parse("lane :test do
249
sentry_upload_proguard(
2510
org_slug: 'some_org',
26-
api_key: 'something123',
11+
auth_token: 'something123',
2712
project_slug: 'some_project',
2813
mapping_path: '#{mapping_path}')
2914
end").runner.execute(:test)

spec/sentry_upload_sourcemap_spec.rb

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
Fastlane::FastFile.new.parse("lane :test do
88
sentry_upload_sourcemap(
99
org_slug: 'some_org',
10-
api_key: 'something123',
10+
auth_token: 'something123',
1111
project_slug: 'some_project',
1212
sourcemap: '#{sourcemap_path}')
1313
end").runner.execute(:test)
@@ -24,7 +24,7 @@
2424
Fastlane::FastFile.new.parse("lane :test do
2525
sentry_upload_sourcemap(
2626
org_slug: 'some_org',
27-
api_key: 'something123',
27+
auth_token: 'something123',
2828
project_slug: 'some_project',
2929
version: '1.0',
3030
sourcemap: '1.map',
@@ -43,7 +43,7 @@
4343
Fastlane::FastFile.new.parse("lane :test do
4444
sentry_upload_sourcemap(
4545
org_slug: 'some_org',
46-
api_key: 'something123',
46+
auth_token: 'something123',
4747
project_slug: 'some_project',
4848
version: '1.0',
4949
dist: 'dem',
@@ -63,7 +63,7 @@
6363
Fastlane::FastFile.new.parse("lane :test do
6464
sentry_upload_sourcemap(
6565
org_slug: 'some_org',
66-
api_key: 'something123',
66+
auth_token: 'something123',
6767
project_slug: 'some_project',
6868
version: '1.0',
6969
dist: 'dem',
@@ -83,7 +83,7 @@
8383
Fastlane::FastFile.new.parse("lane :test do
8484
sentry_upload_sourcemap(
8585
org_slug: 'some_org',
86-
api_key: 'something123',
86+
auth_token: 'something123',
8787
project_slug: 'some_project',
8888
version: '1.0',
8989
dist: 'dem',
@@ -105,7 +105,7 @@
105105
Fastlane::FastFile.new.parse("lane :test do
106106
sentry_upload_sourcemap(
107107
org_slug: 'some_org',
108-
api_key: 'something123',
108+
auth_token: 'something123',
109109
project_slug: 'some_project',
110110
version: '1.0',
111111
dist: 'dem',
@@ -126,7 +126,7 @@
126126
Fastlane::FastFile.new.parse("lane :test do
127127
sentry_upload_sourcemap(
128128
org_slug: 'some_org',
129-
api_key: 'something123',
129+
auth_token: 'something123',
130130
project_slug: 'some_project',
131131
version: '1.0',
132132
dist: 'dem',
@@ -145,7 +145,7 @@
145145
Fastlane::FastFile.new.parse("lane :test do
146146
sentry_upload_sourcemap(
147147
org_slug: 'some_org',
148-
api_key: 'something123',
148+
auth_token: 'something123',
149149
project_slug: 'some_project',
150150
version: '1.0',
151151
dist: 'dem',
@@ -163,7 +163,7 @@
163163
Fastlane::FastFile.new.parse("lane :test do
164164
sentry_upload_sourcemap(
165165
org_slug: 'some_org',
166-
api_key: 'something123',
166+
auth_token: 'something123',
167167
project_slug: 'some_project',
168168
version: '1.0',
169169
dist: 'dem',
@@ -184,7 +184,7 @@
184184
Fastlane::FastFile.new.parse("lane :test do
185185
sentry_upload_sourcemap(
186186
org_slug: 'some_org',
187-
api_key: 'something123',
187+
auth_token: 'something123',
188188
project_slug: 'some_project',
189189
version: '1.0',
190190
dist: 'dem',
@@ -205,7 +205,7 @@
205205
Fastlane::FastFile.new.parse("lane :test do
206206
sentry_upload_sourcemap(
207207
org_slug: 'some_org',
208-
api_key: 'something123',
208+
auth_token: 'something123',
209209
project_slug: 'some_project',
210210
version: '1.0',
211211
dist: 'dem',

0 commit comments

Comments
 (0)