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
98 99 100 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/buildkite_trigger_build_action.rb', line 98 def self. ['Automattic'] end |
.available_options ⇒ Object
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 89 90 91 92 93 94 95 96 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/buildkite_trigger_build_action.rb', line 45 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
41 42 43 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/buildkite_trigger_build_action.rb', line 41 def self.description 'Triggers a job on Buildkite' end |
.is_supported?(platform) ⇒ Boolean
102 103 104 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/buildkite_trigger_build_action.rb', line 102 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 28 29 30 31 32 33 34 35 |
# 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], # Buildkite will not trigger a build if the GitHub activity for that branch is turned off # We want API triggers to work regardless of the GitHub activity settings, so this option is necessary # https://forum.buildkite.community/t/request-build-error-branches-have-been-disabled-for-this-pipeline/1463/2 ignore_pipeline_branch_filters: true }.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], ) if response.state == 'scheduled' UI.success("Successfully scheduled new build. You can see it at '#{response.web_url}'") else UI.crash!("Failed to start job\nError: [#{response}]") end end |