diff --git a/devtools/benchmarks-tools/cronjob.sh b/devtools/benchmarks-tools/cronjob.sh index ae36ca81e39626df65bde78680b20ebfa1aad19d..7e9b1dcf8d22982def86a6db3040c0892c8c0764 100755 --- a/devtools/benchmarks-tools/cronjob.sh +++ b/devtools/benchmarks-tools/cronjob.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env bash ############################################################################# # # @@ -40,10 +40,10 @@ TODAY=$(date +"%Y%m%d_%H%M") # messages using the gas-benchmarks-reports Slack application. # The file can only be read by mclaren, its owner. This is to prevent anybody to # use the application to send messages. -# C04HZHR11DW is the identifier for the #gas-benchmarks-reports channel (it can +# C088AUBEB6Y is the identifier for the #core-layer1-gas-benchmarks-reports channel (it can # be found in its URL). slack() { - curl -X POST -H 'Authorization: Bearer '"$(cat /data/tezos-benchmarks/slack_token)" -H 'Content-type: application/json; charset=utf-8' --data "{\"channel\":\"C04HZHR11DW\",\"text\":\"$1\"}" https://tezos-dev.slack.com/api/chat.postMessage + curl -X POST -H 'Authorization: Bearer '"$(cat /data/tezos-benchmarks/slack_token)" -H 'Content-type: application/json; charset=utf-8' --data "{\"channel\":\"C088AUBEB6Y\",\"text\":\"$1\"}" https://tezos.slack.com/api/chat.postMessage } anomaly() { diff --git a/devtools/benchmarks-tools/run_all_benchmarks_on_latest_master.sh b/devtools/benchmarks-tools/run_all_benchmarks_on_latest_master.sh index 3d15d9da0fa10cb885bc2e503e089e5340fef45c..82d954234c8d5322f7a436394dc5535a2925031e 100755 --- a/devtools/benchmarks-tools/run_all_benchmarks_on_latest_master.sh +++ b/devtools/benchmarks-tools/run_all_benchmarks_on_latest_master.sh @@ -89,6 +89,9 @@ cd tezos dated_log "Compiling dependencies" # shellcheck disable=SC1091 . "/home/mclaren/.cargo/env" +# Reset switch +rm -rf ../.opam +opam init --bare --root /data/tezos-benchmarks/.opam --confirm-level=no # OPAMSOLVERTIMEOUT=0 means that the opam solver won't timeout make OPAMSOLVERTIMEOUT=0 build-dev-deps eval "$(opam env)" diff --git a/devtools/benchmarks-tools/watch_regressions.sh b/devtools/benchmarks-tools/watch_regressions.sh index cf73424a184e94cbeee69eb7b3e8883d479b8ea4..bb75efd59d1e648cf67a562e4d4d52aa394867a4 100755 --- a/devtools/benchmarks-tools/watch_regressions.sh +++ b/devtools/benchmarks-tools/watch_regressions.sh @@ -76,7 +76,18 @@ slack() { slack_send_file() { if [ "$DISABLE_SLACK_MESSAGING" = "" ]; then - curl -F file=@"$1" -F "initial_comment=$2" -F channels="$CHAN" -F token="$TOK" https://tezos.slack.com/api/files.upload + FILESIZE="$(stat --printf="%s" "$1")" + RESPONSE="$(curl -F filename="$1" -F length="$FILESIZE" -F token="$TOK" https://tezos.slack.com/api/files.getUploadURLExternal)" + OK="$(echo "$RESPONSE" | jq -r .ok)" + if [ "$OK" = "true" ]; then + URL="$(echo "$RESPONSE" | jq -r .upload_url)" + ID="$(echo "$RESPONSE" | jq -r .file_id)" + curl -X POST -F filename=@"$1" "$URL" + curl -X POST -F files="[{\"id\":\"$ID\", \"title\":\"$1\"}]" -F "initial_comment=$2" -F channels="$CHAN" -F token="$TOK" https://tezos.slack.com/api/files.completeUploadExternal + else + ERROR="$(echo "$RESPONSE" | jq -r .error)" + echo "Error: could not send \"$1\" on Slack with message \"$2\". Error: \"$ERROR\"" + fi else echo "File \"$1\" would be sent on Slack with message \"$2\" but Slack messaging has been disabled." fi