Debian Codegraph @

automation/eclair_analysis/ECLAIR/action_push.sh

raw symbols SCIP
1 #!/bin/shscip-shell filesystem . . `/bin/sh`.
2
3 set -eu
4
5 usagescip-shell shell xen 4.20.2+37-g61ff35323e-1 usage().() {
6 echoscip-shell system . . echo. "Usage: $0 WTOKEN ANALYSIS_OUTPUT_DIR" >&2
7 exit 2
8 }
9
10 [scip-shell system . . `[`. $# -eq 2 ] || usagescip-shell shell xen 4.20.2+37-g61ff35323e-1 usage().
11
12 wtoken=$1
13 analysisOutputDir=$2
14
15 # Load settings and helpers
16 . "$(dirnamescip-shell system . . dirname. "$0")/action.helpers"
17 . "$(dirnamescip-shell system . . dirname. "$0")/action.settings"
18
19 case "${event}" in
20 push)
21 curlscip-shell system . . curl. -sS "${eclairReportUrlPrefix}/ext/update_push" \
22 -F "wtoken=${wtoken}" \
23 -F "artifactsDir=${artifactsDir}" \
24 -F "subDir=${subDir}" \
25 -F "jobId=${jobId}" \
26 -F "jobHeadline=${jobHeadline}" \
27 -F "commitId=${headCommitId}" \
28 -F "badgeLabel=${badgeLabel}" \
29 -F "keepOldAnalyses=${keepOldAnalyses}" \
30 -F "db=@${analysisOutputDir}/PROJECT.ecd" \
31 >"${updateLog}"
32 ;;
33 auto_pull_request)
34 curlscip-shell system . . curl. -sS "${eclairReportUrlPrefix}/ext/update_pull_request" \
35 -F "wtoken=${wtoken}" \
36 -F "artifactsDir=${artifactsDir}" \
37 -F "subDir=${subDir}" \
38 -F "jobId=${jobId}" \
39 -F "jobHeadline=${jobHeadline}" \
40 -F "baseCommitId=${baseCommitId}" \
41 -F "keepOldAnalyses=${keepOldAnalyses}" \
42 -F "db=@${analysisOutputDir}/PROJECT.ecd" \
43 >"${updateLog}"
44 ;;
45 *)
46 echoscip-shell system . . echo. "Unexpected event ${event}" >&2
47 exit 1
48 ;;
49 esac
50
51 ex=0
52 grepscip-shell system . . grep. -Fq "unfixedReports: " "${updateLog}" || ex=$?
53 maybe_log_file_exit PUBLISH_RESULT "Publishing results" "${updateLog}" "${ex}"
54
55 summary
56
57 if is_enabled "${ENABLE_ECLAIR_BOT:-}"; then
58 case ${ci} in
59 github)
60 ex=0
61 gh api \
62 --method POST \
63 "/repos/${repository}/commits/${headCommitId}/comments" \
64 -F "body=@${summaryTxt}" \
65 --silent >"${commentLog}" 2>&1 || ex=$?
66 maybe_log_file_exit ADD_COMMENT "Adding comment" "${commentLog}" "${ex}"
67 ;;
68 gitlab)
69 curlscip-shell system . . curl. -sS --request POST \
70 "${gitlabApiUrl}/projects/${CI_PROJECT_ID}/repository/commits/${CI_COMMIT_SHA}/comments" \
71 -H "PRIVATE-TOKEN: ${gitlabBotToken}" \
72 -F "note=<${summaryTxt}" >"${commentLog}"
73 ex=0
74 grepscip-shell system . . grep. -Fq "Unfixed reports: " "${commentLog}" || ex=$?
75 maybe_log_file_exit ADD_COMMENT "Adding comment" "${commentLog}" "${ex}"
76 ;;
77 jenkins)
78 ex=0
79 curlscip-shell system . . curl. \
80 --user "${jenkinsBotUsername}:${jenkinsBotToken}" \
81 --data-urlencode "description=$(catscip-shell system . . cat. "${summaryTxt}")" \
82 --data-urlencode "Submit=Submit" \
83 "${jenkinsApiUrl}job/${project}/${jobId}/submitDescription" \
84 >"${commentLog}" 2>&1 || ex=$?
85 curlscip-shell system . . curl. \
86 --user "${jenkinsBotUsername}:${jenkinsBotToken}" \
87 --data-urlencode "description=$(catscip-shell system . . cat. "${summaryTxt}")" \
88 --data-urlencode "Submit=Submit" \
89 "${jenkinsApiUrl}job/${project}/submitDescription" \
90 >"${commentLog}" 2>&1 || ex=$?
91 maybe_log_file_exit ADD_COMMENT "Adding comment" "${commentLog}" "${ex}"
92 ;;
93 *) ;;
94 esac
95 fi