Class: Fastlane::Actions::BuildkitePipelineUploadAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::BuildkitePipelineUploadAction
- Defined in:
- lib/fastlane/plugin/wpmreleasetoolkit/actions/common/buildkite_pipeline_upload_action.rb
Constant Summary collapse
- DEFAULT_BUILDKITE_PIPELINE_FOLDER =
'.buildkite'.freeze
- DEFAULT_ENV_FILE =
File.join(DEFAULT_BUILDKITE_PIPELINE_FOLDER, 'shared-pipeline-vars').freeze
Class Method Summary collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .run(params) ⇒ Object
Class Method Details
.authors ⇒ Object
57 58 59 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/buildkite_pipeline_upload_action.rb', line 57 def self. ['Automattic'] end |
.available_options ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/buildkite_pipeline_upload_action.rb', line 33 def self. [ FastlaneCore::ConfigItem.new( key: :pipeline_file, description: 'The path to the YAML pipeline file to upload. If a relative path is provided, it will be prefixed with the `.buildkite/` folder path. Absolute paths are used as-is', optional: false, type: String ), FastlaneCore::ConfigItem.new( key: :env_file, description: 'The path to a bash file to be sourced before uploading the pipeline', optional: true, default_value: DEFAULT_ENV_FILE, type: String ), FastlaneCore::ConfigItem.new( key: :environment, description: 'Environment variables to load when running `pipeline upload`, to allow for variable substitution in the YAML pipeline', type: Hash, default_value: {} ), ] end |
.description ⇒ Object
28 29 30 31 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/buildkite_pipeline_upload_action.rb', line 28 def self.description # https://buildkite.com/docs/agent/v3/cli-pipeline#uploading-pipelines 'Uploads a pipeline to Buildkite, adding all its steps to the current build' end |
.is_supported?(platform) ⇒ Boolean
61 62 63 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/buildkite_pipeline_upload_action.rb', line 61 def self.is_supported?(platform) true end |
.run(params) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/buildkite_pipeline_upload_action.rb', line 7 def self.run(params) pipeline_file = params[:pipeline_file] pipeline_file = File.join(DEFAULT_BUILDKITE_PIPELINE_FOLDER, pipeline_file) unless File.absolute_path?(pipeline_file) env_file = params[:env_file] # Both keys and values need to be passed as strings otherwise Fastlane.sh will fail to parse the command. environment = params[:environment].to_h { |k, v| [k.to_s, v.to_s] } UI.user_error!("Pipeline file not found: #{pipeline_file}") unless File.exist?(pipeline_file) UI.user_error!('This action can only be called from a Buildkite CI build') unless ENV['BUILDKITE'] == 'true' UI.("Adding steps from `#{pipeline_file}` to the current build") if env_file && File.exist?(env_file) UI.(" - Sourcing environment file beforehand: #{env_file}") sh(environment, "source #{env_file.shellescape} && buildkite-agent pipeline upload #{pipeline_file.shellescape}") else sh(environment, 'buildkite-agent', 'pipeline', 'upload', pipeline_file) end end |