From f6cbb685504d905e2321235bb270804dcb38dcf5 Mon Sep 17 00:00:00 2001 From: Stephan Lo Date: Wed, 15 Oct 2025 10:56:12 +0200 Subject: [PATCH] feat(edge-connect-delete): added delete app instance and app deletion action --- action.yaml | 35 +++++++++++++++++++++++++---------- endpoint.sh | 20 ++++++++++++-------- 2 files changed, 37 insertions(+), 18 deletions(-) diff --git a/action.yaml b/action.yaml index 327eed8..2571773 100644 --- a/action.yaml +++ b/action.yaml @@ -1,15 +1,26 @@ -name: 'Edge Connect Deploy' -description: 'Deploys an Edge Connect application using the edge-connect-client' +name: 'Edge Connect Delete' +description: 'Deletes an Edge Connect application using the edge-connect-client' author: 'DevFW' inputs: - configFile: - description: 'Path to the Edge Connect configuration file.' + name: + description: 'The application name.' + required: true + appVersion: + description: 'The application version.' + required: true + org: + description: 'The organization name.' + required: true + region: + description: 'The region name.' + required: true + cloudletOrg: + description: 'The cloudlet organization name.' + required: true + cloudlet: + description: 'The cloudlet name.' required: true - dryRun: - description: 'Perform a dry run of the deployment.' - required: false - default: 'false' version: description: 'The version of the edge-connect-client to use.' required: false @@ -33,8 +44,12 @@ runs: ${{ github.action_path }}/endpoint.sh shell: bash env: - INPUT_CONFIG_FILE: ${{ inputs.configFile }} - INPUT_DRY_RUN: ${{ inputs.dryRun }} + INPUT_NAME: ${{ inputs.name }} + INPUT_APPVERSION: ${{ inputs.appVersion }} + INPUT_ORG: ${{ inputs.org }} + INPUT_REGION: ${{ inputs.region }} + INPUT_CLOUDLET_ORG: ${{ inputs.cloudletOrg }} + INPUT_CLOUDLET: ${{ inputs.cloudlet }} INPUT_VERSION: ${{ inputs.version }} EDGE_CONNECT_BASE_URL: ${{ inputs.baseUrl }} EDGE_CONNECT_USERNAME: ${{ inputs.username }} diff --git a/endpoint.sh b/endpoint.sh index e5781f5..954c131 100755 --- a/endpoint.sh +++ b/endpoint.sh @@ -18,17 +18,21 @@ main() { local cli_path="${temp_dir}/edge-connect-client" chmod +x "${cli_path}" - local -a args - args=("--file" "${INPUT_CONFIG_FILE}") - - if [[ "${INPUT_DRY_RUN}" == "true" ]]; then - args+=("--dry-run") - fi + 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}" apply --auto-approve "${args[@]}" + echo Executing: "${cli_path}" instance delete "${args_instance_delete[@]}" # The CLI uses an interactive prompt, so we need to pipe "yes" to it. - "${cli_path}" apply --auto-approve "${args[@]}" + "${cli_path}" instance delete "${args_instance_delete[@]}" + + 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[@]}" + + # The CLI uses an interactive prompt, so we need to pipe "yes" to it. + "${cli_path}" app delete "${args_app_delete[@]}" } main