Cleaning up applications

If you accidentally deployed an app, or you no longer need one, use the following one-off command:

gimlet release delete --env local --app myapp-dummy

Cleaning up preview apps

If you deploy preview apps with dynamic names, like with the branch name in the app name, you can use Gimlet's cleanup policies to clean them up once you don't need them anymore.

# .gimlet/preview.yaml
app: myapp-{{ .GITHUB_BRANCH | sanitizeDNSName }}
env: staging
namespace: staging
name: onechart
version: 0.28.0
branch: feature/*
event: push
+ branch: feature/*
+ event: branchDeleted
+ app: myapp-{{ .BRANCH | sanitizeDNSName }}
replicas: 1
tag: "{{ .GITHUB_SHA }}"
gitRepository: laszlocph/gimletd-test-repo
gitSha: "{{ .GITHUB_SHA }}"

The above snippet has a cleanup section that is triggered

  • on the branchDeleted event,
  • if the branch that is deleted matches the feature/* pattern.

Once the policy triggers, it deletes applications that are matching the myapp-{{ .BRANCH | sanitizeDNSName }} pattern.

All three fields are mandatory.

Please note that only the {{ .BRANCH }} variable is available for the branchDeleted event. At the time of deletion the shipped artifacts and their extensive variable set is not available, only the branch name is known that got deleted - hence the {{ .GITHUB_BRANCH }} usage throughout the manifest, except in the cleanup policy.