Compare commits

...
Author SHA1 Message Date
Michael Barz 49bb35857c Automated changelog update [skip ci] 2023-07-07 13:16:53 +00:00
Michael Barz c8bf3441c1 Merge pull request #6745 from owncloud/fix-ci-education
[CI] [tests-only] Backport CI secrets change
2023-07-07 14:55:06 +02:00
Michael Barz e31c2aee42 use mc alias for coverage cache 2023-07-07 14:18:01 +02:00
Phil Davis d5d0cad644 Backport CI secrets change 2023-07-07 14:01:30 +02:00
Michael Barz a9343a1ce7 fix education-* trigger 2023-07-05 19:21:10 +02:00
Michael Barz 25d69fb2a6 Merge pull request #6701 from owncloud/fix-oidc-role-assignment
[full-ci] [Backport] Fix OIDC role assignment
2023-07-03 17:30:14 +02:00
jkoberg b3e9ef8120 change assign roles logic
Signed-off-by: jkoberg <jkoberg@owncloud.com>
2023-07-03 15:06:58 +02:00
jkoberg c5a085309b do not return an error when detecting too many roles
Signed-off-by: jkoberg <jkoberg@owncloud.com>
2023-07-03 15:06:38 +02:00
Michael Barz 5cf1c6d217 refactor test dependencies 2023-07-03 14:45:10 +02:00
Michael Barz 23b6424d01 fix ci for stable 3.0, starlark too long 2023-07-03 14:44:49 +02:00
Michael Barz 0ffe903931 education-3.1
Signed-off-by: Michael Barz <mbarz@owncloud.com>
2023-07-03 14:44:28 +02:00
Michael Barz c50260b854 fix ci for stable 3.0 2023-07-03 14:42:20 +02:00
4 changed files with 65 additions and 136 deletions

No files matched your search

+45 -132
View File
@@ -4,14 +4,12 @@
# images
ALPINE_GIT = "alpine/git:latest"
CHKO_DOCKER_PUSHRM = "chko/docker-pushrm:1"
DRONE_CLI = "drone/cli:alpine"
INBUCKET_INBUCKET = "inbucket/inbucket"
MINIO_MC = "minio/mc:RELEASE.2021-10-07T04-19-58Z"
OC_CI_ALPINE = "owncloudci/alpine:latest"
OC_CI_BAZEL_BUILDIFIER = "owncloudci/bazel-buildifier:latest"
OC_CI_CLAMAVD = "owncloudci/clamavd"
OC_CI_DRONE_ANSIBLE = "owncloudci/drone-ansible:latest"
OC_CI_DRONE_CANCEL_PREVIOUS_BUILDS = "owncloudci/drone-cancel-previous-builds"
OC_CI_DRONE_SKIP_PIPELINE = "owncloudci/drone-skip-pipeline"
OC_CI_GOLANG = "owncloudci/golang:1.20"
OC_CI_NODEJS = "owncloudci/nodejs:%s"
@@ -23,7 +21,6 @@ OC_OC_TEST_MIDDLEWARE = "owncloud/owncloud-test-middleware:1.8.5"
OC_UBUNTU = "owncloud/ubuntu:20.04"
PLUGINS_CODACY = "plugins/codacy:1"
PLUGINS_DOCKER = "plugins/docker:latest"
PLUGINS_DOWNSTREAM = "plugins/downstream:latest"
PLUGINS_GH_PAGES = "plugins/gh-pages:1"
PLUGINS_GITHUB_RELEASE = "plugins/github-release:1"
PLUGINS_GIT_ACTION = "plugins/git-action:1"
@@ -169,7 +166,7 @@ config = {
},
"rocketchat": {
"channel": "ocis-internal",
"from_secret": "private_rocketchat",
"from_secret": "rocketchat_chat_webhook",
},
"binaryReleases": {
"os": ["linux", "darwin"],
@@ -216,10 +213,10 @@ stepVolumeClamav = \
# minio mc environment variables
MINIO_MC_ENV = {
"CACHE_BUCKET": {
"from_secret": "cache_public_s3_bucket",
"from_secret": "cache_s3_bucket",
},
"MC_HOST": {
"from_secret": "cache_s3_endpoint",
"from_secret": "cache_s3_server",
},
"AWS_ACCESS_KEY_ID": {
"from_secret": "cache_s3_access_key",
@@ -270,7 +267,6 @@ def main(ctx):
pipelines = []
test_pipelines = \
cancelPreviousBuilds() + \
codestyle(ctx) + \
buildWebCache(ctx) + \
getGoBinForTesting(ctx) + \
@@ -307,7 +303,7 @@ def main(ctx):
pipelines + \
pipelinesDependsOn(
example_deploys(ctx),
pipelines,
[purgeBuildArtifactCache(ctx)],
)
# always append notification step
@@ -333,7 +329,7 @@ def cachePipeline(name, steps):
"steps": steps,
"trigger": {
"ref": [
"refs/heads/master",
"refs/heads/education-*",
"refs/tags/**",
"refs/pull/**",
],
@@ -356,30 +352,6 @@ def testOcisModules(ctx):
return pipelines + [scan_result_upload]
def cancelPreviousBuilds():
return [{
"kind": "pipeline",
"type": "docker",
"name": "cancel-previous-builds",
"clone": {
"disable": True,
},
"steps": [{
"name": "cancel-previous-builds",
"image": OC_CI_DRONE_CANCEL_PREVIOUS_BUILDS,
"settings": {
"DRONE_TOKEN": {
"from_secret": "drone_token",
},
},
}],
"trigger": {
"ref": [
"refs/pull/**",
],
},
}]
def testPipelines(ctx):
pipelines = []
@@ -418,8 +390,7 @@ def getGoBinForTesting(ctx):
cacheGoBin(),
"trigger": {
"ref": [
"refs/heads/master",
"refs/heads/stable-*",
"refs/heads/education-*",
"refs/pull/**",
],
},
@@ -432,10 +403,10 @@ def checkGoBinCache():
"image": OC_UBUNTU,
"environment": {
"CACHE_ENDPOINT": {
"from_secret": "cache_public_s3_server",
"from_secret": "cache_s3_server",
},
"CACHE_BUCKET": {
"from_secret": "cache_public_s3_bucket",
"from_secret": "cache_s3_bucket",
},
},
"commands": [
@@ -535,7 +506,7 @@ def testOcisModule(ctx, module):
"image": PLUGINS_S3,
"settings": {
"endpoint": {
"from_secret": "cache_s3_endpoint",
"from_secret": "cache_s3_server",
},
"bucket": "cache",
"source": "cache/**/*",
@@ -562,7 +533,7 @@ def testOcisModule(ctx, module):
"steps": steps,
"trigger": {
"ref": [
"refs/heads/master",
"refs/heads/education-*",
"refs/tags/%s/v*" % (module),
"refs/pull/**",
],
@@ -587,7 +558,7 @@ def buildOcisBinaryForTesting(ctx):
rebuildBuildArtifactCache(ctx, "ocis-binary-amd64", "ocis/bin"),
"trigger": {
"ref": [
"refs/heads/master",
"refs/heads/education-*",
"refs/pull/**",
],
},
@@ -642,14 +613,11 @@ def uploadScanResults(ctx):
{
"name": "sync-from-cache",
"image": MINIO_MC,
"environment": {
"MC_HOST_cachebucket": {
"from_secret": "cache_s3_connection_url",
},
},
"environment": MINIO_MC_ENV,
"commands": [
"mkdir -p cache",
"mc mirror cachebucket/cache/%s/%s/cache cache/" % (ctx.repo.slug, ctx.build.commit + "-${DRONE_BUILD_NUMBER}"),
"mc alias set cachebucket $MC_HOST $AWS_ACCESS_KEY_ID $AWS_SECRET_ACCESS_KEY",
"mc mirror cachebucket/$CACHE_BUCKET/%s/%s/cache cache/" % (ctx.repo.slug, ctx.build.commit + "-${DRONE_BUILD_NUMBER}"),
],
},
{
@@ -669,19 +637,16 @@ def uploadScanResults(ctx):
{
"name": "purge-cache",
"image": MINIO_MC,
"environment": {
"MC_HOST_cachebucket": {
"from_secret": "cache_s3_connection_url",
},
},
"environment": MINIO_MC_ENV,
"commands": [
"mc rm --recursive --force cachebucket/cache/%s/%s/cache" % (ctx.repo.slug, ctx.build.commit + "-${DRONE_BUILD_NUMBER}"),
"mc alias set cachebucket $MC_HOST $AWS_ACCESS_KEY_ID $AWS_SECRET_ACCESS_KEY",
"mc rm --recursive --force cachebucket/$CACHE_BUCKET/%s/%s/cache" % (ctx.repo.slug, ctx.build.commit + "-${DRONE_BUILD_NUMBER}"),
],
},
],
"trigger": {
"ref": [
"refs/heads/master",
"refs/heads/education-*",
"refs/pull/**",
],
},
@@ -770,7 +735,7 @@ def codestyle(ctx):
"depends_on": [],
"trigger": {
"ref": [
"refs/heads/master",
"refs/heads/education-*",
"refs/pull/**",
"refs/tags/**",
],
@@ -825,7 +790,7 @@ def localApiTestPipeline(ctx):
"depends_on": getPipelineNames([buildOcisBinaryForTesting(ctx)]),
"trigger": {
"ref": [
"refs/heads/master",
"refs/heads/education-*",
"refs/pull/**",
],
},
@@ -891,7 +856,7 @@ def cs3ApiTests(ctx, storage, accounts_hash_difficulty = 4):
"depends_on": getPipelineNames([buildOcisBinaryForTesting(ctx)]),
"trigger": {
"ref": [
"refs/heads/master",
"refs/heads/education-*",
"refs/pull/**",
],
},
@@ -994,7 +959,7 @@ def wopiValidatorTests(ctx, storage, accounts_hash_difficulty = 4):
"depends_on": getPipelineNames([buildOcisBinaryForTesting(ctx)]),
"trigger": {
"ref": [
"refs/heads/master",
"refs/heads/education-*",
"refs/pull/**",
],
},
@@ -1044,7 +1009,7 @@ def coreApiTests(ctx, part_number = 1, number_of_parts = 1, storage = "ocis", ac
"depends_on": getPipelineNames([buildOcisBinaryForTesting(ctx)]),
"trigger": {
"ref": [
"refs/heads/master",
"refs/heads/education-*",
"refs/pull/**",
],
},
@@ -1162,7 +1127,7 @@ def uiTestPipeline(ctx, filterTags, early_fail, runPart = 1, numberOfParts = 1,
"depends_on": getPipelineNames([buildOcisBinaryForTesting(ctx)] + buildWebCache(ctx)),
"trigger": {
"ref": [
"refs/heads/master",
"refs/heads/education-*",
"refs/pull/**",
],
},
@@ -1171,7 +1136,7 @@ def uiTestPipeline(ctx, filterTags, early_fail, runPart = 1, numberOfParts = 1,
def e2eTests(ctx):
e2e_trigger = {
"ref": [
"refs/heads/master",
"refs/heads/education-*",
"refs/tags/**",
"refs/pull/**",
],
@@ -1283,10 +1248,10 @@ def buildTracingComment():
],
"environment": {
"CACHE_ENDPOINT": {
"from_secret": "cache_public_s3_server",
"from_secret": "cache_s3_server",
},
"CACHE_BUCKET": {
"from_secret": "cache_public_s3_bucket",
"from_secret": "cache_s3_bucket",
},
},
"when": {
@@ -1363,30 +1328,6 @@ def failEarly(ctx, early_fail):
],
},
},
{
"name": "stop-build",
"image": DRONE_CLI,
# # https://github.com/drone/runner-go/blob/0bd0f8fc31c489817572060d17c6e24aaa487470/pipeline/runtime/const.go#L95-L102
# "failure": "fail-fast",
# would be an alternative, but is currently broken
"environment": {
"DRONE_SERVER": "https://drone.owncloud.com",
"DRONE_TOKEN": {
"from_secret": "drone_token",
},
},
"commands": [
"drone build stop owncloud/ocis ${DRONE_BUILD_NUMBER}",
],
"when": {
"status": [
"failure",
],
"event": [
"pull_request",
],
},
},
]
return []
@@ -1411,7 +1352,7 @@ def dockerRelease(ctx, arch):
"REVISION=%s" % (ctx.build.commit),
"VERSION=%s" % (ctx.build.ref.replace("refs/tags/", "") if ctx.build.event == "tag" else "latest"),
]
depends_on = getPipelineNames(testOcisModules(ctx) + testPipelines(ctx))
depends_on = getPipelineNames([purgeBuildArtifactCache(ctx)])
if ctx.build.event == "tag":
depends_on = []
@@ -1482,7 +1423,6 @@ def dockerRelease(ctx, arch):
"depends_on": depends_on,
"trigger": {
"ref": [
"refs/heads/master",
"refs/tags/v*",
"refs/pull/**",
],
@@ -1500,7 +1440,7 @@ def binaryReleases(ctx):
def binaryRelease(ctx, name):
# uploads binary to https://download.owncloud.com/ocis/ocis/daily/
target = "/ocis/%s/daily" % (ctx.repo.name.replace("ocis-", ""))
depends_on = getPipelineNames(testOcisModules(ctx) + testPipelines(ctx))
depends_on = getPipelineNames([purgeBuildArtifactCache(ctx)])
if ctx.build.event == "tag":
# uploads binary to eg. https://download.owncloud.com/ocis/ocis/1.0.0-beta9/
folder = "stable"
@@ -1513,16 +1453,16 @@ def binaryRelease(ctx, name):
settings = {
"endpoint": {
"from_secret": "s3_endpoint",
"from_secret": "upload_s3_endpoint",
},
"access_key": {
"from_secret": "aws_access_key_id",
"from_secret": "upload_s3_access_key",
},
"secret_key": {
"from_secret": "aws_secret_access_key",
"from_secret": "upload_s3_secret_key",
},
"bucket": {
"from_secret": "s3_bucket",
"from_secret": "upload_s3_bucket",
},
"path_style": True,
"strip_prefix": "ocis/dist/release/",
@@ -1557,7 +1497,6 @@ def binaryRelease(ctx, name):
],
"when": {
"ref": [
"refs/heads/master",
"refs/tags/v*",
],
},
@@ -1568,7 +1507,6 @@ def binaryRelease(ctx, name):
"settings": settings,
"when": {
"ref": [
"refs/heads/master",
"refs/tags/v*",
],
},
@@ -1610,7 +1548,6 @@ def binaryRelease(ctx, name):
"depends_on": depends_on,
"trigger": {
"ref": [
"refs/heads/master",
"refs/tags/v*",
"refs/pull/**",
],
@@ -1700,7 +1637,6 @@ def licenseCheck(ctx):
"settings": settings,
"when": {
"ref": [
"refs/heads/master",
"refs/tags/v*",
],
},
@@ -1741,7 +1677,7 @@ def licenseCheck(ctx):
],
"trigger": {
"ref": [
"refs/heads/master",
"refs/heads/education-*",
"refs/tags/v*",
"refs/pull/**",
],
@@ -1820,7 +1756,6 @@ def releaseDockerManifest():
],
"trigger": {
"ref": [
"refs/heads/master",
"refs/tags/v*",
],
},
@@ -1866,7 +1801,7 @@ def changelog():
"push",
],
"message": "Automated changelog update [skip ci]",
"branch": "master",
"branch": "education-3.1",
"author_email": "devops@owncloud.com",
"author_name": "ownClouders",
"netrc_machine": "github.com",
@@ -1888,7 +1823,7 @@ def changelog():
],
"trigger": {
"ref": [
"refs/heads/master",
"refs/heads/education-*",
"refs/pull/**",
],
},
@@ -1922,7 +1857,6 @@ def releaseDockerReadme(ctx):
],
"trigger": {
"ref": [
"refs/heads/master",
"refs/tags/v*",
],
},
@@ -1969,7 +1903,7 @@ def docs():
},
"pages_directory": "docs/hugo/content/",
"copy_contents": "true",
"target_branch": "docs",
"target_branch": "docs-education-3.1",
"delete": "true",
},
"when": {
@@ -1988,30 +1922,10 @@ def docs():
"rm -rf docs/hugo",
],
},
{
"name": "downstream",
"image": PLUGINS_DOWNSTREAM,
"settings": {
"server": "https://drone.owncloud.com/",
"token": {
"from_secret": "drone_token",
},
"repositories": [
"owncloud/owncloud.github.io@main",
],
},
"when": {
"ref": {
"exclude": [
"refs/pull/**",
],
},
},
},
],
"trigger": {
"ref": [
"refs/heads/master",
"refs/heads/education-*",
"refs/pull/**",
],
},
@@ -2084,7 +1998,7 @@ def notify():
"depends_on": [],
"trigger": {
"ref": [
"refs/heads/master",
"refs/heads/education-*",
"refs/heads/release*",
"refs/tags/**",
],
@@ -2414,7 +2328,6 @@ def deploy(ctx, config, rebuild):
],
"trigger": {
"ref": [
"refs/heads/master",
"refs/tags/v*",
],
},
@@ -2470,7 +2383,7 @@ def genericCache(name, action, mounts, cache_path):
"image": PLUGINS_S3_CACHE,
"settings": {
"endpoint": {
"from_secret": "cache_s3_endpoint",
"from_secret": "cache_s3_server",
},
"rebuild": rebuild,
"restore": restore,
@@ -2509,7 +2422,7 @@ def genericCachePurge(flush_path):
"from_secret": "cache_s3_secret_key",
},
"endpoint": {
"from_secret": "cache_s3_endpoint",
"from_secret": "cache_s3_server",
},
"flush": True,
"flush_age": 1,
@@ -2519,7 +2432,7 @@ def genericCachePurge(flush_path):
],
"trigger": {
"ref": [
"refs/heads/master",
"refs/heads/education-*",
"refs/pull/**",
],
"status": [
@@ -2771,7 +2684,7 @@ def litmus(ctx, storage):
"depends_on": getPipelineNames([buildOcisBinaryForTesting(ctx)]),
"trigger": {
"ref": [
"refs/heads/master",
"refs/heads/education-*",
"refs/pull/**",
],
},
@@ -2812,10 +2725,10 @@ def checkForWebCache(name):
"image": OC_UBUNTU,
"environment": {
"CACHE_ENDPOINT": {
"from_secret": "cache_public_s3_server",
"from_secret": "cache_s3_server",
},
"CACHE_BUCKET": {
"from_secret": "cache_public_s3_bucket",
"from_secret": "cache_s3_bucket",
},
},
"commands": [
+10
View File
@@ -8,6 +8,7 @@ The following sections list the changes for unreleased.
* Bugfix - Add missing timestamps: [#6515](https://github.com/owncloud/ocis/pull/6515)
* Bugfix - Handle the bad request status: [#6469](https://github.com/owncloud/ocis/pull/6469)
* Bugfix - Fix the oidc role assigner: [#6605](https://github.com/owncloud/ocis/pull/6605)
* Enhancement - Add permissions to report: [#6528](https://github.com/owncloud/ocis/pull/6528)
* Enhancement - Add more metadata to the remote item: [#6300](https://github.com/owncloud/ocis/pull/6300)
* Enhancement - Make the app provider service name configurable: [#6482](https://github.com/owncloud/ocis/pull/6482)
@@ -41,6 +42,15 @@ The following sections list the changes for unreleased.
https://github.com/owncloud/ocis/pull/6469
https://github.com/cs3org/reva/pull/3948
* Bugfix - Fix the oidc role assigner: [#6605](https://github.com/owncloud/ocis/pull/6605)
The update role method did not allow to set a role when the user already has two roles. This makes
no sense as the user is supposed to have only one and the update will fix that. We still log an error
level log to make the admin aware of that.
https://github.com/owncloud/ocis/pull/6605
https://github.com/owncloud/ocis/pull/6618
* Enhancement - Add permissions to report: [#6528](https://github.com/owncloud/ocis/pull/6528)
The webdav REPORT endpoint only returned permissions for personal spaces and shares. Now also
@@ -0,0 +1,8 @@
Bugfix: Fix the oidc role assigner
The update role method did not allow to set a role when the user already has two roles.
This makes no sense as the user is supposed to have only one and the update will fix that.
We still log an error level log to make the admin aware of that.
https://github.com/owncloud/ocis/pull/6605
https://github.com/owncloud/ocis/pull/6618
+2 -4
View File
@@ -89,13 +89,11 @@ func (ra oidcRoleAssigner) UpdateUserRoleAssignment(ctx context.Context, user *c
return nil, err
}
if len(assignedRoles) > 1 {
err := errors.New("too many roles assigned")
logger.Error().Err(err).Msg("The user has too many roles assigned")
return nil, err
logger.Error().Str("userID", user.GetId().GetOpaqueId()).Int("numRoles", len(assignedRoles)).Msg("The user has too many roles assigned")
}
logger.Debug().Interface("assignedRoleIds", assignedRoles).Msg("Currently assigned roles")
if len(assignedRoles) == 0 || (assignedRoles[0] != roleIDFromClaim) {
if len(assignedRoles) != 1 || (assignedRoles[0] != roleIDFromClaim) {
logger.Debug().Interface("assignedRoleIds", assignedRoles).Interface("newRoleId", roleIDFromClaim).Msg("Updating role assignment for user")
newctx, err := ra.prepareAdminContext()
if err != nil {