openqa/dispatcher: always use fedora-messaging, ditch fedmsg

This ditches the ability to choose between fedora-messaging and
fedmsg and always uses fedora-messaging; with this, we'll switch
the prod instance to fedora-messaging also (fingers crossed).

Signed-off-by: Adam Williamson <awilliam@redhat.com>
This commit is contained in:
Adam Williamson 2019-06-17 12:15:35 -07:00
parent 0a9630f0a4
commit 97dd8ae650
4 changed files with 42 additions and 103 deletions

View file

@ -37,7 +37,6 @@ openqa_extraarches: true
wikitcms_token: "{{ private }}/files/openidc/staging/wikitcms.json" wikitcms_token: "{{ private }}/files/openidc/staging/wikitcms.json"
openqa_wikitcms_hostname: stg.fedoraproject.org openqa_wikitcms_hostname: stg.fedoraproject.org
openqa_resultsdb_url: http://resultsdb-stg01.qa.fedoraproject.org/resultsdb_api/api/v2.0/ openqa_resultsdb_url: http://resultsdb-stg01.qa.fedoraproject.org/resultsdb_api/api/v2.0/
openqa_fedoramessaging: true
# these should really be secrets, but it's not *that* big a deal that # these should really be secrets, but it's not *that* big a deal that
# they aren't, just means someone could theoretically block us # they aren't, just means someone could theoretically block us
openqa_scheduler_uuid: 47acfdb9-e323-4a13-a940-fdb903934e60 openqa_scheduler_uuid: 47acfdb9-e323-4a13-a940-fdb903934e60

View file

@ -1,7 +1,6 @@
openqa_hostname: localhost openqa_hostname: localhost
openqa_consumer: true openqa_consumer: true
openqa_extraarches: false openqa_extraarches: false
openqa_fedoramessaging: false
openqa_amqp_passive: false openqa_amqp_passive: false
openqa_amqp_scheduler_url: "amqps://fedora:@rabbitmq.fedoraproject.org/%2Fpublic_pubsub" openqa_amqp_scheduler_url: "amqps://fedora:@rabbitmq.fedoraproject.org/%2Fpublic_pubsub"
openqa_amqp_scheduler_cacert: /etc/fedora-messaging/cacert.pem openqa_amqp_scheduler_cacert: /etc/fedora-messaging/cacert.pem

View file

@ -17,12 +17,6 @@
## ppc64 and aarch64). Only set it if this instance will ## ppc64 and aarch64). Only set it if this instance will
## have worker hosts for those arches ## have worker hosts for those arches
## default - false ## default - false
# - openqa_fedoramessaging
## bool - if true, configure and deploy the fedora-messaging
## consumers; if false, configure and deploy the fedmsg
## consumers. Note you must also set openqa_scheduler_uuid
## for non-Fedora-infra deployments, if this is set
## default - false
# #
# Optional vars # Optional vars
# - wikitcms_token # - wikitcms_token
@ -30,25 +24,22 @@
## a wiki using openidc auth. If this and ## a wiki using openidc auth. If this and
## openqa_wikitcms_hostname are set, wiki reporting will ## openqa_wikitcms_hostname are set, wiki reporting will
## be enabled, if unset, it will not. Note you must also ## be enabled, if unset, it will not. Note you must also
## set openqa_amqp_wiki_reporter_queue if both this and ## set openqa_amqp_wiki_reporter_queue if this is set.
## openqa_fedoramessaging are set. You should probably ## You should probably NOT set this unless you are
## NOT set this unless you are maintaining the Fedora ## maintaining the Fedora infrastructure deployment.
## infrastructure deployment.
# - openqa_wikitcms_hostname # - openqa_wikitcms_hostname
## string - Hostname of a wiki to report results to. If this and ## string - Hostname of a wiki to report results to. If this and
## wikitcms_token are set, wiki reporting will be ## wikitcms_token are set, wiki reporting will be
## enabled. Note you must also set ## enabled. Note you must also set
## openqa_amqp_wiki_reporter_queue if both this and ## openqa_amqp_wiki_reporter_queue if this is set. You
## openqa_fedoramessaging are set. You should probably ## should probably NOT set this unless you are
## NOT set this unless you are maintaining the Fedora ## maintaining the Fedora infrastructure deployment.
## infrastructure deployment.
# - openqa_resultsdb_url # - openqa_resultsdb_url
## string - a ResultsDB API URL to report results to. If set, ## string - a ResultsDB API URL to report results to. If set,
## ResultsDB reporting will be enabled. Note you must ## ResultsDB reporting will be enabled. Note you must
## also set openqa_amqp_resultsdb_reporter_queue if both ## also set openqa_amqp_resultsdb_reporter_queue if this
## this and openqa_fedoramessaging are set. You should ## is set. You should probably NOT set this unless you
## probably NOT set this unless you are maintaining the ## are maintaining the Fedora infrastructure deployment.
## Fedora infrastructure deployment
# - deployment_type # - deployment_type
## string - Fedora Infrastructure thing; for this role, the ## string - Fedora Infrastructure thing; for this role, the
## fedora_openqa config file and fedora-messaging config ## fedora_openqa config file and fedora-messaging config
@ -85,10 +76,9 @@
## enabled. To use the fedora-messaging scheduler with ## enabled. To use the fedora-messaging scheduler with
## public authentication on the Fedora production AMQP ## public authentication on the Fedora production AMQP
## broker (which is what you'd typically want), you only ## broker (which is what you'd typically want), you only
## need to set this and set openqa_fedoramessaging to ## need to set this. This should be a unique and private
## true. This should be a unique and private string; the ## string; the official recommendation is to use a
## official recommendation is to use a random UUID ## random UUID generated by uuidgen.
## generated by uuidgen.
# - openqa_amqp_scheduler_routing_keys # - openqa_amqp_scheduler_routing_keys
## list - List of routing key names for the fedora-messaging ## list - List of routing key names for the fedora-messaging
## scheduler to subscribe to. The role default for this ## scheduler to subscribe to. The role default for this
@ -123,11 +113,10 @@
## infra deployments should report to Fedora ResultsDB. ## infra deployments should report to Fedora ResultsDB.
## To use the fedora-messaging scheduler with public ## To use the fedora-messaging scheduler with public
## authentication on the Fedora production AMQP broker, ## authentication on the Fedora production AMQP broker,
## you only need to set this and set ## you only need to set this; openqa_resultsdb_url must
## openqa_fedoramessaging to true; openqa_resultsdb_url ## also be set correctly. This should be a unique and
## must also be set correctly. This should be a unique ## private string; the official recommendation is to use
## and private string; the official recommendation is to ## a random UUID generated by uuidgen.
## use a random UUID generated by uuidgen.
# - openqa_amqp_resultsdb_reporter_routing_keys # - openqa_amqp_resultsdb_reporter_routing_keys
## list - List of routing key names for the fedora-messaging ## list - List of routing key names for the fedora-messaging
## ResultsDB reporter to subscribe to. The role default ## ResultsDB reporter to subscribe to. The role default
@ -142,12 +131,10 @@
## deployments should report to the Fedora wikis. To use ## deployments should report to the Fedora wikis. To use
## the fedora-messaging scheduler with public ## the fedora-messaging scheduler with public
## authentication on the Fedora production AMQP broker, ## authentication on the Fedora production AMQP broker,
## you only need to set this and set ## you only need to set this; openqa_wikitcms_hostname
## openqa_fedoramessaging to true; ## must also be set correctly. This should be a unique
## openqa_wikitcms_hostname must also be set correctly. ## and private string; the official recommendation is to
## This should be a unique and private string; the ## use a random UUID generated by uuidgen.
## official recommendation is to use a random UUID
## generated by uuidgen.
# - openqa_amqp_wiki_reporter_routing_keys # - openqa_amqp_wiki_reporter_routing_keys
## list - List of routing key names for the fedora-messaging ## list - List of routing key names for the fedora-messaging
## wiki reporter to subscribe to. The role default ## wiki reporter to subscribe to. The role default
@ -180,29 +167,13 @@
- name: Install required packages - name: Install required packages
package: package:
name: ['python3-fedfind', 'python3-wikitcms', 'python3-openqa_client', 'python3-requests', name: ['fedora-messaging', python3-fedfind', 'python3-wikitcms', 'python3-openqa_client',
'python3-resultsdb_api', 'python3-resultsdb_conventions-fedora', 'python3-setuptools', 'python3-requests', 'python3-resultsdb_api', 'python3-resultsdb_conventions-fedora',
'python3-six'] 'python3-setuptools', 'python3-six']
state: present state: present
tags: tags:
- packages - packages
- name: Install required packages (fedmsg)
package:
name: python3-fedmsg
state: present
when: "not openqa_fedoramessaging|bool"
tags:
- packages
- name: Install required packages (fedora-messaging)
package:
name: fedora-messaging
state: present
when: "openqa_fedoramessaging|bool"
tags:
- packages
- name: Install required packages (wiki oidc auth) - name: Install required packages (wiki oidc auth)
package: package:
name: python3-openidc-client name: python3-openidc-client
@ -245,8 +216,8 @@
args: args:
chdir: /root/fedora_openqa chdir: /root/fedora_openqa
when: "gittools is changed or not insttools.stat.exists" when: "gittools is changed or not insttools.stat.exists"
notify: # notify:
- restart fedmsg-hub # - restart fedmsg-hub
# For now, we only have enough ppc64/aarch64 workers for one instance, # For now, we only have enough ppc64/aarch64 workers for one instance,
# so we have a variant WANTED file that we deploy based on a config # so we have a variant WANTED file that we deploy based on a config
@ -254,8 +225,8 @@
- name: Install extra arch WANTED images config if enabled - name: Install extra arch WANTED images config if enabled
copy: src=images.json.extraarches dest=/etc/fedora-openqa/images.json copy: src=images.json.extraarches dest=/etc/fedora-openqa/images.json
when: openqa_extraarches when: openqa_extraarches
notify: # notify:
- restart fedmsg-hub # - restart fedmsg-hub
- name: openQA client config - name: openQA client config
template: src=client.conf.j2 dest=/etc/openqa/client.conf owner=root group=fedmsg mode=0640 template: src=client.conf.j2 dest=/etc/openqa/client.conf owner=root group=fedmsg mode=0640
@ -267,8 +238,8 @@
- name: Write schedule.conf - name: Write schedule.conf
template: src=schedule.conf.j2 dest=/etc/fedora-openqa/schedule.conf owner=root group=root mode=0644 template: src=schedule.conf.j2 dest=/etc/fedora-openqa/schedule.conf owner=root group=root mode=0644
notify: # notify:
- restart fedmsg-hub # - restart fedmsg-hub
tags: tags:
- config - config
@ -289,16 +260,8 @@
tags: tags:
- config - config
#- name: Write wikitcms token file for fedmsg - name: Wipe the old fedmsg consumer config file
# copy: src={{ wikitcms_token }} dest=/usr/share/fedmsg/.openidc/oidc_wikitcms.json owner=root group=fedmsg mode=0660 file: path=/etc/fedmsg.d/openqa_consumer.py state=absent
# when: "wikitcms_token is defined"
# tags:
# - config
# We do this even if fedora-messaging is true, because in that case,
# we write this file empty to ensure no fedmsg consumers are enabled
- name: Configure fedmsg consumers
template: src=openqa_consumer.py.j2 dest=/etc/fedmsg.d/openqa_consumer.py owner=root group=root mode=0644
notify: notify:
- restart fedmsg-hub - restart fedmsg-hub
tags: tags:
@ -311,7 +274,7 @@
owner: root owner: root
group: root group: root
state: directory state: directory
when: "openqa_fedoramessaging|bool and deployment_type is defined" when: "deployment_type is defined"
tags: tags:
- config - config
@ -322,7 +285,7 @@
mode: 0644 mode: 0644
owner: root owner: root
group: root group: root
when: "openqa_fedoramessaging|bool and deployment_type is defined" when: "deployment_type is defined"
tags: tags:
- config - config
@ -333,7 +296,7 @@
mode: 0600 mode: 0600
owner: root owner: root
group: root group: root
when: "openqa_fedoramessaging|bool and deployment_type is defined" when: "deployment_type is defined"
tags: tags:
- config - config
@ -344,7 +307,7 @@
mode: 0644 mode: 0644
owner: root owner: root
group: root group: root
when: "openqa_fedoramessaging|bool and deployment_type is defined and deployment_type == 'stg'" when: "deployment_type is defined and deployment_type == 'stg'"
tags: tags:
- config - config
@ -355,42 +318,42 @@
mode: 0600 mode: 0600
owner: root owner: root
group: root group: root
when: "openqa_fedoramessaging|bool and deployment_type is defined and deployment_type == 'stg'" when: "deployment_type is defined and deployment_type == 'stg'"
tags: tags:
- config - config
- name: Configure fedora-messaging scheduler - name: Configure fedora-messaging scheduler
template: src=fedora_openqa_scheduler.toml.j2 dest=/etc/fedora-messaging/fedora_openqa_scheduler.toml owner=root group=root mode=0640 template: src=fedora_openqa_scheduler.toml.j2 dest=/etc/fedora-messaging/fedora_openqa_scheduler.toml owner=root group=root mode=0640
register: fmscheduler register: fmscheduler
when: "openqa_amqp_scheduler_queue is defined and openqa_fedoramessaging|bool" when: "openqa_amqp_scheduler_queue is defined"
tags: tags:
- config - config
- name: Configure fedora-messaging wiki reporter - name: Configure fedora-messaging wiki reporter
template: src=fedora_openqa_wiki_reporter.toml.j2 dest=/etc/fedora-messaging/fedora_openqa_wiki_reporter.toml owner=root group=root mode=0640 template: src=fedora_openqa_wiki_reporter.toml.j2 dest=/etc/fedora-messaging/fedora_openqa_wiki_reporter.toml owner=root group=root mode=0640
register: fmwiki register: fmwiki
when: "openqa_amqp_wiki_reporter_queue is defined and openqa_fedoramessaging|bool" when: "openqa_amqp_wiki_reporter_queue is defined"
tags: tags:
- config - config
- name: Configure fedora-messaging ResultsDB reporter - name: Configure fedora-messaging ResultsDB reporter
template: src=fedora_openqa_resultsdb_reporter.toml.j2 dest=/etc/fedora-messaging/fedora_openqa_resultsdb_reporter.toml owner=root group=root mode=0640 template: src=fedora_openqa_resultsdb_reporter.toml.j2 dest=/etc/fedora-messaging/fedora_openqa_resultsdb_reporter.toml owner=root group=root mode=0640
register: fmresultsdb register: fmresultsdb
when: "openqa_amqp_resultsdb_reporter_queue is defined and openqa_fedoramessaging|bool" when: "openqa_amqp_resultsdb_reporter_queue is defined"
tags: tags:
- config - config
- name: Enable and start fedora-messaging scheduler service - name: Enable and start fedora-messaging scheduler service
service: name=fm-consumer@fedora_openqa_scheduler enabled=yes state=started service: name=fm-consumer@fedora_openqa_scheduler enabled=yes state=started
when: "openqa_amqp_scheduler_queue is defined and openqa_fedoramessaging|bool" when: "openqa_amqp_scheduler_queue is defined"
- name: Enable and start fedora-messaging wiki reporter service - name: Enable and start fedora-messaging wiki reporter service
service: name=fm-consumer@fedora_openqa_wiki_reporter enabled=yes state=started service: name=fm-consumer@fedora_openqa_wiki_reporter enabled=yes state=started
when: "openqa_amqp_wiki_reporter_queue is defined and openqa_fedoramessaging|bool" when: "openqa_amqp_wiki_reporter_queue is defined"
- name: Enable and start fedora-messaging ResultsDB reporter service - name: Enable and start fedora-messaging ResultsDB reporter service
service: name=fm-consumer@fedora_openqa_resultsdb_reporter enabled=yes state=started service: name=fm-consumer@fedora_openqa_resultsdb_reporter enabled=yes state=started
when: "openqa_amqp_resultsdb_reporter_queue is defined and openqa_fedoramessaging|bool" when: "openqa_amqp_resultsdb_reporter_queue is defined"
- name: Restart fedora-messaging scheduler service - name: Restart fedora-messaging scheduler service
command: /usr/local/bin/conditional-restart.sh fm-consumer@fedora_openqa_scheduler command: /usr/local/bin/conditional-restart.sh fm-consumer@fedora_openqa_scheduler

View file

@ -1,22 +0,0 @@
config = {
{% if not openqa_fedoramessaging %}
{% if openqa_consumer %}
'fedora_openqa.scheduler.prod.enabled': True,
{% endif %}
{% if deployment_type is defined and deployment_type == 'prod' %}
{% if wikitcms_token is defined %}
'fedora_openqa.reporter.wiki.prod.enabled': True,
{% endif %}
{% if openqa_resultsdb_url is defined %}
'fedora_openqa.reporter.resultsdb.prod.enabled': True,
{% endif %}
{% elif deployment_type is defined and deployment_type == 'stg' %}
{% if wikitcms_token is defined %}
'fedora_openqa.reporter.wiki.stg.enabled': True,
{% endif %}
{% if openqa_resultsdb_url is defined %}
'fedora_openqa.reporter.resultsdb.stg.enabled': True,
{% endif %}
{% endif %}
{% endif %}
}