diff --git a/.drone.star b/.drone.star index 786c564423d..1398efbf052 100644 --- a/.drone.star +++ b/.drone.star @@ -2454,32 +2454,75 @@ def buildGithubCommentForBuildStopped(suite): }] def githubComment(alternateSuiteName): - prefix = "Results for %s ${DRONE_BUILD_LINK}/${DRONE_JOB_NUMBER}${DRONE_STAGE_NUMBER}/1" % alternateSuiteName - return [{ - "name": "github-comment", - "image": "jmccann/drone-github-comment:1", - "pull": "if-not-exists", - "settings": { - "message_file": "%s/comments.file" % dir["web"], + prefixGitHub = "Results for %s ${DRONE_BUILD_LINK}/${DRONE_JOB_NUMBER}${DRONE_STAGE_NUMBER}/1" % alternateSuiteName + prefixRocketChat = "Results for *%s* ${DRONE_BUILD_LINK}/${DRONE_JOB_NUMBER}${DRONE_STAGE_NUMBER}/1" % alternateSuiteName + return [ + { + "name": "copy-passedOnRetry", + "image": "owncloud/ubuntu:20.04", + "pull": "always", + "commands": [ + "touch %s/rocketChat.file" % dir["web"], + "if [ -s %s/passedOnRetry.file ]; then cat %s/passedOnRetry.file >> %s/comments.file; fi" % (dir["web"], dir["web"], dir["web"]), + "if [ -s %s/passedOnRetry.file ]; then echo '%s' | cat - %s/passedOnRetry.file > %s/rocketChat.file; fi" % (dir["web"], prefixRocketChat, dir["web"], dir["web"]), + ], + "when": { + "status": [ + "success", + "failure", + ], + "event": [ + "pull_request", + ], + }, }, - "environment": { - "GITHUB_TOKEN": { - "from_secret": "github_token", + { + "name": "notify-passedOnRetry", + "image": "plugins/slack:1", + "pull": "always", + "settings": { + "webhook": { + "from_secret": config["rocketchat"]["from_secret"], + }, + "channel": config["rocketchat"]["channel"], + "template": "file:%s/rocketChat.file" % dir["web"], + }, + "when": { + "status": [ + "success", + "failure", + ], + "event": [ + "pull_request", + ], }, }, - "commands": [ - "if [ -s /var/www/owncloud/web/comments.file ]; then echo '%s' | cat - comments.file > temp && mv temp comments.file && /bin/drone-github-comment; fi" % prefix, - ], - "when": { - "status": [ - "success", - "failure", - ], - "event": [ - "pull_request", + { + "name": "github-comment", + "image": "jmccann/drone-github-comment:1", + "pull": "if-not-exists", + "settings": { + "message_file": "%s/comments.file" % dir["web"], + }, + "environment": { + "GITHUB_TOKEN": { + "from_secret": "github_token", + }, + }, + "commands": [ + "if [ -s /var/www/owncloud/web/comments.file ]; then echo '%s' | cat - comments.file > temp && mv temp comments.file && /bin/drone-github-comment; fi" % prefixGitHub, ], + "when": { + "status": [ + "success", + "failure", + ], + "event": [ + "pull_request", + ], + }, }, - }] + ] def example_deploys(ctx): latest_configs = [ diff --git a/.gitignore b/.gitignore index 0637dcf6eda..e86f81fdcab 100644 --- a/.gitignore +++ b/.gitignore @@ -39,6 +39,7 @@ tests/testing-app # acceptance test artifacts logfile.txt comments.file +passedOnRetry.file # drone CI is in .drone.star, do not let someone accidentally commit a local .drone.yml .drone.yml diff --git a/tests/acceptance/run.sh b/tests/acceptance/run.sh index 19734618fe4..cec15c151b2 100755 --- a/tests/acceptance/run.sh +++ b/tests/acceptance/run.sh @@ -4,9 +4,9 @@ SCRIPT_PATH=$(dirname "$0") SCRIPT_PATH=$( cd "${SCRIPT_PATH}" && pwd ) # normalized and made absolute FEATURES_DIR="${SCRIPT_PATH}/features" -COMMENTS_FILE="${COMMENTS_FILE:-comments.file}" +PASSED_ON_RETRY_FILE="${PASSED_ON_RETRY_FILE:-passedOnRetry.file}" -rm -rf logfile.txt "$COMMENTS_FILE" +rm -rf logfile.txt "$PASSED_ON_RETRY_FILE" echo 'run.sh: running acceptance-tests-drone' @@ -240,9 +240,9 @@ if [ ${#SINGLE_FAILED_SCENARIOS[@]} -ne 0 ] then echo "" echo "" - echo "The following scenarios passed on retry:" | tee -a "$COMMENTS_FILE" + echo "The following scenarios passed on retry:" | tee -a "$PASSED_ON_RETRY_FILE" echo "-------------------------------" - for KEY in "${!SINGLE_FAILED_SCENARIOS[@]}"; do echo "- $KEY" | tee -a "$COMMENTS_FILE"; done + for KEY in "${!SINGLE_FAILED_SCENARIOS[@]}"; do echo "- $KEY" | tee -a "$PASSED_ON_RETRY_FILE"; done echo "-------------------------------" fi