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
- .return_value ⇒ Object
Class Method Summary collapse
Class Method Details
.authors ⇒ Object
105 106 107 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/buildkite_trigger_build_action.rb', line 105 def self. ['Automattic'] end |
.available_options ⇒ Object
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 97 98 99 100 101 102 103 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/buildkite_trigger_build_action.rb', line 52 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_ORGANIZATION', 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
47 48 49 50 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/buildkite_trigger_build_action.rb', line 47 def self.description # https://buildkite.com/docs/pipelines/glossary#build 'Triggers a build on Buildkite' end |
.is_supported?(platform) ⇒ Boolean
113 114 115 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/buildkite_trigger_build_action.rb', line 113 def self.is_supported?(platform) true end |
.return_value ⇒ Object
109 110 111 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/buildkite_trigger_build_action.rb', line 109 def self.return_value 'The web URL of the build the action started.' end |
.run(params) ⇒ Object
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 36 37 38 39 40 41 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/buildkite_trigger_build_action.rb', line 6 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. # See 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], ) build_url = response.web_url if response.state == 'scheduled' UI.success("Successfully scheduled new build. You can see it at '#{build_url}'") else UI.crash!("Failed to start build.\nError: [#{response}]") end build_url end |