Class: Fastlane::Actions::ArtifactoryAction
- Inherits:
-
Fastlane::Action
- Object
- Fastlane::Action
- Fastlane::Actions::ArtifactoryAction
- Defined in:
- fastlane/lib/fastlane/actions/artifactory.rb
Constant Summary
Constants inherited from Fastlane::Action
Fastlane::Action::AVAILABLE_CATEGORIES, Fastlane::Action::RETURN_TYPES
Class Method Summary collapse
- .author ⇒ Object
- .available_options ⇒ Object
- .category ⇒ Object
- .connect_to_artifactory(params) ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .example_code ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .output ⇒ Object
- .run(params) ⇒ Object
Methods inherited from Fastlane::Action
action_name, authors, deprecated_notes, lane_context, method_missing, other_action, return_type, return_value, sample_return_value, shell_out_should_use_bundle_exec?, step_text
Class Method Details
.author ⇒ Object
64 65 66 |
# File 'fastlane/lib/fastlane/actions/artifactory.rb', line 64 def self. ["koglinjg", "tommeier"] end |
.available_options ⇒ Object
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
# File 'fastlane/lib/fastlane/actions/artifactory.rb', line 99 def self. [ FastlaneCore::ConfigItem.new(key: :file, env_name: "FL_ARTIFACTORY_FILE", description: "File to be uploaded to artifactory", optional: false), FastlaneCore::ConfigItem.new(key: :repo, env_name: "FL_ARTIFACTORY_REPO", description: "Artifactory repo to put the file in", optional: false), FastlaneCore::ConfigItem.new(key: :repo_path, env_name: "FL_ARTIFACTORY_REPO_PATH", description: "Path to deploy within the repo, including filename", optional: false), FastlaneCore::ConfigItem.new(key: :endpoint, env_name: "FL_ARTIFACTORY_ENDPOINT", description: "Artifactory endpoint", optional: false), FastlaneCore::ConfigItem.new(key: :username, env_name: "FL_ARTIFACTORY_USERNAME", description: "Artifactory username", optional: true, conflicting_options: [:api_key], conflict_block: proc do |value| UI.user_error!("You can't use option '#{value.key}' along with 'username'") end), FastlaneCore::ConfigItem.new(key: :password, env_name: "FL_ARTIFACTORY_PASSWORD", description: "Artifactory password", sensitive: true, optional: true, conflicting_options: [:api_key], conflict_block: proc do |value| UI.user_error!("You can't use option '#{value.key}' along with 'password'") end), FastlaneCore::ConfigItem.new(key: :api_key, env_name: "FL_ARTIFACTORY_API_KEY", description: "Artifactory API key", sensitive: true, optional: true, conflicting_options: [:username, :password], conflict_block: proc do |value| UI.user_error!("You can't use option '#{value.key}' along with 'api_key'") end), FastlaneCore::ConfigItem.new(key: :properties, env_name: "FL_ARTIFACTORY_PROPERTIES", description: "Artifact properties hash", is_string: false, default_value: {}, optional: true), FastlaneCore::ConfigItem.new(key: :ssl_pem_file, env_name: "FL_ARTIFACTORY_SSL_PEM_FILE", description: "Location of pem file to use for ssl verification", default_value: nil, optional: true), FastlaneCore::ConfigItem.new(key: :ssl_verify, env_name: "FL_ARTIFACTORY_SSL_VERIFY", description: "Verify SSL", is_string: false, default_value: true, optional: true), FastlaneCore::ConfigItem.new(key: :proxy_username, env_name: "FL_ARTIFACTORY_PROXY_USERNAME", description: "Proxy username", default_value: nil, optional: true), FastlaneCore::ConfigItem.new(key: :proxy_password, env_name: "FL_ARTIFACTORY_PROXY_PASSWORD", description: "Proxy password", sensitive: true, default_value: nil, optional: true), FastlaneCore::ConfigItem.new(key: :proxy_address, env_name: "FL_ARTIFACTORY_PROXY_ADDRESS", description: "Proxy address", default_value: nil, optional: true), FastlaneCore::ConfigItem.new(key: :proxy_port, env_name: "FL_ARTIFACTORY_PROXY_PORT", description: "Proxy port", default_value: nil, optional: true), FastlaneCore::ConfigItem.new(key: :read_timeout, env_name: "FL_ARTIFACTORY_READ_TIMEOUT", description: "Read timeout", default_value: nil, optional: true) ] end |
.category ⇒ Object
95 96 97 |
# File 'fastlane/lib/fastlane/actions/artifactory.rb', line 95 def self.category :misc end |
.connect_to_artifactory(params) ⇒ Object
44 45 46 47 48 49 50 |
# File 'fastlane/lib/fastlane/actions/artifactory.rb', line 44 def self.connect_to_artifactory(params) config_keys = [:endpoint, :username, :password, :api_key, :ssl_pem_file, :ssl_verify, :proxy_username, :proxy_password, :proxy_address, :proxy_port, :read_timeout] config = params.values.select do |key| config_keys.include?(key) end Artifactory::Client.new(config) end |
.description ⇒ Object
52 53 54 |
# File 'fastlane/lib/fastlane/actions/artifactory.rb', line 52 def self.description 'This action uploads an artifact to artifactory' end |
.details ⇒ Object
56 57 58 |
# File 'fastlane/lib/fastlane/actions/artifactory.rb', line 56 def self.details 'Connect to the artifactory server using either a username/password or an api_key' end |
.example_code ⇒ Object
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'fastlane/lib/fastlane/actions/artifactory.rb', line 75 def self.example_code [ 'artifactory( username: "username", password: "password", endpoint: "https://artifactory.example.com/artifactory/", file: "example.ipa", # File to upload repo: "mobile_artifacts", # Artifactory repo repo_path: "/ios/appname/example-major.minor.ipa" # Path to place the artifact including its filename )', 'artifactory( api_key: "api_key", endpoint: "https://artifactory.example.com/artifactory/", file: "example.ipa", # File to upload repo: "mobile_artifacts", # Artifactory repo repo_path: "/ios/appname/example-major.minor.ipa" # Path to place the artifact including its filename )' ] end |
.is_supported?(platform) ⇒ Boolean
60 61 62 |
# File 'fastlane/lib/fastlane/actions/artifactory.rb', line 60 def self.is_supported?(platform) true end |
.output ⇒ Object
68 69 70 71 72 73 |
# File 'fastlane/lib/fastlane/actions/artifactory.rb', line 68 def self.output [ ['ARTIFACTORY_DOWNLOAD_URL', 'The download url for file uploaded'], ['ARTIFACTORY_DOWNLOAD_SIZE', 'The reported file size for file uploaded'] ] end |
.run(params) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'fastlane/lib/fastlane/actions/artifactory.rb', line 9 def self.run(params) Actions.verify_gem!('artifactory') require 'artifactory' UI.user_error!("Cannot connect to Artifactory - 'username' was provided but it's missing 'password'") if params[:username] && !params[:password] UI.user_error!("Cannot connect to Artifactory - 'password' was provided but it's missing 'username'") if !params[:username] && params[:password] UI.user_error!("Cannot connect to Artifactory - either 'api_key', or 'username' and 'password' must be provided") if !params[:api_key] && !params[:username] file_path = File.absolute_path(params[:file]) if File.exist?(file_path) client = connect_to_artifactory(params) artifact = Artifactory::Resource::Artifact.new artifact.client = client artifact.local_path = file_path artifact.checksums = { "sha1" => Digest::SHA1.file(file_path), "md5" => Digest::MD5.file(file_path) } UI.("Uploading file: #{artifact.local_path} ...") upload = artifact.upload(params[:repo], params[:repo_path], params[:properties]) Actions.lane_context[SharedValues::ARTIFACTORY_DOWNLOAD_URL] = upload.uri Actions.lane_context[SharedValues::ARTIFACTORY_DOWNLOAD_SIZE] = upload.size UI.("Uploaded Artifact:") UI.("Repo: #{upload.repo}") UI.("URI: #{upload.uri}") UI.("Size: #{upload.size}") UI.("SHA1: #{upload.sha1}") else UI.("File not found: '#{file_path}'") end end |