Second attempt at fixing email notification script

pull/12890/head
Madhura Bhave 7 years ago
parent 68a9aa56f0
commit 62a8f60bb3

@ -6,7 +6,7 @@ pushd git-repo > /dev/null
popd > /dev/null popd > /dev/null
PREV_STATUSES=$( curl https://api.github.com/repos/spring-projects/spring-boot/commits/$PREV_SHA/statuses ) PREV_STATUSES=$( curl https://api.github.com/repos/spring-projects/spring-boot/commits/$PREV_SHA/statuses )
PREV_STATES=$( echo $PREV_STATUSES | jq -r --arg BUILD_JOB_NAME "$BUILD_JOB_NAME" '.[] | select(.context == $BUILD_JOB_NAME) | .state' ) PREV_STATES=$( echo $PREV_STATUSES | jq -r --arg BUILD_JOB_NAME "$BUILD_JOB_NAME" '.[] | select(.context == $BUILD_JOB_NAME) | .state' )
WAS_PREV_SUCCESSFUL=$(echo $PREV_STATES | grep 'success') WAS_PREV_SUCCESSFUL=$( echo "$PREV_STATES" | grep 'success' || true )
if [[ $STATE == "success" ]];then if [[ $STATE == "success" ]];then
echo "Build SUCCESSFUL ${BUILD_PIPELINE_NAME} / ${BUILD_JOB_NAME}" > email-details/subject echo "Build SUCCESSFUL ${BUILD_PIPELINE_NAME} / ${BUILD_JOB_NAME}" > email-details/subject

Loading…
Cancel
Save