Azure DevOps Release¶
Prerequisites¶
a) You should have defined and created your build process which will package up your scripts from a release control or manifest file
b) You should have setup your Artifact Feeds as described here so that DataStar.Tools is loaded on to the build agent when the deployment runs.
b) If you are using the "Reversal Feature" you need to have packaged up your templates so that they can be used to create the reversal. See how to package your templates here. The templates should be added to an artifact repository so that can also be added as artifacts in the release pipeline.
Define the Pipeline¶
The first step is to create the release and define the artifacts, this should include:
- The output of the build (i.e. the packaged scripts), this would normally be configured as a trigger for creating a release.
- Optionally, if using the reversal feature then add the artifact containing your templates so that the templates get downloaded to the build agent.
- Add the DataStar.Tools artifact from your artifact feed so that this also gets downloaded to the build agent.
Then add the environments. For full details on how to configure Azure DevOps Release please refer to the Microsoft documentation for your particular version as it may look different from what is shown below:
Set Json Parameters¶
The first step is to read the build parameters, you can use the supplied Set Json Parameters for this purpose to read the parameters that we wrote into the build.
Execute Command Line Utility¶
Use the DataStar Tools to run the deployment and generate the reversal scripts, this can be added as a command line task as follows:
DataStar.Tools.exe -db "Microsoft" -en "DEV" -cs "User ID=$(DatabaseUser);Password=$(DatabasePassword);Data Source=$(DataSource);Database=$(Database)" -ae -ah "ADS_DEPLOYMENT_HISTORY" -ar "ADS_DEPLOYMENT_REVERSAL" -as "ADS_DEPLOYMENT_SUMMARY" -lk "$(LicenseKey)" -wi "$(WorkItem)" -vn "$(Version)" -re -wd "$(System.ArtifactsDirectory)/Build/$(DeploymentPackageName)$(Release.Artifacts.Build.BuildNumber)" -td "$(TemplateDirectory)" -lf "output.txt"
Add Work Item History¶
You can configure an optional step to write the details of the deployment to the work item history, using the standard Add Work Item History Task.
Retain Build¶
An optional step can be added to the relevant environment pipeline to retain the Azure DevOps Build using the standard DataStar Update TFS Build Utility Task.
Tag Build¶
An optional step can be added to apply a tag to the associated Build using the standard DataStar Tag Build Utility.