Skip to content

Commit

Permalink
Merge branch 'master' into release-0.7.2
Browse files Browse the repository at this point in the history
for #595
  • Loading branch information
jnweiger committed Aug 11, 2023
2 parents e884d47 + 2150bb7 commit 55d4743
Show file tree
Hide file tree
Showing 3 changed files with 460 additions and 527 deletions.
133 changes: 26 additions & 107 deletions .drone.star
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
BANST_AWS_CLI = "banst/awscli"
DRONE_CLI = "drone/cli:alpine"
INBUCKET_INBUCKET = "inbucket/inbucket"
MINIO_MC = "minio/mc:RELEASE.2020-12-18T10-53-53Z"
OC_CI_ALPINE = "owncloudci/alpine:latest"
OC_CI_BAZEL_BUILDIFIER = "owncloudci/bazel-buildifier"
OC_CI_CEPH = "owncloudci/ceph:tag-build-master-jewel-ubuntu-16.04"
OC_CI_CORE = "owncloudci/core"
OC_CI_DRONE_CANCEL_PREVIOUS_BUILDS = "owncloudci/drone-cancel-previous-builds"
OC_CI_DRONE_SKIP_PIPELINE = "owncloudci/drone-skip-pipeline"
OC_CI_NODEJS = "owncloudci/nodejs:%s"
OC_CI_ORACLE_XE = "owncloudci/oracle-xe:latest"
Expand All @@ -23,11 +21,26 @@ PLUGINS_SLACK = "plugins/slack:1"
SELENIUM_STANDALONE_CHROME_DEBUG = "selenium/standalone-chrome-debug:3.141.59-oxygen"
SELENIUM_STANDALONE_FIREFOX_DEBUG = "selenium/standalone-firefox-debug:3.8.1"
SONARSOURCE_SONAR_SCANNER_CLI = "sonarsource/sonar-scanner-cli"
THEGEEKLAB_DRONE_GITHUB_COMMENT = "thegeeklab/drone-github-comment:1"

DEFAULT_PHP_VERSION = "7.4"
DEFAULT_NODEJS_VERSION = "14"

# minio mc environment variables
MINIO_MC_ENV = {
"CACHE_BUCKET": {
"from_secret": "cache_s3_bucket",
},
"MC_HOST": {
"from_secret": "cache_s3_server",
},
"AWS_ACCESS_KEY_ID": {
"from_secret": "cache_s3_access_key",
},
"AWS_SECRET_ACCESS_KEY": {
"from_secret": "cache_s3_secret_key",
},
}

dir = {
"base": "/var/www/owncloud",
"federated": "/var/www/owncloud/federated",
Expand All @@ -40,7 +53,7 @@ dir = {
config = {
"rocketchat": {
"channel": "builds",
"from_secret": "private_rocketchat",
"from_secret": "rocketchat_chat_webhook",
},
"branches": [
"master",
Expand Down Expand Up @@ -94,7 +107,7 @@ def main(ctx):
return before + coverageTests + afterCoverageTests + nonCoverageTests + stages + after

def beforePipelines(ctx):
return validateDailyTarballBuild() + codestyle(ctx) + jscodestyle(ctx) + cancelPreviousBuilds() + phpstan(ctx) + phan(ctx) + phplint(ctx) + checkStarlark()
return validateDailyTarballBuild() + codestyle(ctx) + jscodestyle(ctx) + phpstan(ctx) + phan(ctx) + phplint(ctx) + checkStarlark()

def coveragePipelines(ctx):
# All unit test pipelines that have coverage or other test analysis reported
Expand Down Expand Up @@ -248,31 +261,6 @@ def jscodestyle(ctx):

return pipelines

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",
},
},
}],
"depends_on": [],
"trigger": {
"ref": [
"refs/pull/**",
],
},
}]

def phpstan(ctx):
pipelines = []

Expand Down Expand Up @@ -596,7 +584,7 @@ def javascript(ctx, withCoverage):
"image": PLUGINS_S3,
"settings": {
"endpoint": {
"from_secret": "cache_s3_endpoint",
"from_secret": "cache_s3_server",
},
"bucket": "cache",
"source": "./coverage/lcov.info",
Expand Down Expand Up @@ -824,7 +812,7 @@ def phpTests(ctx, testType, withCoverage):
"image": PLUGINS_S3,
"settings": {
"endpoint": {
"from_secret": "cache_s3_endpoint",
"from_secret": "cache_s3_server",
},
"bucket": "cache",
"source": "tests/output/clover-%s.xml" % (name),
Expand Down Expand Up @@ -895,7 +883,6 @@ def acceptance(ctx):
"skip": False,
"debugSuites": [],
"skipExceptParts": [],
"earlyFail": True,
"enableApp": True,
"selUserNeeded": False,
}
Expand Down Expand Up @@ -933,14 +920,6 @@ def acceptance(ctx):
if params["skip"]:
continue

# switch off earlyFail if the PR title contains full-ci
if ("full-ci" in ctx.build.title.lower()):
params["earlyFail"] = False

# switch off earlyFail when running cron builds (for example, nightly CI)
if (ctx.build.event == "cron"):
params["earlyFail"] = False

if "externalScality" in params and len(params["externalScality"]) != 0:
# We want to use an external scality server for this pipeline.
# That uses some "standard" extraSetup and extraTeardown.
Expand Down Expand Up @@ -1152,7 +1131,7 @@ def acceptance(ctx):
"path": "%s/downloads" % dir["server"],
}],
}),
] + testConfig["extraTeardown"] + githubComment(params["earlyFail"]) + stopBuild(ctx, params["earlyFail"]),
] + testConfig["extraTeardown"],
"services": databaseService(testConfig["database"]) +
browserService(testConfig["browser"]) +
emailService(testConfig["emailNeeded"]) +
Expand Down Expand Up @@ -1237,13 +1216,10 @@ def sonarAnalysis(ctx, phpVersion = DEFAULT_PHP_VERSION):
{
"name": "sync-from-cache",
"image": MINIO_MC,
"environment": {
"MC_HOST_cache": {
"from_secret": "cache_s3_connection_url",
},
},
"environment": MINIO_MC_ENV,
"commands": [
"mkdir -p results",
"mc alias set cache $MC_HOST $AWS_ACCESS_KEY_ID $AWS_SECRET_ACCESS_KEY",
"mc mirror cache/cache/%s/%s results/" % (ctx.repo.slug, ctx.build.commit + "-${DRONE_BUILD_NUMBER}"),
],
},
Expand All @@ -1268,12 +1244,9 @@ def sonarAnalysis(ctx, phpVersion = DEFAULT_PHP_VERSION):
{
"name": "purge-cache",
"image": MINIO_MC,
"environment": {
"MC_HOST_cache": {
"from_secret": "cache_s3_connection_url",
},
},
"environment": MINIO_MC_ENV,
"commands": [
"mc alias set cache $MC_HOST $AWS_ACCESS_KEY_ID $AWS_SECRET_ACCESS_KEY",
"mc rm --recursive --force cache/cache/%s/%s" % (ctx.repo.slug, ctx.build.commit + "-${DRONE_BUILD_NUMBER}"),
],
},
Expand Down Expand Up @@ -1605,7 +1578,7 @@ def cacheRestore():
"from_secret": "cache_s3_access_key",
},
"endpoint": {
"from_secret": "cache_s3_endpoint",
"from_secret": "cache_s3_server",
},
"restore": True,
"secret_key": {
Expand Down Expand Up @@ -1985,60 +1958,6 @@ def buildTestConfig(params):
configs.append(config)
return configs

def stopBuild(ctx, earlyFail):
if (earlyFail):
return [{
"name": "stop-build",
"image": DRONE_CLI,
"environment": {
"DRONE_SERVER": "https://drone.owncloud.com",
"DRONE_TOKEN": {
"from_secret": "drone_token",
},
},
"commands": [
"drone build stop owncloud/%s ${DRONE_BUILD_NUMBER}" % ctx.repo.name,
],
"when": {
"status": [
"failure",
],
"event": [
"pull_request",
],
},
}]

else:
return []

def githubComment(earlyFail):
if (earlyFail):
return [{
"name": "github-comment",
"image": THEGEEKLAB_DRONE_GITHUB_COMMENT,
"pull": "if-not-exists",
"settings": {
"message": ":boom: Acceptance tests pipeline <strong>${DRONE_STAGE_NAME}</strong> failed. The build has been cancelled.\\n\\n${DRONE_BUILD_LINK}/${DRONE_JOB_NUMBER}${DRONE_STAGE_NUMBER}",
"key": "pr-${DRONE_PULL_REQUEST}",
"update": "true",
"api_key": {
"from_secret": "github_token",
},
},
"when": {
"status": [
"failure",
],
"event": [
"pull_request",
],
},
}]

else:
return []

def checkStarlark():
return [{
"kind": "pipeline",
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
"dependencies": {},
"devDependencies": {
"bower": "~1.8.14",
"handlebars": "^4.7.7",
"handlebars": "^4.7.8",
"jasmine-core": "~4.6.0",
"jasmine-sinon": "^0.4.0",
"jsdoc": "~4.0.2",
"jshint": "*",
"karma": "~6.4.2",
"karma-chrome-launcher": "^3.2.0",
"karma-coverage": "*",
"karma-coverage": "~2.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-sinon": "^1.0.4",
"karma-junit-reporter": "*",
Expand Down
Loading

0 comments on commit 55d4743

Please sign in to comment.