Skip to content

Commit

Permalink
Ensuring cleanup with OSD plugins when failed during continue-on-error (
Browse files Browse the repository at this point in the history
#4343)

Signed-off-by: Peter Zhu <[email protected]>
  • Loading branch information
peterzhuamazon authored Jan 16, 2024
1 parent a294e5e commit 0a19e7b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
11 changes: 10 additions & 1 deletion scripts/components/ganttChartDashboards/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@

set -ex

# vars / libs
. ../../../lib/shell/file_management.sh
PLUGIN_PATH=$PWD

function usage() {
echo "Usage: $0 [args]"
echo ""
Expand All @@ -22,6 +26,12 @@ function usage() {
echo -e "-h help"
}

function cleanup_all() {
File_Delete $PLUGIN_PATH
}

trap cleanup_all TERM INT EXIT

while getopts ":h:v:q:s:o:p:a:" arg; do
case $arg in
h)
Expand Down Expand Up @@ -87,4 +97,3 @@ cd plugins/$PLUGIN_FOLDER; yarn plugin-helpers build --opensearch-dashboards-ver
cd $CURR_DIR
echo "COPY $PLUGIN_NAME.zip"
cp -r ../../OpenSearch-Dashboards/plugins/$PLUGIN_FOLDER/build/$PLUGIN_NAME-$VERSION$QUALIFIER_IDENTIFIER.zip $OUTPUT/plugins/
rm -rf ../../OpenSearch-Dashboards/plugins/$PLUGIN_FOLDER
12 changes: 11 additions & 1 deletion scripts/default/opensearch-dashboards/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@

set -ex

# vars / libs
. ../../../lib/shell/file_management.sh
PLUGIN_PATH=$PWD

function usage() {
echo "Usage: $0 [args]"
echo ""
Expand All @@ -22,6 +26,13 @@ function usage() {
echo -e "-h help"
}


function cleanup_all() {
File_Delete $PLUGIN_PATH
}

trap cleanup_all TERM INT EXIT

while getopts ":h:v:q:s:o:p:a:" arg; do
case $arg in
h)
Expand Down Expand Up @@ -92,4 +103,3 @@ cd plugins/$PLUGIN_NAME; yarn $HELPER_STRING build --opensearch-dashboards-versi
cd $CURR_DIR
echo "COPY $PLUGIN_NAME.zip"
cp -r ../OpenSearch-Dashboards/plugins/$PLUGIN_NAME/build/$PLUGIN_NAME-$VERSION$QUALIFIER_IDENTIFIER.zip $OUTPUT/plugins/
rm -rf ../OpenSearch-Dashboards/plugins/$PLUGIN_NAME

0 comments on commit 0a19e7b

Please sign in to comment.