OT-BUILDPIPER-MARKETPLACE / BP-BASE-SHELL-STEPS

0 stars 2 forks source link

Refactor Step result processing #5

Open sandy724 opened 2 years ago

sandy724 commented 2 years ago

At most of the places

if [ $? -eq 0 ]
then
  logInfoMessage "Congratulations docker lint scan succeeded!!!"
  generateOutput mvn_execute true "Congratulations docker lint scan succeeded!!!"
elif [ $VALIDATION_FAILURE_ACTION == "FAILURE" ]
  then
    logErrorMessage "Please check docker lint scan failed!!!"
    generateOutput ${ACTIVITY_SUB_TASK_CODE} false "Please check docker lint scan failed!!!"
    exit 1
   else
    logWarningMessage "Please check docker lint scan failed!!!"
    generateOutput ${ACTIVITY_SUB_TASK_CODE} true "Please check docker lint scan failed!!!"
fi

This is the repeated code where we check the result and then depending on SUCCESS/FAILURE/WARNING mark the step and store the result. This process is consistent across all the step so this can also be moved into BP functions