Skip to content

Commit 6a1a2f3

Browse files
authored
Merge pull request #11282 from owncloud/ci/cache-server-bucket
[full-ci][test-only] ci: add cache server and bucket varaibles
2 parents b50880c + c6e066d commit 6a1a2f3

File tree

1 file changed

+24
-54
lines changed

1 file changed

+24
-54
lines changed

.drone.star

+24-54
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ EMAIL_SMTP_PORT = "1025"
7272
EMAIL_SMTP_HOST = "email"
7373
EMAIL_SMTP_SENDER = "ownCloud <[email protected]>"
7474

75+
S3_CACHE_SERVER = "https://cache.owncloud.com"
76+
S3_CACHE_BUCKET = "cache"
77+
S3_PUBLIC_CACHE_BUCKET = "public"
78+
7579
# configuration
7680
config = {
7781
"cs3ApiTests": {
@@ -361,12 +365,8 @@ pipelineVolumeGo = \
361365

362366
# minio mc environment variables
363367
MINIO_MC_ENV = {
364-
"CACHE_BUCKET": {
365-
"from_secret": "cache_s3_bucket",
366-
},
367-
"MC_HOST": {
368-
"from_secret": "cache_s3_server",
369-
},
368+
"CACHE_BUCKET": S3_CACHE_BUCKET,
369+
"MC_HOST": S3_CACHE_SERVER,
370370
"AWS_ACCESS_KEY_ID": {
371371
"from_secret": "cache_s3_access_key",
372372
},
@@ -668,19 +668,13 @@ def testOcis(ctx):
668668
"name": "scan-result-cache",
669669
"image": PLUGINS_S3,
670670
"settings": {
671-
"endpoint": {
672-
"from_secret": "cache_s3_server",
673-
},
674-
"bucket": "cache",
671+
"endpoint": MINIO_MC_ENV["MC_HOST"],
672+
"bucket": MINIO_MC_ENV["CACHE_BUCKET"],
675673
"source": "cache/**/*",
676674
"target": "%s/%s" % (ctx.repo.slug, ctx.build.commit + "-${DRONE_BUILD_NUMBER}"),
677675
"path_style": True,
678-
"access_key": {
679-
"from_secret": "cache_s3_access_key",
680-
},
681-
"secret_key": {
682-
"from_secret": "cache_s3_secret_key",
683-
},
676+
"access_key": MINIO_MC_ENV["AWS_ACCESS_KEY_ID"],
677+
"secret_key": MINIO_MC_ENV["AWS_SECRET_ACCESS_KEY"],
684678
},
685679
},
686680
]
@@ -1085,19 +1079,13 @@ def generateCoverageFromAPITest(ctx, name):
10851079
"name": "coverage-cache-1",
10861080
"image": PLUGINS_S3,
10871081
"settings": {
1088-
"endpoint": {
1089-
"from_secret": "cache_s3_server",
1090-
},
1091-
"bucket": "cache",
1082+
"endpoint": MINIO_MC_ENV["MC_HOST"],
1083+
"bucket": MINIO_MC_ENV["CACHE_BUCKET"],
10921084
"source": "cache/acceptance/coverage/coverage-%s.out" % name,
10931085
"target": "%s/%s/coverage" % (ctx.repo.slug, ctx.build.commit + "-${DRONE_BUILD_NUMBER}"),
10941086
"path_style": True,
1095-
"access_key": {
1096-
"from_secret": "cache_s3_access_key",
1097-
},
1098-
"secret_key": {
1099-
"from_secret": "cache_s3_secret_key",
1100-
},
1087+
"access_key": MINIO_MC_ENV["AWS_ACCESS_KEY_ID"],
1088+
"secret_key": MINIO_MC_ENV["AWS_SECRET_ACCESS_KEY"],
11011089
},
11021090
},
11031091
]
@@ -1608,12 +1596,8 @@ def uploadTracingResult(ctx):
16081596
"image": PLUGINS_S3,
16091597
"pull": "if-not-exists",
16101598
"settings": {
1611-
"bucket": {
1612-
"from_secret": "cache_public_s3_bucket",
1613-
},
1614-
"endpoint": {
1615-
"from_secret": "cache_public_s3_server",
1616-
},
1599+
"bucket": S3_PUBLIC_CACHE_BUCKET,
1600+
"endpoint": S3_CACHE_SERVER,
16171601
"path_style": True,
16181602
"source": "webTestRunner/reports/e2e/playwright/tracing/**/*",
16191603
"strip_prefix": "webTestRunner/reports/e2e/playwright/tracing",
@@ -2788,18 +2772,12 @@ def genericCache(name, action, mounts, cache_path):
27882772
"name": "%s_%s" % (action, name),
27892773
"image": PLUGINS_S3_CACHE,
27902774
"settings": {
2791-
"endpoint": {
2792-
"from_secret": "cache_s3_server",
2793-
},
2775+
"endpoint": MINIO_MC_ENV["MC_HOST"],
27942776
"rebuild": rebuild,
27952777
"restore": restore,
27962778
"mount": mounts,
2797-
"access_key": {
2798-
"from_secret": "cache_s3_access_key",
2799-
},
2800-
"secret_key": {
2801-
"from_secret": "cache_s3_secret_key",
2802-
},
2779+
"access_key": MINIO_MC_ENV["AWS_ACCESS_KEY_ID"],
2780+
"secret_key": MINIO_MC_ENV["AWS_SECRET_ACCESS_KEY"],
28032781
"filename": "%s.tar" % (name),
28042782
"path": cache_path,
28052783
"fallback_path": cache_path,
@@ -2808,8 +2786,6 @@ def genericCache(name, action, mounts, cache_path):
28082786
return step
28092787

28102788
def uploadAPITestCoverageReport(ctx):
2811-
cache_path = "%s/%s/%s" % ("cache", ctx.repo.slug, ctx.build.commit + "-${DRONE_BUILD_NUMBER}")
2812-
28132789
sonar_env = {
28142790
"SONAR_TOKEN": {
28152791
"from_secret": "sonarcloud_acceptance_tests",
@@ -2890,15 +2866,9 @@ def genericCachePurge(flush_path):
28902866
"name": "purge-cache",
28912867
"image": PLUGINS_S3_CACHE,
28922868
"settings": {
2893-
"access_key": {
2894-
"from_secret": "cache_s3_access_key",
2895-
},
2896-
"secret_key": {
2897-
"from_secret": "cache_s3_secret_key",
2898-
},
2899-
"endpoint": {
2900-
"from_secret": "cache_s3_server",
2901-
},
2869+
"access_key": MINIO_MC_ENV["AWS_ACCESS_KEY_ID"],
2870+
"secret_key": MINIO_MC_ENV["AWS_SECRET_ACCESS_KEY"],
2871+
"endpoint": MINIO_MC_ENV["MC_HOST"],
29022872
"flush": True,
29032873
"flush_age": 1,
29042874
"flush_path": flush_path,
@@ -2919,12 +2889,12 @@ def genericCachePurge(flush_path):
29192889

29202890
def genericBuildArtifactCache(ctx, name, action, path):
29212891
if action == "rebuild" or action == "restore":
2922-
cache_path = "%s/%s/%s" % ("cache", ctx.repo.slug, ctx.build.commit + "-${DRONE_BUILD_NUMBER}")
2892+
cache_path = "%s/%s/%s" % (S3_CACHE_BUCKET, ctx.repo.slug, ctx.build.commit + "-${DRONE_BUILD_NUMBER}")
29232893
name = "%s_build_artifact_cache" % (name)
29242894
return genericCache(name, action, [path], cache_path)
29252895

29262896
if action == "purge":
2927-
flush_path = "%s/%s" % ("cache", ctx.repo.slug)
2897+
flush_path = "%s/%s" % (S3_CACHE_BUCKET, ctx.repo.slug)
29282898
return genericCachePurge(flush_path)
29292899
return []
29302900

0 commit comments

Comments
 (0)