A revision represents code and configuration used by an app at a specific time. It is a Cloud Foundry API (CAPI) object that can contain references to a droplet, a custom start command, and environment variables. The most recent revision for a running app represents code and configuration running in Ops Manager. App revisions do not include any tasks run on the app.
CAPI v3 is the recommended API version for revisions. While revisions work with CAPI v2, there are several inconsistencies. For example, revision descriptions for apps with multiple processes may be inaccurate because CAPI v2 does not support apps with multiple processes. Additionally, pushing an app for the first time with revisions in CAPI v2 creates two revisions.
For additional information, see Revisions in the Cloud Foundry API (CAPI) documentation.
Caution The app revisions API is experimental, and future releases might have breaking changes.
Some use cases for revisions include:
Viewing revisions for an app: This can help you understand how your app has changed over time.
Rolling back to a previous revision: This allows you to deploy a version of the app that you had running previously without needing to track that previous state yourself or have multiple apps running. When you create a deployment and reference a revision, the revision deploys as the current version of your app.
Revisions are generated automatically through these events:
By default, CAPI retains a maximum of 100 revisions per app.
Each revision includes a description of what changed in your app at the time the revision was created. The description includes one or more of these descriptions:
Process type removed
New process type added
Rolled back to revision X
Custom start command removed
Custom start command updated
Custom start command added
New environment variables deployed
New droplet deployed
By default, Ops Manager retains the five most recent staged droplets in its droplets bucket. This means that you can roll back to revisions as long as they are using one of those five droplets. Not all revisions include a change in droplet.
Operators can configure Ops Manager to retain more droplets if necessary using the Maximum staged droplets per app field in the File Storage pane of the VMware Tanzu Application Service for VMs (TAS for VMs) tile.
This section describes how to use CAPI endpoints for viewing revisions.
To list revisions for an app:
Retrieve the GUID of the app by running:
cf app APP-NAME --guid
Where APP-NAME
is the name of your app.
Run:
cf curl /v3/apps/GUID/revisions
Where GUID
is the GUID you retrieved in the previous step.
Deployed revisions are revisions linked to started processes in an app. To list deployed revisions:
Retrieve the GUID of the app by running:
cf app APP-NAME --guid
Where APP-NAME
is the name of your app.
Run:
cf curl /v3/apps/GUID/revisions/deployed
Where GUID
is the GUID you retrieved in the previous step.
To retrieve a revision:
Run:
cf curl /v3/revisions/GUID
Where GUID
is the GUID of the revision.
To roll back to a previous revision:
Retrieve the GUID of the app by running:
cf app APP-NAME --guid
Where APP-NAME
is the name of your app.
Retrieve the GUID of the revision. For more information, see Retrieve a Revision.
Create a deployment using CAPI by running:
cf curl v3/deployments \
-X POST \
-d '{
"revision": {
"guid": "REVISION-GUID"
},
"relationships": {
"app": {
"data": {
"guid": "APP-GUID"
}
}
}
}'
Where:
REVISION-GUID
is the GUID of the revision.APP-GUID
is the GUID of the app.To add metadata to a revision, see Add Metadata to an Object.
CAPI enables app revisions by default. To disable revisions for an app, you must manually turn them off.
To disable revisions for an app:
Retrieve the GUID of the app by running:
cf app APP-NAME --guid
Where APP-NAME
is the name of your app.
Run:
cf curl /v3/apps/GUID/features/revisions -X PATCH -d '{ "enabled": false }'
Where GUID
is the GUID you retrieved in the previous step.