Reversal Pipeline
The reversal pipeline needs a different lifecycle from the release pipeline: it runs against a single environment, using the reversal package that was generated against that environment. That way each environment is reverted to the state it was in before deployment.
A recommended reversal pipeline has five steps:
- Download the reversal package using dynamic package selection.
- Run DataStar.Tools in rollback (verify) mode via the step template.
- Manual step to review the verify output.
- Run DataStar.Tools to apply the reversal.
- Housekeeping step to clean up packages.
Octopus variables
Set up the project variables first. Several are worth sharing with the release project via a Library Set.
| Name | Description |
|---|---|
LicenseKey | A sensitive field containing the DataStar licence key. |
PackageApiKey | A sensitive field containing an API key used to publish reversal packages back to the Octopus feed. |
ConnectionString | Connection string for the target database. Can reference other variables, for example User ID=#{DbUser};Password=#{DbPassword};Data Source=#{DataSource}. |
DynamicPackageName | The dynamic name used to pick the reversal package. For a Jira-style convention with work item DAT-243432: REVERT-#{Octopus.Environment.Name}-DAT-#{Octopus.Release.Number | Replace "\.?\d*$" "" }. |
HouseKeepDirectory | Base directory on the Tentacle for transient packages: C:\Octopus\Temp\#{Octopus.Environment.Name}. |
TempDirectory | Per-release subdirectory shared between steps: #{HouseKeepDirectory}\#{Octopus.Action[Download Package].Package.PackageId}-#{Octopus.Action[Download Package].Package.PackageVersion}. |
Additional variables may be needed, but the above is the minimum.
Step 1. Download Package
Add a standard Deploy a Package step that downloads the reversal package using DynamicPackageName.

Step 2. DataStar Verify
Add the DataStar Release step template, configured to run in rollback mode. The output log becomes an Octopus artefact so step 3 can review it.
#{WorkItem} and #{Version} are populated from metadata.json in the reversal package via the Variables File parameter.
| Name | Value |
|---|---|
| Target database | Microsoft |
| The name of the database environment | #{Octopus.Environment.Name} |
| The connection string to connect to the target database | #{ConnectionString} |
| Enable writing details to the auditing tables | False |
| License Key | #{LicenseKey} |
| Work Item / User Story | #{WorkItem} |
| Version | #{Version} |
| Reversal Enabled | False |
| Working Directory | #{TempDirectory}/content |
| DataStar Path | #{Octopus.Action.Package[DataStarPackage].ExtractedPath}/content |
| Variables File | metadata.json |
| DataStar Package | The feed and package containing DataStar.Tools. |
| Rollback Transaction | True |
| Output Log File | verify.txt |
Step 3. Review Deployment
Add a standard Manual Intervention Required step. The reviewer reads the verify.txt artefact before approving.

Step 4. DataStar Reversal
The DataStar Release step template again, this time set to run the reversal for real.
| Name | Value |
|---|---|
| Target database | Microsoft |
| The name of the database environment | #{Octopus.Environment.Name} |
| The connection string to connect to the target database | #{ConnectionString} |
| Enable writing details to the auditing tables | False |
| License Key | #{LicenseKey} |
| Work Item / User Story | #{WorkItem} |
| Version | #{Version} |
| Reversal Enabled | False |
| Working Directory | #{TempDirectory}/content |
| DataStar Path | #{Octopus.Action.Package[DataStarPackage].ExtractedPath}/content |
| Variables File | metadata.json |
| DataStar Package | The feed and package containing DataStar.Tools. |
| Rollback Transaction | False |
| Output Log File | output.txt |
Step 5. Remove Packages
Add a Run a Script step set to always run, even on failure. It deletes TempDirectory and cleans files older than 15 days out of HouseKeepDirectory to catch anything orphaned by earlier runs.
$folderPath = $OctopusParameters["TempDirectory"]
Remove-Item $folderPath -Force -Recurse -ErrorAction SilentlyContinue
$houseKeepPath = $OctopusParameters["HouseKeepDirectory"]
if (![string]::IsNullOrEmpty($houseKeepPath))
{
$limit = (Get-Date).AddDays(-15)
Get-ChildItem -Path $houseKeepPath -Force | Where-Object { !$_.PSIsContainer -and $_.CreationTime -lt $limit } | Remove-Item -Force -Recurse
}
Configure the step as always run and cannot skip.
