vpp-checkstyle-verify-{stream}: add the step to API check 14/27414/4
authorAndrew Yourtchenko <ayourtch@gmail.com>
Wed, 3 Jun 2020 19:30:31 +0000 (19:30 +0000)
committerAndrew Yourtchenko <ayourtch@gmail.com>
Tue, 16 Jun 2020 14:17:28 +0000 (14:17 +0000)
This patch adds calling the crcchecker.py --check-patchset
in the initial checkstyle path.

(see change ID I5f13c0976d8a12a58131b3e270f2dc9c00dc7d8c)

It adds also:

- gerrit-refspec-parameter to be able to specify the patchset manually

- credentials-binding for a WebEx Teams bot - I had them added via IT-19800

- necessary plumbing to use these credentials. It is done by a minimal
  curl setup, which posts into room "VPP API check failures",
  which I created to be able to monitor the behavior and jump in
  to discuss and help to sort out the changes that may be problematic.

Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
Change-Id: I4833aa929044413a1ac08ab80668f25c0db8b3ff

jjb/scripts/vpp/api-checkstyle.sh [new file with mode: 0644]
jjb/vpp/vpp.yaml

diff --git a/jjb/scripts/vpp/api-checkstyle.sh b/jjb/scripts/vpp/api-checkstyle.sh
new file mode 100644 (file)
index 0000000..9074033
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+VPP_CRC_CHECKER="extras/scripts/crcchecker.py"
+VPP_CRC_CHECKER_CMD="$VPP_CRC_CHECKER --check-patchset"
+
+send_notify() {
+           # 'roomId' field from the response of:
+           # curl https://api.ciscospark.com/v1/memberships  -H "Authorization: Bearer ${SECRET_WEBEX_TEAMS_ACCESS_TOKEN}"
+           WEBEX_TEAMS_ROOM_ID='Y2lzY29zcGFyazovL3VzL1JPT00vMzUzZmI3OTAtYTVjNS0xMWVhLWI4ZjYtMDUxN2I4NzFmOWU5'
+           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
+}
+
+if [ -f $VPP_CRC_CHECKER ]; then
+    echo "Running $VPP_CRC_CHECKER_CMD"
+    if $VPP_CRC_CHECKER_CMD; then
+           echo "API check successful"
+
+           # for now - notify the same room during the monitoring period about the successes as well
+           WEBEX_TEAMS_MESSAGE="API check successful for $GERRIT_REFSPEC - see $BUILD_URL"
+           send_notify
+    else
+           RET_CODE=$?
+           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"
+           WEBEX_TEAMS_MESSAGE="API check FAILED for $GERRIT_REFSPEC -  see $BUILD_URL"
+           send_notify
+           exit $RET_CODE
+    fi
+else
+    echo "Cannot find $VPP_CRC_CHECKER - skipping API compatibility check"
+fi
index 216ec40..dacd685 100644 (file)
           os: '{os}'
       - repo-name-parameter:
           repo-name: '{repo-stream-part}.ubuntu.bionic.main'
+      - gerrit-refspec-parameter
 
     scm:
       - gerrit-trigger-scm:
     wrappers:
       - fdio-infra-wrappers:
           build-timeout: '{build-timeout}'
+      - credentials-binding:
+          - text:
+              credential-id: VppApiCompatNotify
+              variable: SECRET_WEBEX_TEAMS_ACCESS_TOKEN
+
 
     triggers:
       - gerrit:
       - shell:
           !include-raw-escape:
           - ../scripts/vpp/test-checkstyle.sh
+      - shell:
+          !include-raw-escape:
+          - ../scripts/vpp/api-checkstyle.sh
       - shell:
           !include-raw-escape:
           - ../scripts/vpp/commitmsg.sh