Skip to content

Commit

Permalink
add build_on_tag flag (#456)
Browse files Browse the repository at this point in the history
* feat(docker-compose): update version

* feat(docker-compose): update version

* fix(test): check active build for tag event

* feat(github): add build_on_tag flag
  • Loading branch information
iberryful authored Dec 9, 2020
1 parent 12f66ee commit a4ca2ae
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/db/migrations/00035.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE "project" ADD COLUMN build_on_tag boolean DEFAULT true NOT NULL;
18 changes: 14 additions & 4 deletions src/github/trigger/trigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,18 @@ def create_push(self, c, repository, branch, tag):
self.execute('''
UPDATE "commit" SET tag = %s WHERE id = %s AND project_id = %s
''', [tag, c['id'], project_id], fetch=False)
if self.has_active_build(commit_id, project_id):
return

build_on_tag = self.execute('''
SELECT build_on_tag
FROM project
WHERE id = %s''', [project_id])[0]

if not build_on_tag and self.has_active_build(commit_id, project_id):
return
else:
if self.has_active_build(commit_id, project_id):
return


if not result:
status_url = repository['statuses_url'].format(sha=c['id'])
Expand Down Expand Up @@ -411,8 +421,8 @@ def handle_pull_request(self, event):
FROM job j
JOIN build b
ON b.id = j.build_id
WHERE
b.commit_id = %s AND
WHERE
b.commit_id = %s AND
j.state in ('scheduled', 'running', 'queued')
''', [commit_id], fetch=False)

Expand Down

0 comments on commit a4ca2ae

Please sign in to comment.