From 988522a54450d92ee2e433548e6e355c7c212e63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20P=C3=A1ral?= Date: Thu, 14 Feb 2019 10:54:05 +0100 Subject: [PATCH] taskotron-dev: prevent duplicated buildbot jobs Some buildbot jobs are duplicated and we don't know why: https://pagure.io/taskotron/issue/273 This makes sure the first job completes fine, and the duplicated one is killed as soon as possible. --- .../templates/taskotron.master.cfg.j2.dev | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/roles/taskotron/buildmaster-configure/templates/taskotron.master.cfg.j2.dev b/roles/taskotron/buildmaster-configure/templates/taskotron.master.cfg.j2.dev index c432e8e51c..2669241a09 100644 --- a/roles/taskotron/buildmaster-configure/templates/taskotron.master.cfg.j2.dev +++ b/roles/taskotron/buildmaster-configure/templates/taskotron.master.cfg.j2.dev @@ -160,9 +160,23 @@ factory.addStep(steps.ShellCommand( )) {% endif %} +# prevent duplicated buildbot jobs +# (see https://pagure.io/taskotron/issue/273 ) +factory.addStep(steps.ShellCommand( + command=util.Interpolate( + 'mkdir /var/lib/taskotron/artifacts/%(prop:uuid)s/ || ' + '( echo Multiple jobs with same UUID detected, aborting execution!; ' + ' echo See https://pagure.io/taskotron/issue/273 ; ' + ' exit 1 )' + ), + descriptionDone='Create artifacs dir on slave', + haltOnFailure=True, +)) + # check out the source factory.addStep(steps.Git( - repourl=util.Property('git_repo', default=util.Interpolate('{{ grokmirror_user }}@{{ buildmaster }}:/var/lib/git/mirror/fedoraqa/%(prop:taskname)s/')), + repourl=util.Property('git_repo', default=util.Interpolate( + '{{ grokmirror_user }}@{{ buildmaster }}:/var/lib/git/mirror/fedoraqa/%(prop:taskname)s/')), branch=util.Property('git_branch', default='{{ grokmirror_default_branch }}'), mode='full', method='clobber', @@ -207,9 +221,17 @@ factory.addStep(steps.ShellCommand( )) # create artifacts dir on master +# and also prevent duplicated buildbot jobs +# (see https://pagure.io/taskotron/issue/273 ) factory.addStep(steps.MasterShellCommand( - command=["mkdir", '-m', '0755', util.Interpolate('{{ public_artifacts_dir }}/%(prop:uuid)s')], + command=util.Interpolate( + 'mkdir -m 0755 {{ public_artifacts_dir }}/%(prop:uuid)s/ || ' + '( echo Multiple jobs with same UUID detected, aborting execution!; ' + ' echo See https://pagure.io/taskotron/issue/273 ; ' + ' exit 1 )' + ), descriptionDone='Create artifacs dir on master', + haltOnFailure=True, )) # copy artifacts to master