edge-connect-delete-action/endpoint.sh

40 lines
1.4 KiB
Bash
Raw Normal View History

2025-10-01 11:46:21 +02:00
#!/bin/bash
set -euo pipefail
2025-10-02 14:07:01 +02:00
main() {
export EDGE_CONNECT_BASE_URL
export EDGE_CONNECT_USERNAME
export EDGE_CONNECT_PASSWORD
2025-10-02 14:07:01 +02:00
local download_url="https://edp.buildth.ing/DevFW-CICD/edge-connect-client/releases/download/${INPUT_VERSION}/edge-connect-client_Linux_x86_64.tar.gz"
echo "Downloading edge-connect-client from ${download_url}"
local temp_dir
temp_dir=$(mktemp -d)
curl -sSL "${download_url}" | tar -xz -C "${temp_dir}"
local cli_path="${temp_dir}/edge-connect-client"
chmod +x "${cli_path}"
local -a args_instance_delete
args_instance_delete=("--name" "${INPUT_NAME}-${INPUT_APPVERSION}-instance" "--org" "${INPUT_ORG}" "--region" "${INPUT_REGION}" "--cloudlet-org" "${INPUT_CLOUDLET_ORG}" "--cloudlet" "${INPUT_CLOUDLET}")
echo Executing: "${cli_path}" instance delete "${args_instance_delete[@]}"
2025-10-02 14:07:01 +02:00
# The CLI uses an interactive prompt, so we need to pipe "yes" to it.
# we ignore an error by ||true in case the instance does not exist, so that we still delete the app
"${cli_path}" instance delete "${args_instance_delete[@]}" || true
local -a args_app_delete
args_app_delete=("--name" "${INPUT_NAME}" "--version" "${INPUT_APPVERSION}" "--org" "${INPUT_ORG}" "--region" "${INPUT_REGION}")
echo Executing: "${cli_path}" app delete "${args_app_delete[@]}"
2025-10-02 14:07:01 +02:00
# The CLI uses an interactive prompt, so we need to pipe "yes" to it.
"${cli_path}" app delete "${args_app_delete[@]}"
2025-10-02 14:07:01 +02:00
}
main