Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add build_on_tag flag #456

Merged
merged 5 commits into from
Dec 9, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
@@ -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'])
@@ -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)