The task deletes a filtered list of SCM snapshots associated with the specified build that are owned by the build’s workspace. These snapshots - SCM BaselineSet items - are created when a build is requested that is configured with Jazz Source Control when the "Accept latest changes before loading" option is enabled which creates the snapshot. The task searches for the Jazz Source Control configuration element in the build definition, retrieves the pointer to the build’s workspace from the configuration element, retrieves all snapshots owned by the build workspace and applies the specified filtering criteria to derive the list of snapshots to be deleted.
The task supports Team Build Attributes, Build Extensions Debugging Attributes, Build Extensions General Attributes, as well as, its own task specific attributes. Click on a link for more information on the common attributes.
The following table describes the task specific attributes for the task:
| Task Specific Attributes | ||
| Attribute | Description | Required |
| buildId | Specify the ID of the build for which build snapshots are to be deleted. | Yes |
| keep |
Specify the number of filtered build snapshots to keep. This must be an integer value. The default is 0. If 0 is specified, all snapshots that match the specified filtering criteria will be deleted. The latest snapshots are kept. For example: if you specify keep="5", the latest 5 snapshot are kept.
|
No |
| limit | Specifies the maximum number of snapshot items to process at one time. The default is 231-1 (Integer.MAX_VALUE). If the total number of snapshot items found is greater than available client storage can accommodate, specify a limit to retrieve and process snapshot items in groups. For example: if you specify a limit of 5000, the snapshots will be processed in groups of 5000 until the total number found is processed. Processing snapshot items in groups will reduce the client storage needed to complete the task. | No |
| preview |
Specify true to preview what build snapshots will be deleted. The default is false; all filtered build snapshots will be deleted.
|
No |
The includeSnapshot and excludeSnapshot elements are specified within the element. Each includeSnapshot element identifies filters for build snapshots to include; the build snapshots to delete. Each excludeSnapshot element identifies filters for build snapshots to exclude; the build snapshots to keep. If no includeSnapshot elements are specified, no build snapshots will be deleted. No error is raised if includeSnapshot elements find no eligible build snapshots, or if, excludeSnapshot elements skip all build snapshots.
The attributes specified for filtering on includeSnapshot and excludeSnapshot elements are AND’ed. For example, if you specify buildSnapshot="true" and createTime="2d" on an includeSnapshot element, all snapshots for the specified build that that are 2 or more days old will be deleted.
If multiple includeSnapshot or excludeSnapshot elements are specified, they are OR’ed. If a build result qualifies for any includeSnapshot, it will be deleted. If a build result qualifies for any excludeSnapshot, it will not be deleted.
The following table describes the valid includeSnapshot/excludeSnapshot attribute values:
| Snapshot Filtering Elements | ||
| Attribute | Description | Required |
| buildSnapshot |
Specify true to include/exclude snapshots created for the specified build. Specify false to include/exclude snapshots other than those created for the specified build. When enabled, the buildSnapshot attribute will ensure that the name of the snapshot starts with the buildId specified above. The default naming convention for snapshots created for a build start with the build ID and end with a date string.
|
No |
| comment | Specify the build snapshot comment to include/exclude. | No |
| commentContains | Specify a portion of the build snapshot comment to include/exclude. | No |
| createTime | Specify the age of the build snapshots to consider, as related to their creation time, in duration format (1w, 1d, 1h, 1m, 1s). For example: createTime="2d" would include all build snapshots created 2 or more days ago. | No |
| name | Specify the build snapshot name to include/exclude. | No |
| nameContains | Specify a portion of the build snapshot name to include/exclude. | No |
false.
Delete all build snapshots for the specified build ID that are at least 365 days old:
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed Materials - Property of IBM
(c) Copyright IBM Corporation 2024. All Rights Reserved.
Note to U.S. Government Users Restricted Rights:
Use, duplication or disclosure restricted by GSA ADP Schedule
Contract with IBM Corp.
-->
<project name="Delete Snapshots" default="all" xmlns:xt="antlib:com.ibm.team.build.extensions.toolkit">
<description>Delete Snapshots</description>
<loadproperties srcFile="${user.home}${file.separator}tvt6012.9702.properties"/>
<target name="main" description="main">
<xt:deleteBuildSnapshots
repositoryAddress="${repositoryAddress}"
userId="${userId}"
password="${password}"
buildId="Setup 702 dependency build">
<xt:includeSnapshot buildSnapshot="true" createTime="365d"/>
</xt:deleteBuildSnapshots>
</target>
<target depends="main" description="all" name="all"/>
</project>
Delete all build snapshots for all z/OS Dependency builds defined to all process areas defined on the EWM server:
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed Materials - Property of IBM
(c) Copyright IBM Corporation 2024. All Rights Reserved.
Note to U.S. Government Users Restricted Rights:
Use, duplication or disclosure restricted by GSA ADP Schedule
Contract with IBM Corp.
-->
<project
name="DeleteAllBuildSnapshots"
default="all"
xmlns:ac="antlib:net.sf.antcontrib"
xmlns:xt="antlib:com.ibm.team.build.extensions.toolkit">
<description>Delete All Build Snapshots</description>
<loadproperties srcFile="${user.home}${file.separator}tvt6012.9702.properties"/>
<target name="main" description="main">
<!-- Get process areas -->
<xt:getProcessAreas
repositoryAddress="${repositoryAddress}"
userId="${userId}"
password="${password}"
property="pas"
/>
<!-- Process process areas -->
<ac:for list="${pas}" param="pa" delimiter=";" trim="true">
<sequential>
<echo>Starting process: @{pa}</echo>
<!-- Get dependency builds -->
<xt:getBuildDefinitions
repositoryAddress="${repositoryAddress}"
userId="${userId}"
password="${password}"
processAreaName="@{pa}"
property="ids"
templateId="z/OS Dependency Build - Rational Build Agent"
/>
<!-- Process builds by ID -->
<ac:for list="${ids}" param="id" delimiter=";" trim="true">
<sequential>
<echo>Starting build: @{id}</echo>
<xt:deleteBuildSnapshots
repositoryAddress="${repositoryAddress}"
userId="${userId}"
password="${password}"
buildId="@{id}"
preview="false">
<xt:includeSnapshot buildSnapshot="true"/>
</xt:deleteBuildSnapshots>
<echo>Complete build: @{id}</echo>
</sequential>
</ac:for>
<echo>Complete process: @{pa}</echo>
</sequential>
</ac:for>
</target>
<target depends="main" description="all" name="all"/>
</project>