Skip to content

Commit

Permalink
Merge branch 'main' of github.com:buildkite/migration into js/BBP-tes…
Browse files Browse the repository at this point in the history
…t-reconf
  • Loading branch information
james2791 committed May 7, 2024
2 parents 54221eb + 0e2dae0 commit bac7304
Show file tree
Hide file tree
Showing 5 changed files with 198 additions and 19 deletions.
3 changes: 2 additions & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,6 @@ Buildkite has its own suggested best practices, these may differ to those from o

Further information on the currently supported attributes of CI provider pipeline translation to Buildkite pipelines can be found below (within the `/docs` directory):

- [GitHub Actions](/docs/GHA.md)
- [Bitbucket Pipelines](/docs/Bitbucket.md)
- [CircleCI](/docs/CircleCI.md)
- [GitHub Actions](/docs/GHA.md)
6 changes: 4 additions & 2 deletions app/lib/bk/compat/pipeline/step.rb
Original file line number Diff line number Diff line change
Expand Up @@ -206,17 +206,19 @@ def recurse_to_string(value, block, *, **)

# group step
class GroupStep
attr_accessor :label, :key, :steps, :conditional
attr_accessor :label, :key, :steps, :depends_on, :conditional

def initialize(label: '~', key: nil, steps: [], conditional: nil)
def initialize(label: '~', key: nil, steps: [], depends_on: [], conditional: nil)
@label = label
@key = key
@depends_on = depends_on
@steps = steps
@conditional = conditional
end

def to_h
{ group: @label, key: @key, steps: @steps.map(&:to_h) }.tap do |h|
h[:depends_on] = @depends_on unless @depends_on.empty?
h[:if] = @conditional unless @conditional.nil?
end.compact
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
---
steps:
- group: default
- key: execute-34fda39a698739f93a76af1583cf0b9e937f3561
prompt: Execute step 34fda39a698739f93a76af1583cf0b9e937f3561?
input: execute-34fda39a698739f93a76af1583cf0b9e937f3561
- group: deployer
steps:
- key: custom-vars
fields:
Expand All @@ -23,3 +26,5 @@ steps:
- commands:
- echo "$Username manually triggered for a build for $Region as $Role!"
label: Script step
depends_on:
- execute-34fda39a698739f93a76af1583cf0b9e937f3561
31 changes: 16 additions & 15 deletions app/spec/lib/bk/compat/bitbucket/examples/custom/variables.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
# from https://support.atlassian.com/bitbucket-cloud/docs/pipeline-start-conditions/#Example-%E2%80%94-using-the-variables-property-to-define-custom-pipeline-variables

pipelines:
default:
- variables:
- name: Username
- name: Role
default: "admin" # optionally provide a default variable value
description: "Add user role"
- name: Region
default: "us-east-1"
allowed-values: # optionally restrict variable values
- "ap-southeast-2"
- "us-east-1"
- "us-west-2"
- step:
script:
- echo "$Username manually triggered for a build for $Region as $Role!"
custom:
deployer: # The name that is displayed in the list in the Bitbucket Cloud GUI
- variables:
- name: Username
- name: Role
default: "admin" # optionally provide a default variable value
description: "Add user role"
- name: Region
default: "us-east-1"
allowed-values: # optionally restrict variable values
- "ap-southeast-2"
- "us-east-1"
- "us-west-2"
- step:
script:
- echo "$Username manually triggered for a build for $Region as $Role!"
Loading

0 comments on commit bac7304

Please sign in to comment.