vpp-checkstyle-verify-{stream}: add the step to API check
[ci-management.git] / jjb / scripts / vpp / api-checkstyle.sh
1 #!/bin/bash
2
3 VPP_CRC_CHECKER="extras/scripts/crcchecker.py"
4 VPP_CRC_CHECKER_CMD="$VPP_CRC_CHECKER --check-patchset"
5
6 send_notify() {
7             # 'roomId' field from the response of:
8             # curl https://api.ciscospark.com/v1/memberships  -H "Authorization: Bearer ${SECRET_WEBEX_TEAMS_ACCESS_TOKEN}"
9             WEBEX_TEAMS_ROOM_ID='Y2lzY29zcGFyazovL3VzL1JPT00vMzUzZmI3OTAtYTVjNS0xMWVhLWI4ZjYtMDUxN2I4NzFmOWU5'
10             curl https://api.ciscospark.com/v1/messages -X POST  -H "Authorization: Bearer ${SECRET_WEBEX_TEAMS_ACCESS_TOKEN}" -H "Content-Type: application/json" --data '{"roomId":"'${WEBEX_TEAMS_ROOM_ID}'", "markdown": "'"${WEBEX_TEAMS_MESSAGE}"'" }' || true
11 }
12
13 if [ -f $VPP_CRC_CHECKER ]; then
14     echo "Running $VPP_CRC_CHECKER_CMD"
15     if $VPP_CRC_CHECKER_CMD; then
16             echo "API check successful"
17
18             # for now - notify the same room during the monitoring period about the successes as well
19             WEBEX_TEAMS_MESSAGE="API check successful for $GERRIT_REFSPEC - see $BUILD_URL"
20             send_notify
21     else
22             RET_CODE=$?
23             echo "API check failed: ret code $RET_CODE; please read https://wiki.fd.io/view/VPP/ApiChangeProcess and discuss with ayourtch@gmail.com if unsure how to proceed"
24             WEBEX_TEAMS_MESSAGE="API check FAILED for $GERRIT_REFSPEC -  see $BUILD_URL"
25             send_notify
26             exit $RET_CODE
27     fi
28 else
29     echo "Cannot find $VPP_CRC_CHECKER - skipping API compatibility check"
30 fi