Find and Clean Up Stale App Deployments

Adam Benhassen
Adam Benhassen

Hive now tracks when each app deployment was last used, helping you identify stale deployments that are candidates for retirement.

Query Stale Deployments

Use the new activeAppDeployments query to find deployments based on usage:

query FindStaleDeployments($target: TargetReferenceInput!) {
  target(reference: $target) {
    activeAppDeployments(
      filter: {
        # Deployments last used more than 30 days ago
        lastUsedBefore: "2024-11-01T00:00:00Z"
        # OR deployments never used and older than 30 days
        neverUsedAndCreatedBefore: "2024-11-01T00:00:00Z"
      }
    ) {
      edges {
        node {
          name
          version
          createdAt
          lastUsed
        }
      }
    }
  }
}

Filter Options

FilterDescription
nameFilter by deployment name (case-insensitive partial match)
lastUsedBeforeDeployments last used before this timestamp
neverUsedAndCreatedBeforeDeployments never used and created before this timestamp

The date filters use OR semantics—deployments matching either condition are returned.

Automated Cleanup

For teams creating many deployments (e.g., one per PR), you can automate cleanup by combining the GraphQL API with the Hive CLI:


hive app:retire \
  --registry.accessToken "<ACCESS_TOKEN>" \
  --target "<ORG>/<PROJECT>/<TARGET>" \
  --name "<app-name>" \
  --version "<app-version>"