From aa16bf6e3a6353e735120949da5d98015741e89e Mon Sep 17 00:00:00 2001 From: Willy Kloucek Date: Mon, 15 Nov 2021 16:02:31 +0100 Subject: [PATCH 1/6] switch to plugin based cancellation of previous builds --- .drone.star | 52 +++++++++------------------ tests/acceptance/cancelBuilds.sh | 60 -------------------------------- 2 files changed, 16 insertions(+), 96 deletions(-) delete mode 100755 tests/acceptance/cancelBuilds.sh diff --git a/.drone.star b/.drone.star index f6dda6c546..1752d57c92 100644 --- a/.drone.star +++ b/.drone.star @@ -133,7 +133,7 @@ def main(ctx): pipelines = [] test_pipelines = \ - checkForRecentBuilds(ctx) + \ + cancelPreviousBuilds() + \ [buildOcisBinaryForTesting(ctx)] + \ testOcisModules(ctx) + \ testPipelines(ctx) @@ -187,48 +187,28 @@ def testOcisModules(ctx): return pipelines + [scan_result_upload] -def checkForRecentBuilds(ctx): - pipelines = [] - - result = { +def cancelPreviousBuilds(): + return [{ "kind": "pipeline", "type": "docker", - "name": "stop-recent-builds", - "steps": stopRecentBuilds(ctx), - "depends_on": [], + "name": "cancel-previous-builds", + "clone": { + "disable": True, + }, + "steps": [{ + "name": "cancel-previous-builds", + "image": "owncloudci/drone-cancel-previous-builds", + "settings": { + "DRONE_TOKEN": { + "from_secret": "drone_token", + }, + }, + }], "trigger": { "ref": [ - "refs/heads/master", - "refs/tags/**", "refs/pull/**", ], }, - } - - pipelines.append(result) - - return pipelines - -def stopRecentBuilds(ctx): - return [{ - "name": "stop-recent-builds", - "image": "drone/cli:alpine", - "environment": { - "DRONE_SERVER": "https://drone.owncloud.com", - "DRONE_TOKEN": { - "from_secret": "drone_token", - }, - }, - "commands": [ - "drone build ls %s --status running > /drone/src/recentBuilds.txt" % ctx.repo.slug, - "drone build info %s ${DRONE_BUILD_NUMBER} > /drone/src/thisBuildInfo.txt" % ctx.repo.slug, - "cd /drone/src && ./tests/acceptance/cancelBuilds.sh", - ], - "when": { - "event": [ - "pull_request", - ], - }, }] def testPipelines(ctx): diff --git a/tests/acceptance/cancelBuilds.sh b/tests/acceptance/cancelBuilds.sh deleted file mode 100755 index cdebb968a9..0000000000 --- a/tests/acceptance/cancelBuilds.sh +++ /dev/null @@ -1,60 +0,0 @@ -SCRIPT_PATH=$(dirname "$0") -SCRIPT_PATH=$( cd "${SCRIPT_PATH}" && pwd ) # normalized and made absolute -OWNCLOUD_OCIS="owncloud/ocis" - -# The recentBuilds.txt file contains all the information of the PR whose builds are recently running. -# Therefore, to filter out the BuildID and the Reference from all the recent builds which are running, -# the following awk command is used and the output containing the BuildId and the Reference of each -# builds/prs are stored in the filteredDescriptions.txt file. -echo ${SCRIPT_PATH} -awk "/Build #|Ref: refs\/pull/" ${SCRIPT_PATH}/../../recentBuilds.txt > ${SCRIPT_PATH}/filteredDescriptions.txt - -# The thisBuildInfo.txt file contains the information of the current Build, including the BuildID, Reference, and -# other information of that particular build. To get the reference number/ pr number of the recent build, -# the following awk command and grep commands are used, where the Reference part ("Ref: refs/pull/5496/head") -# is stored in the "thisBuildFiltered.txt" file. From the reference, only the pr/reference number is extracted into -# the "NUMBER" variable. -awk "/Ref: refs\/pull/" ${SCRIPT_PATH}/../../thisBuildInfo.txt > ${SCRIPT_PATH}/thisBuildFiltered.txt -NUMBER=$(grep -o -E "[0-9]+" ${SCRIPT_PATH}/thisBuildFiltered.txt) -referenceNum="Ref: refs/pull/"$NUMBER"/head" - -# From all the recent builds, the information about the BuildID and the reference which was stored in the -# "filteredDescriptions.txt" file, only the BuildID part from each of the buildInformation whose Reference is -# exactly same as that of the current build reference is filtered and stored in the "buildsToStop.txt" file. -# The buildIDs and the reference information of each build is stored sequentially in the "filteredDescriptions.txt" file as: - -# "Build #" -# "" -# "Build #" -# "" -# "Build #" -# "" - -# Therefore the following awk command extracts each lines just above the expected reference information. -awk -v ref="$referenceNum" 'index($0,ref){print p} {p=$0}' ${SCRIPT_PATH}/filteredDescriptions.txt > ${SCRIPT_PATH}/buildsToStop.txt - - -# The "buildsToStop.txt" file now contains the buildIDs of the recent builds whose reference id was equal to the reference of the -# current pr/build. - -# "Build #" -# "Build #" -# "Build #" -# "Build #" -# "Build #" - -# For each build in the "buildsToStop.txt" file, if the build number is older than the current drone build number, the build is cancelled. - -while IFS="" read -r p || [ -n "$p" ] -do - printf '%s\n' "$p" - buildNumber=$(echo "$p" | awk -F'#' '{print $(2)}') - - if [ $DRONE_BUILD_NUMBER \> "$buildNumber" ] - then - echo "CANCELLING BUILD: " $buildNumber - drone build stop $OWNCLOUD_OCIS $buildNumber - fi - -done <${SCRIPT_PATH}/buildsToStop.txt - From dde2d718f18568f42ee36a055b61d0f19de46671 Mon Sep 17 00:00:00 2001 From: sakshamgurung Date: Wed, 17 Nov 2021 15:06:44 +0900 Subject: [PATCH 2/6] latest core commit id bump --- .drone.env | 2 +- tests/acceptance/expected-failures-API-on-OCIS-storage.md | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.drone.env b/.drone.env index 1ff00cdd66..10679b07a2 100644 --- a/.drone.env +++ b/.drone.env @@ -1,5 +1,5 @@ # The test runner source for API tests -CORE_COMMITID=4e808c1a89462fb91d2439dc3d9c490ebced3139 +CORE_COMMITID=13d7bda4a6e64c816e3897980ec20b1812d17423 CORE_BRANCH=master # The test runner source for UI tests diff --git a/tests/acceptance/expected-failures-API-on-OCIS-storage.md b/tests/acceptance/expected-failures-API-on-OCIS-storage.md index 951964d56e..2dd24f18be 100644 --- a/tests/acceptance/expected-failures-API-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-API-on-OCIS-storage.md @@ -1261,6 +1261,7 @@ Scenario Outline: Unauthenticated call - [apiCapabilities/capabilities.feature:737](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiCapabilities/capabilities.feature#L737) - [apiCapabilities/capabilities.feature:766](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiCapabilities/capabilities.feature#L766) - [apiCapabilities/capabilities.feature:795](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiCapabilities/capabilities.feature#L795) +- [apiCapabilities/capabilities.feature:827](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiCapabilities/capabilities.feature#L827) - [apiShareCreateSpecialToShares1/createShareWhenExcludedFromSharing.feature:25](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareCreateSpecialToShares1/createShareWhenExcludedFromSharing.feature#L25) - [apiShareCreateSpecialToShares1/createShareWhenExcludedFromSharing.feature:26](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareCreateSpecialToShares1/createShareWhenExcludedFromSharing.feature#L26) - [apiShareCreateSpecialToShares1/createShareWhenExcludedFromSharing.feature:44](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareCreateSpecialToShares1/createShareWhenExcludedFromSharing.feature#L44) From cc005c9eca24e0ea47d3549ffa66a5cd743f1fe3 Mon Sep 17 00:00:00 2001 From: Willy Kloucek Date: Thu, 18 Nov 2021 08:21:01 +0100 Subject: [PATCH 3/6] remove warning from parallel deployment docs --- docs/ocis/deployment/oc10_ocis_parallel.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/docs/ocis/deployment/oc10_ocis_parallel.md b/docs/ocis/deployment/oc10_ocis_parallel.md index fca3a8de1f..a8ccac2df5 100644 --- a/docs/ocis/deployment/oc10_ocis_parallel.md +++ b/docs/ocis/deployment/oc10_ocis_parallel.md @@ -9,10 +9,6 @@ geekdocFilePath: oc10_ocis_parallel.md {{< toc >}} -{{< hint warning >}} -This deployment example currently has known issues. See [github.com/owncloud/ocis/issues/2549](https://github.com/owncloud/ocis/issues/2549) for more information. -{{< /hint >}} - ## Overview - This setup reflects [stage 6 of the oC10 to oCIS migration plan]({{< ref "migration#stage-6-parallel-deployment" >}}) From 376661f2f9006db20254e436570acb5734015353 Mon Sep 17 00:00:00 2001 From: Willy Kloucek Date: Thu, 18 Nov 2021 08:24:16 +0100 Subject: [PATCH 4/6] change PR reference to openidconnect app release version --- .../oc10_ocis_parallel/config/oc10/10-custom-config.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/deployments/examples/oc10_ocis_parallel/config/oc10/10-custom-config.sh b/deployments/examples/oc10_ocis_parallel/config/oc10/10-custom-config.sh index 0a1113220c..543981d5e4 100755 --- a/deployments/examples/oc10_ocis_parallel/config/oc10/10-custom-config.sh +++ b/deployments/examples/oc10_ocis_parallel/config/oc10/10-custom-config.sh @@ -6,7 +6,8 @@ gomplate \ -f /etc/templates/oidc.config.php \ -o ${OWNCLOUD_VOLUME_CONFIG}/oidc.config.php -occ market:upgrade --major openidconnect # we need a release including https://github.com/owncloud/openidconnect/pull/180 +# we need at least version 2.1.0 of the oenidconnect app +occ market:upgrade --major openidconnect occ app:enable openidconnect # user LDAP From a28acc7222803ed7f7dc5e466e4cea67adb7f5bf Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Thu, 18 Nov 2021 13:31:38 +0545 Subject: [PATCH 5/6] Bump core commit id to include recent SetupHelper core changes --- .drone.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.env b/.drone.env index 10679b07a2..1de38e0813 100644 --- a/.drone.env +++ b/.drone.env @@ -1,5 +1,5 @@ # The test runner source for API tests -CORE_COMMITID=13d7bda4a6e64c816e3897980ec20b1812d17423 +CORE_COMMITID=6a55f750d8a3f34c6c7772355f9281ffb8ffb4ca CORE_BRANCH=master # The test runner source for UI tests From 1a76adccc55a4ac497264dbaf9d1be48cbf4fc8b Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Fri, 12 Nov 2021 10:41:31 +0545 Subject: [PATCH 6/6] Add test step about 'space contains for user' --- .../features/apiSpaces/uploadSpaces.feature | 11 ++++---- .../features/bootstrap/SpacesContext.php | 28 +++++++++++++++++++ 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/tests/acceptance/features/apiSpaces/uploadSpaces.feature b/tests/acceptance/features/apiSpaces/uploadSpaces.feature index 4a0da5ea3c..d524a5e1ff 100644 --- a/tests/acceptance/features/apiSpaces/uploadSpaces.feature +++ b/tests/acceptance/features/apiSpaces/uploadSpaces.feature @@ -16,7 +16,7 @@ Feature: Upload files into a space And user "Alice" lists all available spaces via the GraphApi And user "Alice" creates a folder "mainFolder" in space "Project Venus" using the WebDav Api Then the HTTP status code should be "201" - And the space "Project Venus" should contain these entries: + And for user "Alice" the space "Project Venus" should contain these entries: | mainFolder | Scenario: Bob creates a folder via the Graph api in a space, he expects a 404 code and Alice checks that this folder does not exist @@ -25,7 +25,7 @@ Feature: Upload files into a space And user "Alice" lists all available spaces via the GraphApi And user "Bob" creates a folder "forAlice" in space "Project Merkur" using the WebDav Api Then the HTTP status code should be "404" - And the space "Project Merkur" should not contain these entries: + And for user "Alice" the space "Project Merkur" should not contain these entries: | forAlice | Scenario: Alice creates a folder via Graph api and uploads a file @@ -36,7 +36,7 @@ Feature: Upload files into a space Then the HTTP status code should be "201" And user "Alice" uploads a file inside space "Project Moon" with content "Test" to "test.txt" using the WebDAV API Then the HTTP status code should be "201" - And the space "Project Moon" should contain these entries: + And for user "Alice" the space "Project Moon" should contain these entries: | NewFolder | | test.txt | @@ -46,7 +46,7 @@ Feature: Upload files into a space And user "Alice" lists all available spaces via the GraphApi And user "Bob" uploads a file inside space "Project Pluto" with content "Test" to "test.txt" using the WebDAV API Then the HTTP status code should be "404" - And the space "Project Pluto" should not contain these entries: + And for user "Alice" the space "Project Pluto" should not contain these entries: | test.txt | Scenario: Alice creates uploads a file and checks her quota @@ -61,8 +61,7 @@ Feature: Upload files into a space And user "Alice" lists all available spaces via the GraphApi And user "Alice" uploads a file inside space "Project Saturn" with content "Test" to "test.txt" using the WebDAV API Then the HTTP status code should be "201" - When user "Alice" lists the content of the space with the name "Project Saturn" using the WebDav Api - Then the propfind result of the space should contain these entries: + And for user "Alice" the space "Project Saturn" should contain these entries: | test.txt | And user "Alice" lists all available spaces via the GraphApi And the json responded should contain a space "Project Saturn" with these key and value pairs: diff --git a/tests/acceptance/features/bootstrap/SpacesContext.php b/tests/acceptance/features/bootstrap/SpacesContext.php index 1731d74ec1..aafa3871c0 100644 --- a/tests/acceptance/features/bootstrap/SpacesContext.php +++ b/tests/acceptance/features/bootstrap/SpacesContext.php @@ -584,6 +584,34 @@ class SpacesContext implements Context { ); } + /** + * @Then /^for user "([^"]*)" the space "([^"]*)" should (not|)\s?contain these (?:files|entries):$/ + * + * @param string $user + * @param string $spaceName + * @param string $shouldOrNot (not|) + * @param TableNode $expectedFiles + * + * @return void + * + * @throws Exception|GuzzleException + */ + public function usertheSpaceShouldContainEntries( + string $user, + string $spaceName, + string $shouldOrNot, + TableNode $expectedFiles + ):void { + $this->theUserListsTheContentOfAPersonalSpaceRootUsingTheWebDAvApi( + $user, + $spaceName + ); + $this->propfindResultShouldContainEntries( + $shouldOrNot, + $expectedFiles, + ); + } + /** * @Then /^the json responded should contain a space "([^"]*)" with these key and value pairs:$/ *