From 84fc1f4906e19a87fa2ab83a87d34fe7235fb774 Mon Sep 17 00:00:00 2001 From: Saw-jan Date: Fri, 2 Jan 2026 15:22:44 +0545 Subject: [PATCH 1/2] ci: enable sonarcloud Signed-off-by: Saw-jan --- .woodpecker.star | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/.woodpecker.star b/.woodpecker.star index 067af4db77..539e204e9b 100644 --- a/.woodpecker.star +++ b/.woodpecker.star @@ -21,7 +21,7 @@ PLUGINS_SLACK = "plugins/slack:1" POSTGRES_ALPINE = "postgres:alpine3.18" OPENLDAP = "bitnamilegacy/openldap:2.6" READY_RELEASE_GO = "woodpeckerci/plugin-ready-release-go:latest" - +SONARSOURCE_SONAR_SCANNER_CLI = "sonarsource/sonar-scanner-cli:12.0" WEB_PUBLISH_NPM_PACKAGES = ["babel-preset", "design-system", "eslint-config", "extension-sdk", "prettier-config", "tsconfig", "web-client", "web-pkg", "web-test-helpers"] WEB_PUBLISH_NPM_ORGANIZATION = "@opencloud-eu" CACHE_S3_SERVER = "https://s3.ci.opencloud.eu" @@ -481,17 +481,17 @@ def buildCacheWeb(ctx): }] def unitTests(ctx): - # sonar_env = { - # "SONAR_TOKEN": { - # "from_secret": "sonar_token", - # }, - # } - # if ctx.build.event == "pull_request": - # sonar_env.update({ - # "SONAR_PULL_REQUEST_BASE": "%s" % (ctx.build.target), - # "SONAR_PULL_REQUEST_BRANCH": "%s" % (ctx.build.source), - # "SONAR_PULL_REQUEST_KEY": "%s" % (ctx.build.ref.replace("refs/pull/", "").split("/")[0]), - # }) + sonar_env = { + "SONAR_TOKEN": { + "from_secret": "sonar_token", + }, + } + if ctx.build.event == "pull_request": + sonar_env.update({ + "SONAR_PULL_REQUEST_BASE": "%s" % (ctx.build.branch), + "SONAR_PULL_REQUEST_BRANCH": "%s" % (ctx.repo.branch), + "SONAR_PULL_REQUEST_KEY": "%s" % (ctx.build.ref.replace("refs/pull/", "").split("/")[0]), + }) return [{ "name": "unit-tests", @@ -503,14 +503,20 @@ def unitTests(ctx): "name": "unit-tests", "image": OC_CI_NODEJS, "commands": [ + "echo '%s'" % ctx.build.branch, + "echo '%s'" % ctx.repo.branch, + "echo '%s'" % ctx.build.ref, "pnpm test:unit --coverage", ], }, - # { - # "name": "sonarcloud", - # "image": SONARSOURCE_SONAR_SCANNER_CLI, - # "environment": sonar_env, - # }, + { + "name": "sonarcloud", + "image": SONARSOURCE_SONAR_SCANNER_CLI, + "environment": sonar_env, + "when": { + "event": "pull_request", + }, + }, ], "when": [ event["base"], From 494d70330b0c877494ea1d611015654d8ac49267 Mon Sep 17 00:00:00 2001 From: Saw-jan Date: Fri, 2 Jan 2026 15:36:01 +0545 Subject: [PATCH 2/2] check Signed-off-by: Saw-jan --- .woodpecker.star | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.woodpecker.star b/.woodpecker.star index 539e204e9b..d9fab29c3f 100644 --- a/.woodpecker.star +++ b/.woodpecker.star @@ -235,6 +235,7 @@ event = { } def main(ctx): + return unitTests(ctx) if ctx.build.event == "cron" and ctx.build.sender == "translation-sync": return translation_sync(ctx) is_release_pr = (ctx.build.event == "pull_request" and ctx.build.sender == "openclouders" and "🎉 release" in ctx.build.title.lower()) @@ -482,9 +483,9 @@ def buildCacheWeb(ctx): def unitTests(ctx): sonar_env = { - "SONAR_TOKEN": { - "from_secret": "sonar_token", - }, + # "SONAR_TOKEN": { + # "from_secret": "sonar_token", + # }, } if ctx.build.event == "pull_request": sonar_env.update({