Merge branch '2.0.x'
This commit is contained in:
commit
ad5b8e8bfb
|
|
@ -144,12 +144,27 @@ jobs:
|
||||||
do:
|
do:
|
||||||
- put: repo-status-build
|
- put: repo-status-build
|
||||||
params: { state: "failure", commit: "git-repo" }
|
params: { state: "failure", commit: "git-repo" }
|
||||||
|
- task: determine-email-body
|
||||||
|
image: spring-boot-ci-image
|
||||||
|
file: git-repo/ci/tasks/determine-email-body.yml
|
||||||
|
params:
|
||||||
|
STATE: failure
|
||||||
- put: email-notification
|
- put: email-notification
|
||||||
params:
|
params:
|
||||||
subject_text: "Build failure ${BUILD_PIPELINE_NAME} / ${BUILD_JOB_NAME} / ${BUILD_NAME}"
|
subject: email-details/subject
|
||||||
body_text: "Build ${ATC_EXTERNAL_URL}/teams/${BUILD_TEAM_NAME}/pipelines/${BUILD_PIPELINE_NAME}/jobs/${BUILD_JOB_NAME}/builds/${BUILD_NAME} has failed!"
|
body: email-details/body
|
||||||
|
- do:
|
||||||
|
- task: determine-email-body
|
||||||
|
image: spring-boot-ci-image
|
||||||
|
file: git-repo/ci/tasks/determine-email-body.yml
|
||||||
|
params:
|
||||||
|
STATE: success
|
||||||
- put: repo-status-build
|
- put: repo-status-build
|
||||||
params: { state: "success", commit: "git-repo" }
|
params: { state: "success", commit: "git-repo" }
|
||||||
|
- put: email-notification
|
||||||
|
params:
|
||||||
|
subject: email-details/subject
|
||||||
|
body: email-details/body
|
||||||
- put: artifactory-repo
|
- put: artifactory-repo
|
||||||
params: &artifactory-params
|
params: &artifactory-params
|
||||||
repo: libs-snapshot-local
|
repo: libs-snapshot-local
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
mkdir email-details
|
||||||
|
|
||||||
|
PREV_SHA=$(git rev-parse HEAD^1)
|
||||||
|
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'
|
||||||
|
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
|
||||||
|
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
|
||||||
|
elif [[ $WAS_PREV_SUCCESSFUL == "success" ]];then
|
||||||
|
echo "" > 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
|
||||||
|
if [[ $WAS_PREV_SUCCESSFUL == "" ]];then
|
||||||
|
echo "Still FAILING ${BUILD_PIPELINE_NAME} / ${BUILD_JOB_NAME} / ${BUILD_NAME}" > email-details/subject
|
||||||
|
elif [[ $WAS_PREV_SUCCESSFUL == "success" ]];then
|
||||||
|
echo "Build FAILURE ${BUILD_PIPELINE_NAME} / ${BUILD_JOB_NAME} / ${BUILD_NAME}" > email-details/subject
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
---
|
||||||
|
platform: linux
|
||||||
|
inputs:
|
||||||
|
- name: git-repo
|
||||||
|
outputs:
|
||||||
|
- name: email-details
|
||||||
|
run:
|
||||||
|
path: git-repo/ci/scripts/determine-email-body.sh
|
||||||
Loading…
Reference in New Issue