Skip to content

Commit

Permalink
Merge pull request #2774 from owncloud/switch-to-plugin-based-stopRec…
Browse files Browse the repository at this point in the history
…entBuilds

switch to plugin based cancellation of previous builds
  • Loading branch information
wkloucek authored Nov 18, 2021
2 parents 309a1c7 + aa16bf6 commit 7b8dbf5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 96 deletions.
52 changes: 16 additions & 36 deletions .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def main(ctx):
pipelines = []

test_pipelines = \
checkForRecentBuilds(ctx) + \
cancelPreviousBuilds() + \
[buildOcisBinaryForTesting(ctx)] + \
testOcisModules(ctx) + \
testPipelines(ctx)
Expand Down Expand Up @@ -187,48 +187,28 @@ def testOcisModules(ctx):

return pipelines + [scan_result_upload]

def checkForRecentBuilds(ctx):
pipelines = []

result = {
def cancelPreviousBuilds():
return [{
"kind": "pipeline",
"type": "docker",
"name": "stop-recent-builds",
"steps": stopRecentBuilds(ctx),
"depends_on": [],
"name": "cancel-previous-builds",
"clone": {
"disable": True,
},
"steps": [{
"name": "cancel-previous-builds",
"image": "owncloudci/drone-cancel-previous-builds",
"settings": {
"DRONE_TOKEN": {
"from_secret": "drone_token",
},
},
}],
"trigger": {
"ref": [
"refs/heads/master",
"refs/tags/**",
"refs/pull/**",
],
},
}

pipelines.append(result)

return pipelines

def stopRecentBuilds(ctx):
return [{
"name": "stop-recent-builds",
"image": "drone/cli:alpine",
"environment": {
"DRONE_SERVER": "https://drone.owncloud.com",
"DRONE_TOKEN": {
"from_secret": "drone_token",
},
},
"commands": [
"drone build ls %s --status running > /drone/src/recentBuilds.txt" % ctx.repo.slug,
"drone build info %s ${DRONE_BUILD_NUMBER} > /drone/src/thisBuildInfo.txt" % ctx.repo.slug,
"cd /drone/src && ./tests/acceptance/cancelBuilds.sh",
],
"when": {
"event": [
"pull_request",
],
},
}]

def testPipelines(ctx):
Expand Down
60 changes: 0 additions & 60 deletions tests/acceptance/cancelBuilds.sh

This file was deleted.

0 comments on commit 7b8dbf5

Please sign in to comment.