add pipeline to playwright purge browsers cache

Signed-off-by: prashant-gurung899 <prasantgrg777@gmail.com>
This commit is contained in:
prashant-gurung899
2025-08-27 15:03:05 +05:45
parent a637ba34b1
commit 006f843124

View File

@@ -506,6 +506,13 @@ def main(ctx):
),
)
test_pipelines.append(
pipelineDependsOn(
purgeBrowserCache(ctx),
testPipelines(ctx),
),
)
pipelines = test_pipelines + build_release_pipelines + notifyMatrix(ctx)
# if ctx.build.event == "cron":
@@ -2437,35 +2444,32 @@ def genericCache(name, action, mounts, cache_path):
}
return step
def genericCachePurge(flush_path):
def purgeCache(name, flush_path, flush_age):
return {
"name": "purge_build_artifact_cache",
"steps": [
{
"name": "purge-cache",
"image": PLUGINS_S3_CACHE,
"settings": {
"access_key": {
"from_secret": "cache_s3_access_key",
},
"secret_key": {
"from_secret": "cache_s3_secret_key",
},
"endpoint": CACHE_S3_SERVER,
"flush": True,
"flush_age": 1,
"flush_path": flush_path,
},
},
],
"name": name,
"skip_clone": True,
"when": [
event["cron"],
event["base"],
event["pull_request"],
],
"runs_on": ["success", "failure"],
"steps": [
{
"name": "purge",
"image": MINIO_MC,
"environment": MINIO_MC_ENV,
"commands": [
"mc alias set s3 $MC_HOST $AWS_ACCESS_KEY_ID $AWS_SECRET_ACCESS_KEY",
"to_delete=$(mc find s3/%s/ --older-than %sd)" % (flush_path, flush_age),
'if [ -z "$to_delete" ]; then exit 0; fi',
"mc rm $to_delete",
],
}
]
}
def genericBuildArtifactCache(ctx, name, action, path):
if action == "rebuild" or action == "restore":
cache_path = "%s/%s/%s" % ("cache", repo_slug, ctx.build.commit + "-${CI_PIPELINE_NUMBER}")
@@ -2473,8 +2477,7 @@ def genericBuildArtifactCache(ctx, name, action, path):
return genericCache(name, action, [path], cache_path)
if action == "purge":
flush_path = "%s/%s" % ("cache", repo_slug)
return genericCachePurge(flush_path)
return purgeCache("purge_build_artifact_cache", "cache/opencloud-eu/opencloud", 1)
return []
def restoreBuildArtifactCache(ctx, name, path):
@@ -2486,6 +2489,9 @@ def rebuildBuildArtifactCache(ctx, name, path):
def purgeBuildArtifactCache(ctx):
return genericBuildArtifactCache(ctx, "", "purge", [])
def purgeBrowserCache(ctx):
return purgeCache("purge_browser_build_cache", "dev/web", 14)
def pipelineSanityChecks(pipelines):
"""pipelineSanityChecks helps the CI developers to find errors before running it