fastlane-plugin-uninow-sentry 2.0.2

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 9dc9bd50d96b891196f6da398e3bccf4d20fa8688fa0980bfa9d9b8d47028621
4
+ data.tar.gz: 37c4958f9ac257139751057ee7732d973d1aa208e75e272d3171d008fa3930a3
5
+ SHA512:
6
+ metadata.gz: 037ae6017343a88d9b111d1aefb346230371c188fd83d2996a89c6b5908919e95f992dde7ca86612644df3ab5c9fcb5c34ff8fb51a9ff5a92f2514918d2dfc40
7
+ data.tar.gz: 1d6e8d7250997e54ad7282b4fc35812f7d83289a445dc17f97a7b1346178d809e35612970a465f70068363bf38694a3bd2dee8c4087a5293a2657c01c9b010c3
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Sentry
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 ADDED
@@ -0,0 +1,135 @@
1
+ <p align="center">
2
+ <a href="https://sentry.io" target="_blank" align="center">
3
+ <img src="https://sentry-brand.storage.googleapis.com/sentry-logo-black.png" width="280">
4
+ </a>
5
+ <br/>
6
+ <h1>Sentry Fastlane Plugin</h1>
7
+ </p>
8
+
9
+ [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-sentry)
10
+ [![Build Status](https://img.shields.io/travis/getsentry/fastlane-plugin-sentry/master.svg?style=flat)](https://travis-ci.org/getsentry/fastlane-plugin-sentry)
11
+ [![Gem Version](https://badge.fury.io/rb/fastlane-plugin-sentry.svg)](https://badge.fury.io/rb/fastlane-plugin-sentry)
12
+
13
+ ## Getting Started
14
+
15
+ This project is a [fastlane](https://github.com/fastlane/fastlane) plugin. To get started with fastlane-plugin-sentry, add it to your project by running:
16
+
17
+ ```bash
18
+ fastlane add_plugin sentry
19
+ ```
20
+
21
+ ## Sentry Actions
22
+
23
+ A subset of actions provided by the CLI: https://docs.sentry.io/learn/cli/
24
+
25
+ #### Authentication & Configuration
26
+
27
+ `auth_token` is the preferred way to authentication method with Sentry. This can be obtained on https://sentry.io/api/.
28
+ `api_key` still works but will eventually become deprecated. This can be obtained through the settings of your project.
29
+ 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.
30
+
31
+ The following environment variables may be used in place of parameters: `SENTRY_API_KEY`, `SENTRY_AUTH_TOKEN`, `SENTRY_ORG_SLUG`, and `SENTRY_PROJECT_SLUG`.
32
+
33
+ #### Uploading Symbolication Files
34
+
35
+ ```ruby
36
+ sentry_upload_dsym(
37
+ api_key: '...', # Do not use if using auth_token
38
+ auth_token: '...', # Do not use if using api_key
39
+ org_slug: '...',
40
+ project_slug: '...',
41
+ symbol_maps: 'path to bcsymbols folder' # use this if you have a bcsymbols folder
42
+ dsym_path: './App.dSYM.zip',
43
+ info_plist: '...' # optional, sentry-cli tries to find the correct plist by itself
44
+ )
45
+ ```
46
+
47
+ The `SENTRY_DSYM_PATH` environment variable may be used in place of the `dsym_path` parameter.
48
+
49
+ #### Creating & Finalizing Releases
50
+
51
+ ```ruby
52
+ sentry_create_release(
53
+ api_key: '...',
54
+ auth_token: '...',
55
+ org_slug: '...',
56
+ project_slug: '...',
57
+ version: '...', # release version to create
58
+ app_identifier: '...', # pass in the bundle_identifer of your app
59
+ finalize: true # Whether to finalize the release. If not provided or false, the release can be finalized using the sentry_finalize_release action
60
+ )
61
+ ```
62
+
63
+ #### Uploading Files & Sourcemaps
64
+
65
+ Useful for uploading build artifacts and JS sourcemaps for react-native apps built using fastlane.
66
+
67
+ ```ruby
68
+ sentry_upload_file(
69
+ api_key: '...',
70
+ auth_token: '...',
71
+ org_slug: '...',
72
+ project_slug: '...',
73
+ version: '...',
74
+ app_identifier: '...', # pass in the bundle_identifer of your app
75
+ dist: '...', # optional distribution of the release usually the buildnumber
76
+ file: 'main.jsbundle' # file to upload
77
+ )
78
+ ```
79
+
80
+ ```ruby
81
+ sentry_upload_sourcemap(
82
+ api_key: '...',
83
+ auth_token: '...',
84
+ org_slug: '...',
85
+ project_slug: '...',
86
+ version: '...',
87
+ app_identifier: '...', # pass in the bundle_identifer of your app
88
+ dist: '...', # optional distribution of the release usually the buildnumber
89
+ sourcemap: 'main.jsbundle.map', # sourcemap to upload
90
+ rewrite: true
91
+ )
92
+ ```
93
+
94
+ #### Uploading Proguard Mapping File
95
+
96
+ ```ruby
97
+ sentry_upload_proguard(
98
+ api_key: '...', # Do not use if using auth_token
99
+ auth_token: '...', # Do not use if using api_key
100
+ org_slug: '...',
101
+ project_slug: '...',
102
+ android_manifest_path: 'path to merged AndroidManifest file' # found in `app/build/intermediates/manifests/full`
103
+ mapping_path: 'path to mapping.txt to upload',
104
+ )
105
+ ```
106
+
107
+ #### Associating commits
108
+
109
+ Useful for telling Sentry which commits are associated with a release.
110
+
111
+ ```ruby
112
+ sentry_set_commits(
113
+ version: '...',
114
+ app_identifier: '...', # pass in the bundle_identifer of your app
115
+ auto: false, # enable completely automated commit management
116
+ clear: false, # clear all current commits from the release
117
+ commit: '...', # commit spec, see `sentry-cli releases help set-commits` for more information
118
+ )
119
+ ```
120
+
121
+ ## Issues and Feedback
122
+
123
+ For any other issues and feedback about this plugin, please submit it to this repository.
124
+
125
+ ## Troubleshooting
126
+
127
+ For some more detailed help with plugins problems, check out the [Plugins Troubleshooting](https://github.com/fastlane/fastlane/blob/master/fastlane/docs/PluginsTroubleshooting.md) doc in the main `fastlane` repo.
128
+
129
+ ## Using `fastlane` Plugins
130
+
131
+ For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Plugins.md) in the main `fastlane` repo.
132
+
133
+ ## About `fastlane`
134
+
135
+ `fastlane` automates building, testing, and releasing your app for beta and app store distributions. To learn more about `fastlane`, check out [fastlane.tools](https://fastlane.tools).
@@ -0,0 +1,16 @@
1
+ require 'fastlane/plugin/uninow/sentry/version'
2
+
3
+ module Fastlane
4
+ module Sentry
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::Sentry.all_classes.each do |current|
15
+ require current
16
+ end
@@ -0,0 +1,71 @@
1
+ module Fastlane
2
+ module Actions
3
+ class SentryCreateReleaseAction < Action
4
+ def self.run(params)
5
+ require 'shellwords'
6
+
7
+ Helper::SentryHelper.check_sentry_cli!
8
+ Helper::SentryConfig.parse_api_params(params)
9
+
10
+ version = params[:version]
11
+ version = "#{params[:app_identifier]}-#{params[:version]}" if params[:app_identifier]
12
+
13
+ command = [
14
+ "sentry-cli",
15
+ "releases",
16
+ "new",
17
+ version
18
+ ]
19
+ command.push("--finalize") if params[:finalize].nil?
20
+
21
+ Helper::SentryHelper.call_sentry_cli(command)
22
+ UI.success("Successfully created release: #{version}")
23
+ end
24
+
25
+ #####################################################
26
+ # @!group Documentation
27
+ #####################################################
28
+
29
+ def self.description
30
+ "Create new releases for a project on Sentry"
31
+ end
32
+
33
+ def self.details
34
+ [
35
+ "This action allows you to create new releases for a project on Sentry.",
36
+ "See https://docs.sentry.io/learn/cli/releases/#creating-releases for more information."
37
+ ].join(" ")
38
+ end
39
+
40
+ def self.available_options
41
+ Helper::SentryConfig.common_api_config_items + [
42
+ FastlaneCore::ConfigItem.new(key: :version,
43
+ description: "Release version to create on Sentry"),
44
+ FastlaneCore::ConfigItem.new(key: :finalize,
45
+ description: "Whether to finalize the release. If not provided or false, the release can be finalized using the finalize_release action",
46
+ default_value: false,
47
+ is_string: false,
48
+ optional: true),
49
+ FastlaneCore::ConfigItem.new(key: :app_identifier,
50
+ short_option: "-a",
51
+ env_name: "SENTRY_APP_IDENTIFIER",
52
+ description: "App Bundle Identifier, prepended to version",
53
+ optional: true)
54
+
55
+ ]
56
+ end
57
+
58
+ def self.return_value
59
+ nil
60
+ end
61
+
62
+ def self.authors
63
+ ["wschurman"]
64
+ end
65
+
66
+ def self.is_supported?(platform)
67
+ true
68
+ end
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,65 @@
1
+ module Fastlane
2
+ module Actions
3
+ class SentryFinalizeReleaseAction < Action
4
+ def self.run(params)
5
+ require 'shellwords'
6
+
7
+ Helper::SentryHelper.check_sentry_cli!
8
+ Helper::SentryConfig.parse_api_params(params)
9
+
10
+ version = params[:version]
11
+ version = "#{params[:app_identifier]}-#{params[:version]}" if params[:app_identifier]
12
+
13
+ command = [
14
+ "sentry-cli",
15
+ "releases",
16
+ "finalize",
17
+ version
18
+ ]
19
+
20
+ Helper::SentryHelper.call_sentry_cli(command)
21
+ UI.success("Successfully finalized release: #{version}")
22
+ end
23
+
24
+ #####################################################
25
+ # @!group Documentation
26
+ #####################################################
27
+
28
+ def self.description
29
+ "Finalize a release for a project on Sentry"
30
+ end
31
+
32
+ def self.details
33
+ [
34
+ "This action allows you to finalize releases created for a project on Sentry.",
35
+ "See https://docs.sentry.io/learn/cli/releases/#finalizing-releases for more information."
36
+ ].join(" ")
37
+ end
38
+
39
+ def self.available_options
40
+ Helper::SentryConfig.common_api_config_items + [
41
+ FastlaneCore::ConfigItem.new(key: :version,
42
+ description: "Release version to finalize on Sentry"),
43
+ FastlaneCore::ConfigItem.new(key: :app_identifier,
44
+ short_option: "-a",
45
+ env_name: "SENTRY_APP_IDENTIFIER",
46
+ description: "App Bundle Identifier, prepended to version",
47
+ optional: true)
48
+
49
+ ]
50
+ end
51
+
52
+ def self.return_value
53
+ nil
54
+ end
55
+
56
+ def self.authors
57
+ ["wschurman"]
58
+ end
59
+
60
+ def self.is_supported?(platform)
61
+ true
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,79 @@
1
+ module Fastlane
2
+ module Actions
3
+ class SentrySetCommitsAction < Action
4
+ def self.run(params)
5
+ require 'shellwords'
6
+
7
+ Helper::SentryHelper.check_sentry_cli!
8
+ Helper::SentryConfig.parse_api_params(params)
9
+
10
+ version = params[:version]
11
+ version = "#{params[:app_identifier]}-#{params[:version]}" if params[:app_identifier]
12
+
13
+ command = [
14
+ "sentry-cli",
15
+ "releases",
16
+ "set-commits",
17
+ version
18
+ ]
19
+
20
+ command.push('--auto') if params[:auto]
21
+ command.push('--clear') if params[:clear]
22
+ command.push('--commit').push(params[:commit]) unless params[:commit].nil?
23
+
24
+ Helper::SentryHelper.call_sentry_cli(command)
25
+ UI.success("Successfully set commits for release: #{version}")
26
+ end
27
+
28
+ #####################################################
29
+ # @!group Documentation
30
+ #####################################################
31
+
32
+ def self.description
33
+ "Set commits of a release"
34
+ end
35
+
36
+ def self.details
37
+ [
38
+ "This action allows you to set commits in a release for a project on Sentry.",
39
+ "See https://docs.sentry.io/cli/releases/#sentry-cli-commit-integration for more information."
40
+ ].join(" ")
41
+ end
42
+
43
+ def self.available_options
44
+ Helper::SentryConfig.common_api_config_items + [
45
+ FastlaneCore::ConfigItem.new(key: :version,
46
+ description: "Release version on Sentry"),
47
+ FastlaneCore::ConfigItem.new(key: :app_identifier,
48
+ short_option: "-a",
49
+ env_name: "SENTRY_APP_IDENTIFIER",
50
+ description: "App Bundle Identifier, prepended to version",
51
+ optional: true),
52
+ FastlaneCore::ConfigItem.new(key: :auto,
53
+ description: "Enable completely automated commit management",
54
+ is_string: false,
55
+ default_value: false),
56
+ FastlaneCore::ConfigItem.new(key: :clear,
57
+ description: "Clear all current commits from the release",
58
+ is_string: false,
59
+ default_value: false),
60
+ FastlaneCore::ConfigItem.new(key: :commit,
61
+ description: "Commit spec, see `sentry-cli releases help set-commits` for more information",
62
+ optional: true)
63
+ ]
64
+ end
65
+
66
+ def self.return_value
67
+ nil
68
+ end
69
+
70
+ def self.authors
71
+ ["brownoxford"]
72
+ end
73
+
74
+ def self.is_supported?(platform)
75
+ true
76
+ end
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,92 @@
1
+ module Fastlane
2
+ module Actions
3
+ class SentryUploadDsymAction < Action
4
+ def self.run(params)
5
+ Helper::SentryHelper.check_sentry_cli!
6
+ Helper::SentryConfig.parse_api_params(params)
7
+
8
+ # Params - dSYM
9
+ dsym_path = params[:dsym_path]
10
+ dsym_paths = params[:dsym_paths] || []
11
+
12
+ # Verify dsym(s)
13
+ dsym_paths += [dsym_path] unless dsym_path.nil?
14
+ dsym_paths = dsym_paths.map { |path| File.absolute_path(path) }
15
+ dsym_paths.each do |path|
16
+ UI.user_error!("dSYM does not exist at path: #{path}") unless File.exist? path
17
+ end
18
+
19
+ command = ["sentry-cli", "upload-dsym"]
20
+ command.push("--symbol-maps") unless params[:symbol_maps].nil?
21
+ command.push(params[:symbol_maps]) unless params[:symbol_maps].nil?
22
+ command.push("--info-plist") unless params[:info_plist].nil?
23
+ command.push(params[:info_plist]) unless params[:info_plist].nil?
24
+ command += dsym_paths
25
+
26
+ Helper::SentryHelper.call_sentry_cli(command)
27
+ UI.success("Successfully uploaded dSYMs!")
28
+ end
29
+
30
+ #####################################################
31
+ # @!group Documentation
32
+ #####################################################
33
+
34
+ def self.description
35
+ "Upload dSYM symbolication files to Sentry"
36
+ end
37
+
38
+ def self.details
39
+ [
40
+ "This action allows you to upload symbolication files to Sentry.",
41
+ "It's extra useful if you use it to download the latest dSYM files from Apple when you",
42
+ "use Bitcode"
43
+ ].join(" ")
44
+ end
45
+
46
+ def self.available_options
47
+ Helper::SentryConfig.common_api_config_items + [
48
+ FastlaneCore::ConfigItem.new(key: :dsym_path,
49
+ env_name: "SENTRY_DSYM_PATH",
50
+ description: "Path to your symbols file. For iOS and Mac provide path to app.dSYM.zip",
51
+ default_value: Actions.lane_context[SharedValues::DSYM_OUTPUT_PATH],
52
+ optional: true,
53
+ verify_block: proc do |value|
54
+ UI.user_error! "Could not find Path to your symbols file at path '#{value}'" unless File.exist?(value)
55
+ end),
56
+ FastlaneCore::ConfigItem.new(key: :dsym_paths,
57
+ env_name: "SENTRY_DSYM_PATHS",
58
+ description: "Path to an array of your symbols file. For iOS and Mac provide path to app.dSYM.zip",
59
+ default_value: Actions.lane_context[SharedValues::DSYM_PATHS],
60
+ is_string: false,
61
+ optional: true),
62
+ FastlaneCore::ConfigItem.new(key: :symbol_maps,
63
+ env_name: "SENTRY_SYMBOL_MAPS",
64
+ description: "Optional path to bcsymbolmap files which are used to resolve hidden symbols in the actual dsym files. This requires the dsymutil tool to be available",
65
+ optional: true,
66
+ verify_block: proc do |value|
67
+ UI.user_error! "Could not find bcsymbolmap at path '#{value}'" unless File.exist?(value)
68
+ end),
69
+ FastlaneCore::ConfigItem.new(key: :info_plist,
70
+ env_name: "SENTRY_INFO_PLIST",
71
+ description: "Optional path to Info.plist to add version information when uploading debug symbols",
72
+ optional: true,
73
+ verify_block: proc do |value|
74
+ UI.user_error! "Could not find Info.plist at path '#{value}'" unless File.exist?(value)
75
+ end)
76
+ ]
77
+ end
78
+
79
+ def self.return_value
80
+ nil
81
+ end
82
+
83
+ def self.authors
84
+ ["joshdholtz", "HazAT"]
85
+ end
86
+
87
+ def self.is_supported?(platform)
88
+ platform == :ios
89
+ end
90
+ end
91
+ end
92
+ end
@@ -0,0 +1,81 @@
1
+ module Fastlane
2
+ module Actions
3
+ class SentryUploadFileAction < Action
4
+ def self.run(params)
5
+ require 'shellwords'
6
+
7
+ Helper::SentryHelper.check_sentry_cli!
8
+ Helper::SentryConfig.parse_api_params(params)
9
+
10
+ file = params[:file]
11
+
12
+ version = params[:version]
13
+ version = "#{params[:app_identifier]}-#{params[:version]}" if params[:app_identifier]
14
+
15
+ command = [
16
+ "sentry-cli",
17
+ "releases",
18
+ "files",
19
+ version,
20
+ "upload",
21
+ file
22
+ ]
23
+ command.push(params[:file_url]) unless params[:file_url].nil?
24
+ command.push("--dist").push(params[:dist]) unless params[:dist].nil?
25
+
26
+ Helper::SentryHelper.call_sentry_cli(command)
27
+ UI.success("Successfully uploaded files to release: #{version}")
28
+ end
29
+
30
+ #####################################################
31
+ # @!group Documentation
32
+ #####################################################
33
+
34
+ def self.description
35
+ "Upload files to a release of a project on Sentry"
36
+ end
37
+
38
+ def self.details
39
+ [
40
+ "This action allows you to upload files to a release of a project on Sentry.",
41
+ "See https://docs.sentry.io/learn/cli/releases/#upload-files for more information."
42
+ ].join(" ")
43
+ end
44
+
45
+ def self.available_options
46
+ Helper::SentryConfig.common_api_config_items + [
47
+ FastlaneCore::ConfigItem.new(key: :version,
48
+ description: "Release version on Sentry"),
49
+ FastlaneCore::ConfigItem.new(key: :dist,
50
+ description: "Distribution in release",
51
+ optional: true),
52
+ FastlaneCore::ConfigItem.new(key: :file,
53
+ description: "Path to the file to upload",
54
+ verify_block: proc do |value|
55
+ UI.user_error! "Could not find file at path '#{value}'" unless File.exist?(value)
56
+ end),
57
+ FastlaneCore::ConfigItem.new(key: :file_url,
58
+ description: "Optional URL we should associate with the file",
59
+ optional: true),
60
+ FastlaneCore::ConfigItem.new(key: :app_identifier,
61
+ short_option: "-a",
62
+ env_name: "SENTRY_APP_IDENTIFIER",
63
+ description: "App Bundle Identifier, prepended to version",
64
+ optional: true)
65
+ ]
66
+ end
67
+
68
+ def self.return_value
69
+ nil
70
+ end
71
+
72
+ def self.authors
73
+ ["wschurman"]
74
+ end
75
+
76
+ def self.is_supported?(platform)
77
+ true
78
+ end
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,75 @@
1
+ module Fastlane
2
+ module Actions
3
+ class SentryUploadProguardAction < Action
4
+ def self.run(params)
5
+ Helper::SentryHelper.check_sentry_cli!
6
+ Helper::SentryConfig.parse_api_params(params)
7
+
8
+ # Params - mapping & manifest
9
+ mapping_path = params[:mapping_path]
10
+ android_manifest_path = params[:android_manifest_path]
11
+
12
+ # Verify files
13
+ UI.user_error!("Mapping file does not exist at path: #{mapping_path}") unless File.exist? mapping_path
14
+ UI.user_error!("AndroidManifest.xml file does not exist at path: #{android_manifest_path}") unless File.exist? android_manifest_path
15
+
16
+ command = [
17
+ "sentry-cli",
18
+ "upload-proguard",
19
+ "--android-manifest",
20
+ android_manifest_path,
21
+ mapping_path
22
+ ]
23
+
24
+ Helper::SentryHelper.call_sentry_cli(command)
25
+ UI.success("Successfully uploaded mapping file!")
26
+ end
27
+
28
+ #####################################################
29
+ # @!group Documentation
30
+ #####################################################
31
+
32
+ def self.description
33
+ "Upload mapping to a project on Sentry"
34
+ end
35
+
36
+ def self.details
37
+ [
38
+ "This action allows you to upload the proguard mapping file to Sentry.",
39
+ "See https://docs.sentry.io/cli/dif/proguard for more information."
40
+ ].join(" ")
41
+ end
42
+
43
+ def self.available_options
44
+ Helper::SentryConfig.common_api_config_items + [
45
+ FastlaneCore::ConfigItem.new(key: :mapping_path,
46
+ env_name: "ANDROID_MAPPING_PATH",
47
+ description: "Path to your proguard mapping.txt file",
48
+ optional: false,
49
+ verify_block: proc do |value|
50
+ UI.user_error! "Could not find your mapping file at path '#{value}'" unless File.exist?(value)
51
+ end),
52
+ FastlaneCore::ConfigItem.new(key: :android_manifest_path,
53
+ env_name: "ANDROID_MANIFEST_PATH",
54
+ description: "Path to your merged AndroidManifest file. This is usually found under `app/build/intermediates/manifests/full`",
55
+ optional: false,
56
+ verify_block: proc do |value|
57
+ UI.user_error! "Could not find your merged AndroidManifest file at path '#{value}'" unless File.exist?(value)
58
+ end)
59
+ ]
60
+ end
61
+
62
+ def self.return_value
63
+ nil
64
+ end
65
+
66
+ def self.authors
67
+ ["mpp-anasa"]
68
+ end
69
+
70
+ def self.is_supported?(platform)
71
+ platform == :android
72
+ end
73
+ end
74
+ end
75
+ end
@@ -0,0 +1,123 @@
1
+ module Fastlane
2
+ module Actions
3
+ class SentryUploadSourcemapAction < Action
4
+ def self.run(params)
5
+ require 'shellwords'
6
+
7
+ Helper::SentryHelper.check_sentry_cli!
8
+ Helper::SentryConfig.parse_api_params(params)
9
+
10
+ version = params[:version]
11
+ sourcemap = params[:sourcemap]
12
+
13
+ version = "#{params[:app_identifier]}-#{params[:version]}" if params[:app_identifier]
14
+
15
+ command = [
16
+ "sentry-cli",
17
+ "releases",
18
+ "files",
19
+ version,
20
+ "upload-sourcemaps",
21
+ sourcemap.to_s
22
+ ]
23
+
24
+ command.push('--rewrite') if params[:rewrite]
25
+ command.push('--no-rewrite') unless params[:rewrite]
26
+ command.push('--strip-prefix') if params[:strip_prefix]
27
+ command.push('--strip-common-prefix') if params[:strip_common_prefix]
28
+ command.push('--url-prefix').push(params[:url_prefix]) unless params[:url_prefix].nil?
29
+ command.push('--dist').push(params[:dist]) unless params[:dist].nil?
30
+
31
+ unless params[:ignore].nil?
32
+ # normalize to array
33
+ unless params[:ignore].kind_of?(Enumerable)
34
+ params[:ignore] = [params[:ignore]]
35
+ end
36
+ # no nil or empty strings
37
+ params[:ignore].reject! { |e| e.strip.empty? rescue true }
38
+ command.push('--ignore').push(*params[:ignore]) if params[:ignore].any?
39
+ end
40
+
41
+ command.push('--ignore-file').push(params[:ignore_file]) unless params[:ignore_file].nil?
42
+
43
+ Helper::SentryHelper.call_sentry_cli(command)
44
+ UI.success("Successfully uploaded files to release: #{version}")
45
+ end
46
+
47
+ #####################################################
48
+ # @!group Documentation
49
+ #####################################################
50
+
51
+ def self.description
52
+ "Upload a sourcemap to a release of a project on Sentry"
53
+ end
54
+
55
+ def self.details
56
+ [
57
+ "This action allows you to upload a sourcemap to a release of a project on Sentry.",
58
+ "See https://docs.sentry.io/learn/cli/releases/#upload-sourcemaps for more information."
59
+ ].join(" ")
60
+ end
61
+
62
+ def self.available_options
63
+ Helper::SentryConfig.common_api_config_items + [
64
+ FastlaneCore::ConfigItem.new(key: :version,
65
+ description: "Release version on Sentry"),
66
+ FastlaneCore::ConfigItem.new(key: :dist,
67
+ description: "Distribution in release",
68
+ optional: true),
69
+ FastlaneCore::ConfigItem.new(key: :sourcemap,
70
+ description: "Path to the sourcemap to upload",
71
+ verify_block: proc do |value|
72
+ UI.user_error! "Could not find sourcemap at path '#{value}'" unless File.exist?(value)
73
+ end),
74
+ FastlaneCore::ConfigItem.new(key: :rewrite,
75
+ description: "Rewrite the sourcemaps before upload",
76
+ default_value: false,
77
+ is_string: false,
78
+ optional: true),
79
+ FastlaneCore::ConfigItem.new(key: :strip_prefix,
80
+ conflicting_options: [:strip_common_prefix],
81
+ description: "Chop-off a prefix from uploaded files",
82
+ default_value: false,
83
+ is_string: false,
84
+ optional: true),
85
+ FastlaneCore::ConfigItem.new(key: :strip_common_prefix,
86
+ conflicting_options: [:strip_prefix],
87
+ description: "Automatically guess what the common prefix is and chop that one off",
88
+ default_value: false,
89
+ is_string: false,
90
+ optional: true),
91
+ FastlaneCore::ConfigItem.new(key: :url_prefix,
92
+ description: "Sets a URL prefix in front of all files",
93
+ optional: true),
94
+ FastlaneCore::ConfigItem.new(key: :app_identifier,
95
+ short_option: "-a",
96
+ env_name: "SENTRY_APP_IDENTIFIER",
97
+ description: "App Bundle Identifier, prepended to version",
98
+ optional: true),
99
+ FastlaneCore::ConfigItem.new(key: :ignore,
100
+ description: "Ignores all files and folders matching the given glob or array of globs",
101
+ is_string: false,
102
+ optional: true),
103
+ FastlaneCore::ConfigItem.new(key: :ignore_file,
104
+ description: "Ignore all files and folders specified in the given ignore file, e.g. .gitignore",
105
+ optional: true)
106
+
107
+ ]
108
+ end
109
+
110
+ def self.return_value
111
+ nil
112
+ end
113
+
114
+ def self.authors
115
+ ["wschurman"]
116
+ end
117
+
118
+ def self.is_supported?(platform)
119
+ true
120
+ end
121
+ end
122
+ end
123
+ end
@@ -0,0 +1,78 @@
1
+ module Fastlane
2
+ module Helper
3
+ class SentryConfig
4
+ def self.common_api_config_items
5
+ [
6
+ FastlaneCore::ConfigItem.new(key: :url,
7
+ env_name: "SENTRY_URL",
8
+ description: "Url for Sentry",
9
+ is_string: true,
10
+ optional: true),
11
+ FastlaneCore::ConfigItem.new(key: :auth_token,
12
+ env_name: "SENTRY_AUTH_TOKEN",
13
+ description: "Authentication token for Sentry",
14
+ optional: true),
15
+ FastlaneCore::ConfigItem.new(key: :api_key,
16
+ env_name: "SENTRY_API_KEY",
17
+ description: "API key for Sentry",
18
+ optional: true),
19
+ FastlaneCore::ConfigItem.new(key: :org_slug,
20
+ env_name: "SENTRY_ORG_SLUG",
21
+ description: "Organization slug for Sentry project",
22
+ optional: true),
23
+ FastlaneCore::ConfigItem.new(key: :project_slug,
24
+ env_name: "SENTRY_PROJECT_SLUG",
25
+ description: "Project slug for Sentry",
26
+ optional: true)
27
+ ]
28
+ end
29
+
30
+ def self.parse_api_params(params)
31
+ require 'shellwords'
32
+
33
+ url = params[:url]
34
+ auth_token = params[:auth_token]
35
+ api_key = params[:api_key]
36
+ org = params[:org_slug]
37
+ project = params[:project_slug]
38
+
39
+ has_org = !org.to_s.empty?
40
+ has_project = !project.to_s.empty?
41
+ has_api_key = !api_key.to_s.empty?
42
+ has_auth_token = !auth_token.to_s.empty?
43
+
44
+ skip_params_check = false
45
+ if !has_org || !has_project || !has_auth_token
46
+ skip_params_check = fallback_sentry_cli
47
+ end
48
+
49
+ if !skip_params_check
50
+ # Will fail if none or both authentication methods are provided
51
+ if !has_api_key && !has_auth_token
52
+ UI.user_error!("No API key or authentication token found for SentryAction given, pass using `api_key: 'key'` or `auth_token: 'token'`")
53
+ elsif has_api_key && has_auth_token
54
+ UI.user_error!("Both API key and authentication token found for SentryAction given, please only give one")
55
+ elsif has_api_key && !has_auth_token
56
+ UI.deprecated("Please consider switching to auth_token ... api_key will be removed in the future")
57
+ end
58
+ ENV['SENTRY_API_KEY'] = api_key unless api_key.to_s.empty?
59
+ ENV['SENTRY_AUTH_TOKEN'] = auth_token unless auth_token.to_s.empty?
60
+ ENV['SENTRY_URL'] = url unless url.to_s.empty?
61
+ ENV['SENTRY_LOG_LEVEL'] = 'INFO' if FastlaneCore::Globals.verbose?
62
+ ENV['SENTRY_ORG'] = Shellwords.escape(org) unless org.to_s.empty?
63
+ ENV['SENTRY_PROJECT'] = Shellwords.escape(project) unless project.to_s.empty?
64
+ else
65
+ UI.important("No config provided, will fallback to .sentryclirc")
66
+ end
67
+ end
68
+
69
+ def self.fallback_sentry_cli
70
+ sentry_cli_result = JSON.parse(`sentry-cli info --config-status-json`)
71
+ return (sentry_cli_result["auth"]["successful"] &&
72
+ !sentry_cli_result["auth"]["type"].nil? &&
73
+ !sentry_cli_result["config"]["org"].nil? &&
74
+ !sentry_cli_result["config"]["project"].nil?)
75
+ end
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,65 @@
1
+ module Fastlane
2
+ module Helper
3
+ class SentryHelper
4
+ def self.check_sentry_cli!
5
+ unless `which sentry-cli`.include?('sentry-cli')
6
+ UI.error("You have to install sentry-cli version #{Fastlane::Sentry::CLI_VERSION} to use this plugin")
7
+ UI.error("")
8
+ UI.error("Install it using:")
9
+ UI.command("brew install getsentry/tools/sentry-cli")
10
+ UI.error("OR")
11
+ UI.command("curl -sL https://sentry.io/get-cli/ | bash")
12
+ UI.error("If you don't have homebrew, visit http://brew.sh")
13
+ UI.user_error!("Install sentry-cli and start your lane again!")
14
+ end
15
+
16
+ sentry_cli_version = Gem::Version.new(`sentry-cli --version`.scan(/(?:\d+\.?){3}/).first)
17
+ required_version = Gem::Version.new(Fastlane::Sentry::CLI_VERSION)
18
+ if sentry_cli_version < required_version
19
+ UI.user_error!("Your sentry-cli is outdated, please upgrade to at least version #{Fastlane::Sentry::CLI_VERSION} and start your lane again!")
20
+ end
21
+
22
+ UI.success("sentry-cli #{sentry_cli_version} installed!")
23
+ end
24
+
25
+ def self.call_sentry_cli(command)
26
+ UI.message "Starting sentry-cli..."
27
+ require 'open3'
28
+ error = []
29
+ if FastlaneCore::Globals.verbose?
30
+ UI.verbose("sentry-cli command:\n\n")
31
+ UI.command(command.to_s)
32
+ UI.verbose("\n\n")
33
+ end
34
+ final_command = command.map { |arg| Shellwords.escape(arg) }.join(" ")
35
+ Open3.popen3(final_command) do |stdin, stdout, stderr, wait_thr|
36
+ while (line = stdout.gets)
37
+ UI.message(line.strip!)
38
+ end
39
+ while (line = stderr.gets)
40
+ error << line.strip!
41
+ end
42
+ exit_status = wait_thr.value
43
+ unless exit_status.success? && error.empty?
44
+ handle_error(error)
45
+ end
46
+ end
47
+ end
48
+
49
+ def self.handle_error(errors)
50
+ fatal = false
51
+ for error in errors do
52
+ if error
53
+ if error =~ /error/
54
+ UI.error(error.to_s)
55
+ fatal = true
56
+ else
57
+ UI.verbose(error.to_s)
58
+ end
59
+ end
60
+ end
61
+ UI.user_error!('Error while calling Sentry CLI') if fatal
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,8 @@
1
+ module Fastlane
2
+ module UniNow
3
+ module Sentry
4
+ VERSION = "2.0.2"
5
+ CLI_VERSION = "1.48.0"
6
+ end
7
+ end
8
+ end
metadata ADDED
@@ -0,0 +1,125 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fastlane-plugin-uninow-sentry
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Tom Krusch
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-03-29 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: pry
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubocop
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: fastlane
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: 2.10.0
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: 2.10.0
83
+ description:
84
+ email: tom.krusch@uninow.de
85
+ executables: []
86
+ extensions: []
87
+ extra_rdoc_files: []
88
+ files:
89
+ - LICENSE
90
+ - README.md
91
+ - lib/fastlane/plugin/uninow/sentry.rb
92
+ - lib/fastlane/plugin/uninow/sentry/actions/sentry_create_release.rb
93
+ - lib/fastlane/plugin/uninow/sentry/actions/sentry_finalize_release.rb
94
+ - lib/fastlane/plugin/uninow/sentry/actions/sentry_set_commits.rb
95
+ - lib/fastlane/plugin/uninow/sentry/actions/sentry_upload_dsym.rb
96
+ - lib/fastlane/plugin/uninow/sentry/actions/sentry_upload_file.rb
97
+ - lib/fastlane/plugin/uninow/sentry/actions/sentry_upload_proguard.rb
98
+ - lib/fastlane/plugin/uninow/sentry/actions/sentry_upload_sourcemap.rb
99
+ - lib/fastlane/plugin/uninow/sentry/helper/sentry_config.rb
100
+ - lib/fastlane/plugin/uninow/sentry/helper/sentry_helper.rb
101
+ - lib/fastlane/plugin/uninow/sentry/version.rb
102
+ homepage: https://github.com/tom-krusch/sentry-fastlane-plugin
103
+ licenses:
104
+ - MIT
105
+ metadata: {}
106
+ post_install_message:
107
+ rdoc_options: []
108
+ require_paths:
109
+ - lib
110
+ required_ruby_version: !ruby/object:Gem::Requirement
111
+ requirements:
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ version: '0'
115
+ required_rubygems_version: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - ">="
118
+ - !ruby/object:Gem::Version
119
+ version: '0'
120
+ requirements: []
121
+ rubygems_version: 3.0.3
122
+ signing_key:
123
+ specification_version: 4
124
+ summary: Upload symbols to Sentry
125
+ test_files: []