Skip to content

Commit

Permalink
Add 'soft_fail' to CommandStep (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
dbeg authored Sep 24, 2024
1 parent 1d86dba commit 5a392aa
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ buildkite {
}
}

commandStep {
label ':boom: Soft fail step'
command 'soft-fail.sh'
softFail(1, 127)
}

waitStep()

commandStep {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,14 @@ class BuildkitePipeline implements ConfigurableEnvironment {
void branches(String... branches) {
model.branches = branches.join(' ')
}

void softFail(boolean softFail = true) {
model.soft_fail = softFail
}

void softFail(int... exitStatuses) {
model.soft_fail = exitStatuses.collect { exitStatus -> ['exit_status': exitStatus] }
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ contributor([ctx, closureCtx]) {
method name: 'automaticRetry', params: [body: Closure], doc: 'Retry this step automatically on failure.'
method name: 'skip', doc: 'Skip this step.'
method name: 'skip', params: [reason: String], doc: 'Skip this step with a given reason string.'
method name: 'softFail', params: [softFail: Boolean], doc: 'Soft fail this step.'
method name: 'softFail', params: [exitStatuses: 'java.lang.Integer[]'], doc: '''
Soft fail this step for the given exit statuses.
'''
method name: 'timeout', params: [timeout: 'java.time.Duration'], doc: '''
The amount of time a job created from this step is allowed to run. If the job does not finish within this
limit, it will be automatically cancelled and the build will fail.
Expand Down

0 comments on commit 5a392aa

Please sign in to comment.