From 3010bb297759e7c1caa7d55b61927786a5281ca9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Brey=20Vilas?= Date: Tue, 28 Sep 2021 15:45:35 +0200 Subject: [PATCH] scripts/drone: Use deleteOldComments everywhere MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This removes duplication between deleteOldComments and deleteOutdatedComments. Additionally, deleteOutdatedComments was broken anyway, and IT/drone test comments were not being deleted. Signed-off-by: Álvaro Brey Vilas --- .drone.yml | 4 ++-- scripts/deleteOutdatedComments.sh | 17 ----------------- scripts/runAllScreenshotCombinations | 5 ++--- scripts/runCombinedTest.sh | 4 ++-- 4 files changed, 6 insertions(+), 24 deletions(-) delete mode 100755 scripts/deleteOutdatedComments.sh diff --git a/.drone.yml b/.drone.yml index 2236a9ada9..57d2d85a37 100644 --- a/.drone.yml +++ b/.drone.yml @@ -25,11 +25,11 @@ steps: - ./gradlew assembleGplay - ./gradlew assembleGplayDebug - scripts/wait_for_emulator.sh - - scripts/deleteOutdatedComments.sh "stable" "Unit" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN + - scripts/deleteOldComments.sh "stable" "Unit" $DRONE_PULL_REQUEST $GIT_TOKEN - ./gradlew jacocoTestGplayDebugUnitTestReport || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "stable" "Unit" $DRONE_PULL_REQUEST $GIT_TOKEN - ./gradlew installGplayDebugAndroidTest - scripts/wait_for_server.sh "server" - - scripts/deleteOutdatedComments.sh "stable" "IT" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN + - scripts/deleteOldComments.sh "stable" "IT" $DRONE_PULL_REQUEST $GIT_TOKEN - ./gradlew createGplayDebugCoverageReport -Pcoverage -Pandroid.testInstrumentationRunnerArguments.notAnnotation=com.owncloud.android.utils.ScreenshotTest || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "stable" "IT" $DRONE_PULL_REQUEST $GIT_TOKEN - ./gradlew combinedTestReport - name: notify diff --git a/scripts/deleteOutdatedComments.sh b/scripts/deleteOutdatedComments.sh deleted file mode 100755 index 5f9a4c5ab5..0000000000 --- a/scripts/deleteOutdatedComments.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash - -BRANCH=$1 -TYPE=$2 -PR=$3 -GITHUB_USER=$4 -GITHUB_PASSWORD=$5 -BRANCH_TYPE=$BRANCH-$TYPE - -# delete all old comments, matching this type -oldComments=$(curl 2>/dev/null -u $GITHUB_USER:$GITHUB_PASSWORD -X GET https://api.github.com/repos/nextcloud/android/issues/$PR/comments | jq --arg TYPE $BRANCH_TYPE '.[] | (.id |tostring) + "|" + (.user.login | test("nextcloud-android-bot") | tostring) + "|" + (.body | test([$TYPE]) | tostring)'| grep "true|true" | tr -d "\"" | cut -f1 -d"|") - -echo $oldComments | while read comment ; do - curl 2>/dev/null -u $GITHUB_USER:$GITHUB_PASSWORD -X DELETE https://api.github.com/repos/nextcloud/android/issues/comments/$comment -done - -exit 0 diff --git a/scripts/runAllScreenshotCombinations b/scripts/runAllScreenshotCombinations index ac74fdb3a9..cc3123c4e8 100755 --- a/scripts/runAllScreenshotCombinations +++ b/scripts/runAllScreenshotCombinations @@ -1,6 +1,6 @@ #!/bin/bash -## $1 noCI/stable/master: wether to run deleteOutdatedComments.sh or uploadReport.sh +## $1 noCI/stable/master: wether to run deleteOldComments.sh or uploadReport.sh ## $2 true/false: record or verify screenshots ## $3 classMethod: piped from androidScreenshotTest ## $4 github event number @@ -42,8 +42,7 @@ do -Pandroid.testInstrumentationRunnerArguments.annotation=com.owncloud.android.utils.ScreenshotTest \ -Pandroid.testInstrumentationRunnerArguments.COLOR="$color" \ -Pandroid.testInstrumentationRunnerArguments.DARKMODE="$darkMode" /dev/null \ - && scripts/deleteOutdatedComments.sh "$1-$darkMode-$color" "Screenshot" "$4" \ - "$GIT_USERNAME" "$GIT_TOKEN" \ + && scripts/deleteOldComments.sh "$1-$darkMode-$color" "Screenshot" "$4" "$GIT_TOKEN" \ || resultCode=1 && scripts/uploadReport.sh "$LOG_USERNAME" "$LOG_PASSWORD" "$4" \ "$1-$darkMode-$color" "Screenshot" "$4" "$GIT_TOKEN" fi diff --git a/scripts/runCombinedTest.sh b/scripts/runCombinedTest.sh index 5b23eddb92..82709d95f1 100755 --- a/scripts/runCombinedTest.sh +++ b/scripts/runCombinedTest.sh @@ -7,8 +7,8 @@ LOG_USERNAME=$4 LOG_PASSWORD=$5 DRONE_BUILD_NUMBER=$6 -scripts/deleteOutdatedComments.sh "master" "Unit" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN -scripts/deleteOutdatedComments.sh "master" "IT" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN +scripts/deleteOldComments.sh "master" "Unit" $DRONE_PULL_REQUEST $GIT_TOKEN +scripts/deleteOldComments.sh "master" "IT" $DRONE_PULL_REQUEST $GIT_TOKEN ./gradlew assembleGplay ./gradlew assembleGplayDebug