Skip to content

Commit

Permalink
Merge branch '2.0.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
mbhave committed Apr 12, 2018
2 parents eff6ce5 + 68a9aa5 commit d375808
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
2 changes: 2 additions & 0 deletions ci/parameters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@ docker-hub-organization: "springci"
artifactory-server: "https://repo.spring.io/"
branch: "master"
build-name: "spring-boot"
pipeline-name: "spring-boot"
concourse-url: "https://ci.spring.io"
bintray-subject: "spring"
bintray-repo: "jars"
6 changes: 6 additions & 0 deletions ci/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ jobs:
file: git-repo/ci/tasks/determine-email-body.yml
params:
STATE: failure
BUILD_PIPELINE_NAME: ((pipeline-name))
BUILD_JOB_NAME: build
CONCOURSE_URL: ((concourse-url))
- put: email-notification
params:
subject: email-details/subject
Expand All @@ -159,6 +162,9 @@ jobs:
file: git-repo/ci/tasks/determine-email-body.yml
params:
STATE: success
BUILD_PIPELINE_NAME: ((pipeline-name))
BUILD_JOB_NAME: build
CONCOURSE_URL: ((concourse-url))
- put: repo-status-build
params: { state: "success", commit: "git-repo" }
- put: email-notification
Expand Down
19 changes: 10 additions & 9 deletions ci/scripts/determine-email-body.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
#!/bin/bash
set -e

PREV_SHA=$(git rev-parse HEAD^1)
pushd git-repo > /dev/null
PREV_SHA=$(git rev-parse HEAD^1)
popd > /dev/null
PREV_STATUSES=$(curl https://api.github.com/repos/spring-projects/spring-boot/commits/$PREV_SHA/statuses)
PREV_STATES=echo $PREV_STATUSES | jq -r '.[] | select(.context == "build") | .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')

if [[ $STATE == "success" ]];then
echo "Build SUCCESSFUL ${BUILD_PIPELINE_NAME} / ${BUILD_JOB_NAME} / ${BUILD_NAME}" > email-details/subject
echo "Build SUCCESSFUL ${BUILD_PIPELINE_NAME} / ${BUILD_JOB_NAME}" > email-details/subject
if [[ $WAS_PREV_SUCCESSFUL == "" ]];then
echo "Build ${ATC_EXTERNAL_URL}/teams/${BUILD_TEAM_NAME}/pipelines/${BUILD_PIPELINE_NAME}/jobs/${BUILD_JOB_NAME}/builds/${BUILD_NAME} is successful!" > email-details/body
echo "Build ${CONCOURSE_URL}/teams/spring-boot/pipelines/${BUILD_PIPELINE_NAME} is successful!" > email-details/body
elif [[ $WAS_PREV_SUCCESSFUL == "success" ]];then
echo "" > email-details/body
touch email-details/body
fi
fi
elif [[ $STATE == "failure" ]];then
echo "Build ${ATC_EXTERNAL_URL}/teams/${BUILD_TEAM_NAME}/pipelines/${BUILD_PIPELINE_NAME}/jobs/${BUILD_JOB_NAME}/builds/${BUILD_NAME} has failed!" > email-details/body
echo "Build ${CONCOURSE_URL}/teams/spring-boot/pipelines/${BUILD_PIPELINE_NAME} has failed!" > email-details/body
if [[ $WAS_PREV_SUCCESSFUL == "" ]];then
echo "Still FAILING ${BUILD_PIPELINE_NAME} / ${BUILD_JOB_NAME} / ${BUILD_NAME}" > email-details/subject
echo "Still FAILING ${BUILD_PIPELINE_NAME} / ${BUILD_JOB_NAME}" > email-details/subject
elif [[ $WAS_PREV_SUCCESSFUL == "success" ]];then
echo "Build FAILURE ${BUILD_PIPELINE_NAME} / ${BUILD_JOB_NAME} / ${BUILD_NAME}" > email-details/subject
echo "Build FAILURE ${BUILD_PIPELINE_NAME} / ${BUILD_JOB_NAME}" > email-details/subject
fi
fi

0 comments on commit d375808

Please sign in to comment.