From 7593f3f063bee0b3ad82c7d7f013bf31ed51b96f Mon Sep 17 00:00:00 2001
From: Tim Flink <tflink@fedoraproject.org>
Date: Thu, 16 Mar 2017 18:12:31 +0000
Subject: [PATCH] enabling per-package dist-git tasks in taskotron prod

---
 inventory/group_vars/taskotron-prod                               | 2 +-
 .../buildmaster-configure/templates/taskotron.master.cfg.j2       | 8 +++-----
 roles/taskotron/taskotron-trigger/templates/trigger_rules.yml.j2  | 6 ------
 3 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/inventory/group_vars/taskotron-prod b/inventory/group_vars/taskotron-prod
index dda0787..284d069 100644
--- a/inventory/group_vars/taskotron-prod
+++ b/inventory/group_vars/taskotron-prod
@@ -39,7 +39,7 @@ resultsdb_fe_endpoint: resultsdb
 resultsdb_frontend_url: http://resultsdb01.qa.fedoraproject.org/resultsdb
 resultsdb_url: http://resultsdb01.qa.fedoraproject.org/resultsdb_api/api/v2.0
 taskotron_docs_url: https://qa.fedoraproject.org/docs/libtaskotron/latest/
-trigger_distgit_repo_url: http://pkgs.fedoraproject.org/git
+trigger_distgit_repo_url: git://pkgs02.phx2.fedoraproject.org
 instances:
   - { name: "Production", url: "https://taskotron.fedoraproject.org"}
   - { name: "Staging", url: "https://taskotron.stg.fedoraproject.org"}
diff --git a/roles/taskotron/buildmaster-configure/templates/taskotron.master.cfg.j2 b/roles/taskotron/buildmaster-configure/templates/taskotron.master.cfg.j2
index c42ce12..49ca4e8 100644
--- a/roles/taskotron/buildmaster-configure/templates/taskotron.master.cfg.j2
+++ b/roles/taskotron/buildmaster-configure/templates/taskotron.master.cfg.j2
@@ -129,7 +129,7 @@ c['schedulers'].append(ForceScheduler(
                                             default='x86_64',
                                             size=128)]))
 
-{% if deployment_type in ['dev', 'stg'] %}
+{% if deployment_type in ['dev', 'stg', 'prod'] %}
 c['schedulers'].append(JobScheduler(
                             name="jobsched-distgit",
                             builderNames=['distgit'],
@@ -246,7 +246,7 @@ factory.addStep(FileUpload(slavesrc='/var/log/taskotron/taskotron.log',
                            mode=0644))
 {% endif %}
 
-{% if deployment_type in ['dev', 'stg'] %}
+{% if deployment_type in ['dev', 'stg', 'prod'] %}
 # this is for package-specific tasks
 distgit_factory = BuildFactory()
 
@@ -255,7 +255,7 @@ distgit_factory.addStep(ShellCommand(command=Interpolate("rm -rf /var/tmp/taskot
 
 {% if deployment_type in ['dev', 'prod'] %}
 # check out the source from prod dist-git
-distgit_factory.addStep(Git(repourl=Property('repo', default=Interpolate('http://pkgs01.phx2.fedoraproject.org/rpms/{}/'.format("%(prop:item)s".split('-')[0]))),
+distgit_factory.addStep(Git(repourl=Property('repo', default=Interpolate('http://pkgs02.phx2.fedoraproject.org/rpms/{}/'.format("%(prop:item)s".split('-')[0]))),
                     branch=Property('branch', default='master'),
                     mode='full',
                     method='clobber',
@@ -351,13 +351,11 @@ c['builders'].append(
       factory=factory, locks=[build_lock.access('counting')],
       mergeRequests=False))
 
-{% if deployment_type in ['dev', 'stg'] %}
 c['builders'].append(
     BuilderConfig(name="distgit",
       slavenames=[{% for buildslave in x86_64_buildslaves %}"{{ buildslave }}",{% endfor %}],
       factory=distgit_factory, locks=[build_lock.access('counting')],
       mergeRequests=False))
-{% endif %}
 ####### STATUS TARGETS
 
 # 'status' is a list of Status Targets. The results of each build will be
diff --git a/roles/taskotron/taskotron-trigger/templates/trigger_rules.yml.j2 b/roles/taskotron/taskotron-trigger/templates/trigger_rules.yml.j2
index 24bc697..8994e9a 100644
--- a/roles/taskotron/taskotron-trigger/templates/trigger_rules.yml.j2
+++ b/roles/taskotron/taskotron-trigger/templates/trigger_rules.yml.j2
@@ -1,14 +1,8 @@
 ---
-{% if deployment_type in ['dev', 'stg'] %}
 - when: {message_type: KojiBuildPackageCompleted}
   do:
     - {tasks: [rpmlint, rpmgrill, python-versions]}
     - {discover: {repo: '{{ trigger_distgit_repo_url }}/rpms/${name}', branch: "${distgit_branch}", fallback_branch: 'master', recursive: true}}
-{% else %}
-- when: {message_type: KojiBuildPackageCompleted}
-  do:
-    - {tasks: [rpmlint, rpmgrill, python-versions]}
-{% endif %}
 - when: {message_type: KojiBuildDockerCompleted}
   do:
     - {tasks: [simpledocker]}
-- 
1.8.3.1

