diff --git a/.drone.star b/.drone.star index 741fa0db9..909dabfbc 100644 --- a/.drone.star +++ b/.drone.star @@ -16,7 +16,7 @@ config = { }, 'apiTests': { 'coreBranch': 'master', - 'coreCommit': '8ff1bda2f3c09500b92775c666c1b2236876edd3', + 'coreCommit': '26322d3bbedb5afe9a78ed5bcf88cfbf4ab2fd79', 'numberOfParts': 10 }, 'uiTests': { @@ -108,7 +108,6 @@ def getPipelineNames(pipelines=[]): names.append(pipeline['name']) return names - def main(ctx): """main is the entrypoint for drone @@ -118,9 +117,11 @@ def main(ctx): Returns: none """ + pipelines = [] before = \ + [ buildOcisBinaryForTesting(ctx) ] + \ testOcisModules(ctx) + \ testPipelines(ctx) @@ -135,6 +136,9 @@ def main(ctx): releaseSubmodule(ctx), ] + purge = purgeBuildArtifactCache(ctx, 'ocis-binary-amd64') + purge['depends_on'] = getPipelineNames(testPipelines(ctx)) + after = [ manifest(ctx), changelog(ctx), @@ -142,6 +146,7 @@ def main(ctx): badges(ctx), docs(ctx), updateDeployment(ctx), + purge, ] if ctx.build.event == "cron": @@ -151,7 +156,12 @@ def main(ctx): pipelines = before + [ notify_pipeline ] - elif '[docs-only]' in (ctx.build.title + ctx.build.message): + elif \ + (ctx.build.event == "pull" and '[docs-only]' in ctx.build.title) \ + or \ + (ctx.build.event != "pull" and '[docs-only]' in (ctx.build.title + ctx.build.message)): + # [docs-only] is not taken from PR messages, but from commit messages + docs_pipeline = docs(ctx) docs_pipeline['depends_on'] = [] docs_pipelines = [ docs_pipeline ] @@ -183,7 +193,6 @@ def testOcisModules(ctx): return pipelines + [coverage_upload] - def testPipelines(ctx): pipelines = [ localApiTests(ctx, config['apiTests']['coreBranch'], config['apiTests']['coreCommit'], 'owncloud', 'apiOcisSpecific'), @@ -201,7 +210,7 @@ def testPipelines(ctx): return pipelines def testOcisModule(ctx, module): - steps = generate(module) + [ + steps = makeGenerate(module) + [ { 'name': 'vet', 'image': 'webhippie/golang:1.14', @@ -308,6 +317,34 @@ def testOcisModule(ctx, module): ], } +def buildOcisBinaryForTesting(ctx): + return { + 'kind': 'pipeline', + 'type': 'docker', + 'name': 'build_ocis_binary_for_testing', + 'platform': { + 'os': 'linux', + 'arch': 'amd64', + }, + 'steps': + makeGenerate('ocis') + + build() + + rebuildBuildArtifactCache(ctx, 'ocis-binary-amd64', 'ocis/bin/ocis'), + 'trigger': { + 'ref': [ + 'refs/heads/master', + 'refs/tags/v*', + 'refs/pull/**', + ], + }, + 'volumes': [ + { + 'name': 'gopath', + 'temp': {}, + }, + ], + } + def uploadCoverage(ctx): return { 'kind': 'pipeline', @@ -386,8 +423,7 @@ def localApiTests(ctx, coreBranch = 'master', coreCommit = '', storage = 'ownclo 'arch': 'amd64', }, 'steps': - generate('ocis') + - build() + + restoreBuildArtifactCache(ctx, 'ocis-binary-amd64', 'ocis/bin/ocis') + ocisServer(storage, accounts_hash_difficulty) + cloneCoreRepos(coreBranch, coreCommit) + [ { @@ -422,6 +458,7 @@ def localApiTests(ctx, coreBranch = 'master', coreCommit = '', storage = 'ownclo 'temp': {}, }, ], + 'depends_on': getPipelineNames([buildOcisBinaryForTesting(ctx)]), 'trigger': { 'ref': [ 'refs/heads/master', @@ -441,8 +478,7 @@ def coreApiTests(ctx, coreBranch = 'master', coreCommit = '', part_number = 1, n 'arch': 'amd64', }, 'steps': - generate('ocis') + - build() + + restoreBuildArtifactCache(ctx, 'ocis-binary-amd64', 'ocis/bin/ocis') + ocisServer(storage, accounts_hash_difficulty) + cloneCoreRepos(coreBranch, coreCommit) + [ { @@ -478,6 +514,7 @@ def coreApiTests(ctx, coreBranch = 'master', coreCommit = '', part_number = 1, n 'temp': {}, }, ], + 'depends_on': getPipelineNames([buildOcisBinaryForTesting(ctx)]), 'trigger': { 'ref': [ 'refs/heads/master', @@ -510,8 +547,7 @@ def uiTestPipeline(ctx, suiteName, phoenixBranch = 'master', phoenixCommit = '', 'arch': 'amd64', }, 'steps': - generate('ocis') + - build() + + restoreBuildArtifactCache(ctx, 'ocis-binary-amd64', 'ocis/bin/ocis') + ocisServer(storage, accounts_hash_difficulty) + [ { 'name': 'webUITests', @@ -563,6 +599,7 @@ def uiTestPipeline(ctx, suiteName, phoenixBranch = 'master', phoenixCommit = '', 'temp': {} } ], + 'depends_on': getPipelineNames([buildOcisBinaryForTesting(ctx)]), 'trigger': { 'ref': [ 'refs/heads/master', @@ -582,8 +619,7 @@ def accountsUITests(ctx, phoenixBranch, phoenixCommit, storage = 'owncloud', acc 'arch': 'amd64', }, 'steps': - generate('ocis') + - build() + + restoreBuildArtifactCache(ctx, 'ocis-binary-amd64', 'ocis/bin/ocis') + ocisServer(storage, accounts_hash_difficulty) + [ { 'name': 'WebUIAcceptanceTests', @@ -656,6 +692,7 @@ def accountsUITests(ctx, phoenixBranch, phoenixCommit, storage = 'owncloud', acc 'temp': {} } ], + 'depends_on': getPipelineNames([buildOcisBinaryForTesting(ctx)]), 'trigger': { 'ref': [ 'refs/heads/master', @@ -675,7 +712,7 @@ def docker(ctx, arch): 'arch': arch, }, 'steps': - generate('ocis') + + makeGenerate('ocis') + build() + [ { 'name': 'dryrun', @@ -748,7 +785,7 @@ def dockerEos(ctx): 'arch': 'amd64', }, 'steps': - generate('ocis') + + makeGenerate('ocis') + build() + [ { 'name': 'dryrun-eos-ocis', @@ -859,7 +896,7 @@ def binary(ctx, name): 'arch': 'amd64', }, 'steps': - generate('ocis') + [ + makeGenerate('ocis') + [ { 'name': 'build', 'image': 'webhippie/golang:1.14', @@ -1313,7 +1350,7 @@ def docs(ctx): }, } -def generate(module): +def makeGenerate(module): return [ { 'name': 'generate', @@ -1449,6 +1486,7 @@ def ocisServer(storage, accounts_hash_difficulty = 4): 'KONNECTD_IDENTIFIER_REGISTRATION_CONF': '/drone/src/tests/config/drone/identifier-registration.yml', 'KONNECTD_ISS': 'https://ocis-server:9200', 'KONNECTD_TLS': 'true', + 'OCIS_LOG_LEVEL': 'warn', } # Pass in "default" accounts_hash_difficulty to not set this environment variable. @@ -1542,3 +1580,95 @@ def build(): ], }, ] + +def genericCache(name, action, mounts, cache_key): + rebuild = 'false' + restore = 'false' + if action == 'rebuild': + rebuild = 'true' + action = 'rebuild' + else: + restore = 'true' + action = 'restore' + + step = { + 'name': '%s_%s' %(action, name), + 'image': 'meltwater/drone-cache:v1', + 'pull': 'always', + 'environment': { + 'AWS_ACCESS_KEY_ID': { + 'from_secret': 'cache_s3_access_key', + }, + 'AWS_SECRET_ACCESS_KEY': { + 'from_secret': 'cache_s3_secret_key', + }, + }, + 'settings': { + 'endpoint': { + 'from_secret': 'cache_s3_endpoint' + }, + 'bucket': 'cache', + 'region': 'us-east-1', # not used at all, but failes if not given! + 'path_style': 'true', + 'cache_key': cache_key, + 'rebuild': rebuild, + 'restore': restore, + 'mount': mounts, + }, + } + return step + +def genericCachePurge(ctx, name, cache_key): + return { + 'kind': 'pipeline', + 'type': 'docker', + 'name': 'purge_%s' %(name), + 'platform': { + 'os': 'linux', + 'arch': 'amd64', + }, + 'steps': [ + { + 'name': 'purge-cache', + 'image': 'minio/mc', + 'failure': 'ignore', + 'environment': { + 'MC_HOST_cache': { + 'from_secret': 'cache_s3_connection_url' + } + }, + 'commands': [ + 'mc rm --recursive --force cache/cache/%s/%s' % (ctx.repo.name, cache_key), + ] + }, + ], + 'trigger': { + 'ref': [ + 'refs/heads/master', + 'refs/tags/v*', + 'refs/pull/**', + ], + 'status': [ + 'success', + 'failure', + ] + }, + } + +def genericBuildArtifactCache(ctx, name, action, path): + name = '%s_build_artifact_cache' %(name) + cache_key = '%s/%s/%s' % (ctx.repo.slug, ctx.build.commit + '-${DRONE_BUILD_NUMBER}', name) + if action == "rebuild" or action == "restore": + return genericCache(name, action, [path], cache_key) + if action == "purge": + return genericCachePurge(ctx, name, cache_key) + return [] + +def restoreBuildArtifactCache(ctx, name, path): + return [genericBuildArtifactCache(ctx, name, 'restore', path)] + +def rebuildBuildArtifactCache(ctx, name, path): + return [genericBuildArtifactCache(ctx, name, 'rebuild', path)] + +def purgeBuildArtifactCache(ctx, name): + return genericBuildArtifactCache(ctx, name, 'purge', []) diff --git a/tests/acceptance/expected-failures-on-OCIS-storage.txt b/tests/acceptance/expected-failures-on-OCIS-storage.txt index cbc0b32ff..a3c7edef8 100644 --- a/tests/acceptance/expected-failures-on-OCIS-storage.txt +++ b/tests/acceptance/expected-failures-on-OCIS-storage.txt @@ -2490,3 +2490,13 @@ apiWebdavUploadTUS/uploadFileMtimeShares.feature:56 # https://github.com/owncloud/ocis/issues/763 [OCIS-storage] reading a file that a collaborator uploaded is impossible apiWebdavUploadTUS/uploadFileMtimeShares.feature:70 apiWebdavUploadTUS/uploadFileMtimeShares.feature:71 + +# https://github.com/owncloud/ocis/issues/968 [ocis-storage] PROPFIND on a file uploaded by share receiver is not possible +apiWebdavUploadTUS/uploadToShare.feature:23 +apiWebdavUploadTUS/uploadToShare.feature:24 +apiWebdavUploadTUS/uploadToShare.feature:37 +apiWebdavUploadTUS/uploadToShare.feature:38 + +# https://github.com/owncloud/product/issues/293 sharing with group not available +apiWebdavUploadTUS/uploadToShare.feature:52 +apiWebdavUploadTUS/uploadToShare.feature:53 diff --git a/tests/acceptance/expected-failures-on-OWNCLOUD-storage.txt b/tests/acceptance/expected-failures-on-OWNCLOUD-storage.txt index 40fdba8ce..3118131ec 100644 --- a/tests/acceptance/expected-failures-on-OWNCLOUD-storage.txt +++ b/tests/acceptance/expected-failures-on-OWNCLOUD-storage.txt @@ -1402,6 +1402,11 @@ apiWebdavUpload2/uploadFileUsingOldChunking.feature:98 apiWebdavUpload2/uploadFileUsingOldChunking.feature:99 apiWebdavUpload2/uploadFileUsingOldChunking.feature:100 # +# https://github.com/owncloud/product/issues/293 sharing with group not available +# +apiWebdavUploadTUS/uploadToShare.feature:52 +apiWebdavUploadTUS/uploadToShare.feature:53 +# # https://github.com/owncloud/ocis-reva/issues/243 Sharing does not work # apiShareManagementBasicToShares/createShareToSharesFolder.feature:529