Skip to content

Commit 795ba66

Browse files
authored
Merge pull request #1182 from owncloud/remove-special-drone-actions-from-ci
[CI] [full-ci] Remove special PR-based drone actions from CI
2 parents ce947de + d870396 commit 795ba66

1 file changed

Lines changed: 26 additions & 70 deletions

File tree

.drone.star

Lines changed: 26 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
BANST_AWS_CLI = "banst/awscli"
2-
DRONE_CLI = "drone/cli:alpine"
32
INBUCKET_INBUCKET = "inbucket/inbucket"
43
MINIO_MC = "minio/mc:RELEASE.2020-12-18T10-53-53Z"
54
OC_CI_ALPINE = "owncloudci/alpine:latest"
65
OC_CI_BAZEL_BUILDIFIER = "owncloudci/bazel-buildifier"
76
OC_CI_CEPH = "owncloudci/ceph:tag-build-master-jewel-ubuntu-16.04"
87
OC_CI_CORE = "owncloudci/core"
9-
OC_CI_DRONE_CANCEL_PREVIOUS_BUILDS = "owncloudci/drone-cancel-previous-builds"
108
OC_CI_DRONE_SKIP_PIPELINE = "owncloudci/drone-skip-pipeline"
119
OC_CI_NODEJS = "owncloudci/nodejs:%s"
1210
OC_CI_ORACLE_XE = "owncloudci/oracle-xe:latest"
@@ -28,6 +26,22 @@ THEGEEKLAB_DRONE_GITHUB_COMMENT = "thegeeklab/drone-github-comment:1"
2826
DEFAULT_PHP_VERSION = "7.4"
2927
DEFAULT_NODEJS_VERSION = "14"
3028

29+
# minio mc environment variables
30+
MINIO_MC_ENV = {
31+
"CACHE_BUCKET": {
32+
"from_secret": "cache_s3_bucket",
33+
},
34+
"MC_HOST": {
35+
"from_secret": "cache_s3_server",
36+
},
37+
"AWS_ACCESS_KEY_ID": {
38+
"from_secret": "cache_s3_access_key",
39+
},
40+
"AWS_SECRET_ACCESS_KEY": {
41+
"from_secret": "cache_s3_secret_key",
42+
},
43+
}
44+
3145
dir = {
3246
"base": "/var/www/owncloud",
3347
"federated": "/var/www/owncloud/federated",
@@ -40,7 +54,7 @@ dir = {
4054
config = {
4155
"rocketchat": {
4256
"channel": "builds",
43-
"from_secret": "private_rocketchat",
57+
"from_secret": "rocketchat_chat_webhook",
4458
},
4559
"branches": [
4660
"master",
@@ -207,7 +221,7 @@ def main(ctx):
207221
return before + coverageTests + afterCoverageTests + nonCoverageTests + stages + after
208222

209223
def beforePipelines(ctx):
210-
return validateDailyTarballBuild() + codestyle(ctx) + jscodestyle(ctx) + cancelPreviousBuilds() + phpstan(ctx) + phan(ctx) + phplint(ctx) + checkStarlark()
224+
return validateDailyTarballBuild() + codestyle(ctx) + jscodestyle(ctx) + phpstan(ctx) + phan(ctx) + phplint(ctx) + checkStarlark()
211225

212226
def coveragePipelines(ctx):
213227
# All unit test pipelines that have coverage or other test analysis reported
@@ -361,31 +375,6 @@ def jscodestyle(ctx):
361375

362376
return pipelines
363377

364-
def cancelPreviousBuilds():
365-
return [{
366-
"kind": "pipeline",
367-
"type": "docker",
368-
"name": "cancel-previous-builds",
369-
"clone": {
370-
"disable": True,
371-
},
372-
"steps": [{
373-
"name": "cancel-previous-builds",
374-
"image": OC_CI_DRONE_CANCEL_PREVIOUS_BUILDS,
375-
"settings": {
376-
"DRONE_TOKEN": {
377-
"from_secret": "drone_token",
378-
},
379-
},
380-
}],
381-
"depends_on": [],
382-
"trigger": {
383-
"ref": [
384-
"refs/pull/**",
385-
],
386-
},
387-
}]
388-
389378
def phpstan(ctx):
390379
pipelines = []
391380

@@ -709,7 +698,7 @@ def javascript(ctx, withCoverage):
709698
"image": PLUGINS_S3,
710699
"settings": {
711700
"endpoint": {
712-
"from_secret": "cache_s3_endpoint",
701+
"from_secret": "cache_s3_server",
713702
},
714703
"bucket": "cache",
715704
"source": "./coverage/lcov.info",
@@ -937,7 +926,7 @@ def phpTests(ctx, testType, withCoverage):
937926
"image": PLUGINS_S3,
938927
"settings": {
939928
"endpoint": {
940-
"from_secret": "cache_s3_endpoint",
929+
"from_secret": "cache_s3_server",
941930
},
942931
"bucket": "cache",
943932
"source": "tests/output/clover-%s.xml" % (name),
@@ -1265,7 +1254,7 @@ def acceptance(ctx):
12651254
"path": "%s/downloads" % dir["server"],
12661255
}],
12671256
}),
1268-
] + testConfig["extraTeardown"] + githubComment(params["earlyFail"]) + stopBuild(ctx, params["earlyFail"]),
1257+
] + testConfig["extraTeardown"] + githubComment(params["earlyFail"]),
12691258
"services": databaseService(testConfig["database"]) +
12701259
browserService(testConfig["browser"]) +
12711260
emailService(testConfig["emailNeeded"]) +
@@ -1350,13 +1339,10 @@ def sonarAnalysis(ctx, phpVersion = DEFAULT_PHP_VERSION):
13501339
{
13511340
"name": "sync-from-cache",
13521341
"image": MINIO_MC,
1353-
"environment": {
1354-
"MC_HOST_cache": {
1355-
"from_secret": "cache_s3_connection_url",
1356-
},
1357-
},
1342+
"environment": MINIO_MC_ENV,
13581343
"commands": [
13591344
"mkdir -p results",
1345+
"mc alias set cache $MC_HOST $AWS_ACCESS_KEY_ID $AWS_SECRET_ACCESS_KEY",
13601346
"mc mirror cache/cache/%s/%s results/" % (ctx.repo.slug, ctx.build.commit + "-${DRONE_BUILD_NUMBER}"),
13611347
],
13621348
},
@@ -1381,12 +1367,9 @@ def sonarAnalysis(ctx, phpVersion = DEFAULT_PHP_VERSION):
13811367
{
13821368
"name": "purge-cache",
13831369
"image": MINIO_MC,
1384-
"environment": {
1385-
"MC_HOST_cache": {
1386-
"from_secret": "cache_s3_connection_url",
1387-
},
1388-
},
1370+
"environment": MINIO_MC_ENV,
13891371
"commands": [
1372+
"mc alias set cache $MC_HOST $AWS_ACCESS_KEY_ID $AWS_SECRET_ACCESS_KEY",
13901373
"mc rm --recursive --force cache/cache/%s/%s" % (ctx.repo.slug, ctx.build.commit + "-${DRONE_BUILD_NUMBER}"),
13911374
],
13921375
},
@@ -1718,7 +1701,7 @@ def cacheRestore():
17181701
"from_secret": "cache_s3_access_key",
17191702
},
17201703
"endpoint": {
1721-
"from_secret": "cache_s3_endpoint",
1704+
"from_secret": "cache_s3_server",
17221705
},
17231706
"restore": True,
17241707
"secret_key": {
@@ -2098,33 +2081,6 @@ def buildTestConfig(params):
20982081
configs.append(config)
20992082
return configs
21002083

2101-
def stopBuild(ctx, earlyFail):
2102-
if (earlyFail):
2103-
return [{
2104-
"name": "stop-build",
2105-
"image": DRONE_CLI,
2106-
"environment": {
2107-
"DRONE_SERVER": "https://drone.owncloud.com",
2108-
"DRONE_TOKEN": {
2109-
"from_secret": "drone_token",
2110-
},
2111-
},
2112-
"commands": [
2113-
"drone build stop owncloud/%s ${DRONE_BUILD_NUMBER}" % ctx.repo.name,
2114-
],
2115-
"when": {
2116-
"status": [
2117-
"failure",
2118-
],
2119-
"event": [
2120-
"pull_request",
2121-
],
2122-
},
2123-
}]
2124-
2125-
else:
2126-
return []
2127-
21282084
def githubComment(earlyFail):
21292085
if (earlyFail):
21302086
return [{

0 commit comments

Comments
 (0)