Class: Fastlane::Actions::BuildkiteTriggerBuildAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::BuildkiteTriggerBuildAction
- Defined in:
- lib/fastlane/plugin/wpmreleasetoolkit/actions/common/buildkite_trigger_build_action.rb
Documentation collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .is_supported?(platform) ⇒ Boolean
Class Method Summary collapse
Class Method Details
.authors ⇒ Object
90 91 92 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/buildkite_trigger_build_action.rb', line 90 def self. ['Automattic'] end |
.available_options ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/buildkite_trigger_build_action.rb', line 37 def self. [ FastlaneCore::ConfigItem.new( key: :buildkite_token, env_names: %w[BUILDKITE_TOKEN BUILDKITE_API_TOKEN], description: 'Buildkite Personal Access Token', type: String, sensitive: true ), FastlaneCore::ConfigItem.new( key: :buildkite_organization, env_name: 'BUILDKITE_ORGANIZTION', description: 'The Buildkite organization that contains your pipeline', type: String ), FastlaneCore::ConfigItem.new( key: :buildkite_pipeline, env_name: 'BUILDKITE_PIPELINE', description: %(The Buildkite pipeline you'd like to build), type: String ), FastlaneCore::ConfigItem.new( key: :branch, description: 'The branch you want to build', type: String ), FastlaneCore::ConfigItem.new( key: :commit, description: 'The commit hash you want to build', type: String, default_value: 'HEAD' ), FastlaneCore::ConfigItem.new( key: :message, description: 'A custom message to show for the build in Buildkite\'s UI', type: String, optional: true, default_value: nil ), FastlaneCore::ConfigItem.new( key: :pipeline_file, description: 'The name of the pipeline file in the project', type: String ), FastlaneCore::ConfigItem.new( key: :environment, description: 'Any additional environment variables to provide to the job', type: Hash, default_value: {} ), ] end |
.description ⇒ Object
33 34 35 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/buildkite_trigger_build_action.rb', line 33 def self.description 'Triggers a job on Buildkite' end |
.is_supported?(platform) ⇒ Boolean
94 95 96 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/buildkite_trigger_build_action.rb', line 94 def self.is_supported?(platform) true end |
.run(params) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/buildkite_trigger_build_action.rb', line 4 def self.run(params) require 'buildkit' UI. "Triggering build on branch #{params[:branch]}, commit #{params[:commit]}, using pipeline from #{params[:pipeline_file]}" pipeline_name = { PIPELINE: params[:pipeline_file] } = { branch: params[:branch], commit: params[:commit], env: params[:environment].merge(pipeline_name), message: params[:message] }.compact # remove entries with `nil` values from the Hash, if any client = Buildkit.new(token: params[:buildkite_token]) response = client.create_build( params[:buildkite_organization], params[:buildkite_pipeline], ) response.state == 'scheduled' ? UI.('Done!') : UI.crash!("Failed to start job\nError: [#{response}]") end |