Skip to content

Commit

Permalink
feat: add destroy-volumes option (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
Michiel87 authored Oct 30, 2024
1 parent 6bcc52f commit c07aa3d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ The Okteto namespace to use. If not specified it will use the namespace specifie

Log level used. Supported values are: `debug`, `info`, `warn`, `error`. (defaults to warn)

### `destroy-volumes`

Set to `true` to destroy the persistent volumes created by the development environment (defaults to `false`).

# Example usage

This example runs the login action, activates a namespace, and triggers the Okteto pipeline and deletes it
Expand Down
7 changes: 6 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,18 @@ inputs:
log-level:
description: "Log level string. Valid options are debug, info, warn, error"
required: false
destroy-volumes:
description: "Set to true to destroy the persistent volumes created by the development environment"
required: false
default: 'false'
runs:
using: "docker"
image: "Dockerfile"
args:
- ${{ inputs.name }}
- ${{ inputs.namespace }}
- ${{ inputs.log-level }}
- ${{ inputs.destroy-volumes }}
branding:
color: 'green'
icon: 'settings'
icon: 'settings'
8 changes: 6 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ set -e
name=$1
namespace=$2
log_level=$3
destroy_volumes=$4

params=""
if [ ! -z $namespace ]; then
Expand All @@ -26,6 +27,9 @@ if [ "${RUNNER_DEBUG}" = "1" ]; then
log_level="--log-level debug"
fi

if [ "$destroy_volumes" = "true" ]; then
volume_flag="-v"
fi

echo running: okteto pipeline destroy $log_level --name "${name}" ${params} --wait
okteto pipeline destroy $log_level --name "${name}" ${params} --wait
echo running: okteto pipeline destroy $log_level --name "${name}" ${params} $volume_flag --wait
okteto pipeline destroy $log_level --name "${name}" ${params} $volume_flag --wait

0 comments on commit c07aa3d

Please sign in to comment.