public interface ReleaseWorkflow
//Assuming that tasks 'checkReleaseNeeded', 'configureGenericGitUser' are already configured:
releaseWorkflow {
//step 1 of the release, invoke task that checks if release is needed
step checkReleaseNeeded
//step 2, abort release based on a predicate
onlyIf { checkReleaseNeeded.releaseNeeded }
//step 3, start using generic git user, register cleanup task
step configureGenericGitUser, [cleanup: 'restoreOriginalGitUser']
//step 4, update release notes
step updateReleaseNotes
//step 5, commit release notes, register a rollback task
step commitReleaseNotes, [rollback: rollbackCommitReleaseNotes]
//step 6,
step pushChanges
}
Release steps:
- executed in same order as they are declared
- if one of the steps fails, further steps are not executed
- onlyIf {} predicate can be used to cleanly abort the release process based on predicate
Each step can have one post-step task, either a 'rollback' or 'cleanup'.
Rollback tasks:
- executed only when one the release tasks fails, otherwise they are skipped
- executed in reverse order
- even if one rollback fails other rollback tasks are still executed
- rollback of task 'foo' is _not_ executed if task 'foo' fails. It is only executed if any further release step fails.
The reason for that is that when 'foo' fails, there is nothing to rollback.
Cleanup tasks:
- similar to rollback with one difference - it is executed even if the entire release is successful.
Rollback tasks are only executed when one of the release steps fails.
Following project properties are supported: - 'dryRun' - when this project property is present, rollbacks are executed even if the release is successful. This is useful for testing and ensuring the state is cleanup afterwards. Normally, rollback tasks are only executed when one of the release steps fail. - 'singleStep' - when present, you can run single release step, without triggering prior steps from execution. Very useful for invoking single release steps for testing. You can specify multiple step tasks from command line and use this property. - 'dryRun' + 'singleStep' - using both properties at the same time is supported.
| Modifier and Type | Method and Description |
|---|---|
ReleaseWorkflowExtension |
onlyIf(java.util.concurrent.Callable<java.lang.Boolean> predicate)
Adds a predicate check that can cleanly abort the release process
|
ReleaseWorkflowExtension |
step(org.gradle.api.Task task)
Adds task to release workflow, without any special configuration (rollback or cleanup)
|
ReleaseWorkflowExtension |
step(org.gradle.api.Task task,
java.util.Map<java.lang.String,org.gradle.api.Task> config)
Adds given task to the release workflow.
|
ReleaseWorkflowExtension step(org.gradle.api.Task task, java.util.Map<java.lang.String,org.gradle.api.Task> config)
task - - the task to add.config - - configuration of the task, map with exactly one key, either 'rollback' or 'cleanup'.ReleaseWorkflowExtension step(org.gradle.api.Task task)
ReleaseWorkflowExtension onlyIf(java.util.concurrent.Callable<java.lang.Boolean> predicate)