File: postCDashStatus.sh

package info (click to toggle)
adios2 2.10.2%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 33,764 kB
  • sloc: cpp: 175,964; ansic: 160,510; f90: 14,630; yacc: 12,668; python: 7,275; perl: 7,126; sh: 2,825; lisp: 1,106; xml: 1,049; makefile: 579; lex: 557
file content (29 lines) | stat: -rwxr-xr-x 1,093 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash
API_BASE="https://api.github.com/repos/ornladios/adios2"
USER=${STATUS_ROBOT_NAME}
TOKEN=${STATUS_ROBOT_KEY}
COMMIT=${CIRCLE_SHA1}
CDASH_STATUS_CONTEXT="cdash"
SOURCE_DIR="$(readlink -f "${CIRCLE_WORKING_DIRECTORY}"/source)"

build_status_body() {
  cat <<EOF
{
  "state": "success",
  "target_url": "https://open.cdash.org/index.php?compare1=61&filtercount=1&field1=revision&project=ADIOS&showfilters=0&limit=100&value1=${COMMIT}&showfeed=0",
  "description": "Build and test results available on CDash",
  "context": "${CDASH_STATUS_CONTEXT}"
}
EOF
}

PYTHON_SCRIPT="${SOURCE_DIR}/scripts/ci/circle/findStatus.py"
curl -u "${USER}:${TOKEN}" "${API_BASE}/commits/${COMMIT}/statuses" | python3 "${PYTHON_SCRIPT}" --context ${CDASH_STATUS_CONTEXT}
exit_status=$?
if [ "$exit_status" -ne 0 ]
then
  echo "Need to post a status for context ${CDASH_STATUS_CONTEXT}"
  postBody="$(build_status_body)"
  postUrl="${API_BASE}/statuses/${COMMIT}"
  curl -u "${USER}:${TOKEN}" "${postUrl}" -H "Content-Type: application/json" -H "Accept: application/vnd.github.v3+json" -d "${postBody}"
fi