Skip to main content

Delete Application via Pipeline

In this section, you will find a guide on how to delete Applications via Pipeline.


To completely delete your Application from the StackSpot Platform, all versions of your Application must be destroyed in every environment where it was deployed.

There are two parts of the Application that must be destroyed:

  1. The Application version: to destroy the Application version, follow the steps in the guide to Register Application destroy;

  2. The Infrastructure version: if the infrastructure deploy of your Application was via Self-hosted Runtimes:

    • You need to destroy the infrastructure components in your pipeline;
    • Execute an empty deploy, meaning with the infrastructure components destroyed;

With this, you push an empty Infrastructure version to StackSpot EDP, making it possible to delete your Application via the pipeline:

Steps to delete Application via Pipeline

To delete your Application via pipeline, you need to integrate the command stk app delete into the Workflow you will use to delete it in your repository.

After destroying all versions of the Application, follow the steps below to delete it:

Requirements:

After following the previous steps, the pipeline file should look like the following example:

.github/workflows/run-cli-commands.yml
name: Run CLI Commands

on: [push]

jobs:
deploy:
runs-on: ubuntu-latest
env:
LANG: C.UTF-8
LANGUAGE: C.UTF-8
LC_ALL: C.UTF-8
PYTHONIOENCODING: utf-8

steps:
- name: Check out repository code
uses: actions/checkout@v4

- name: Download STK CLI
shell: bash
run: |
curl \
--fail \
--http2-prior-knowledge \
--location \
--output /tmp/stk.deb \
--silent \
--show-error \
--tlsv1.3 \
https://stk.stackspot.com/installer/linux/stk.deb

- name: Install STK CLI
shell: bash
run: |
sudo dpkg --install /tmp/stk.deb || echo "Installation failed with exit code: $?"

- name: Authenticate StackSpot
run: |
$HOME/.stk/bin/stk login --client-id ${{ secrets.CLIENT_ID }} --client-key ${{ secrets.CLIENT_KEY }} --realm ${{ secrets.CLIENT_REALM }}

- name: Use your Workspace
run: |
$HOME/.stk/bin/stk use workspace <workspace>

After the setup, add the following command execution as the next step in the pipeline to register the deployment of your Application:

  - name: Delete App
run: |
stk delete app --target ./Applications/my-app

Done! You have deleted your Application.