Compare commits

...

4 commits

Author SHA1 Message Date
92d93d29f0 ELNBuildSync: Use different config branch on staging
Also fix missing variable reference for the main role deployment
playbook.

Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>

rh-pre-commit.version: 2.4.0
rh-pre-commit.check-secrets: ENABLED
2026-06-11 18:13:32 +00:00
63101653a1 ELNBuildSync: Fix AMQP configuration
Feedback from code review:

* Drop unused routing key
* Remove hardcoded .prod.
* Sync with queue_routing_keys in the playbook
* Properly interpret Jinja variables

Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>

rh-pre-commit.version: 2.4.0
rh-pre-commit.check-secrets: ENABLED
2026-06-11 18:13:32 +00:00
81329e710d ELNBuildSync: Do not set AMQP queue as exclusive
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>

rh-pre-commit.version: 2.4.0
rh-pre-commit.check-secrets: ENABLED
2026-06-11 18:13:32 +00:00
377e504d21 ELNBuildSync: support staging RabbitMQ
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>

rh-pre-commit.version: 2.4.0
rh-pre-commit.check-secrets: ENABLED
2026-06-11 18:13:32 +00:00
5 changed files with 129 additions and 122 deletions

View file

@ -29,27 +29,34 @@
vars_files:
- /srv/web/infra/ansible/vars/global.yml
- /srv/private/ansible/vars.yml
- /srv/web/infra/ansible/vars/apps/elnbuildsync.yml
- /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml
pre_tasks:
- name: Set up ELN RabbitMQ queue
ansible.builtin.include_role:
name: rabbit/queue
vars:
queue_username: distrobuildsync-eln
user_sent_topics: ^$
queue_name: distrobuildsync-eln
# TTL: 10 days (in miliseconds)
queue_message_ttl: 864000000
queue_routing_keys:
- "#.buildsys.repo.init"
- "#.buildsys.repo.done"
- "#.buildsys.tag"
- "#.buildsys.task.state.change"
- "org.fedoraproject.{{ env_short }}.elnbuildsync.#"
when: env != 'staging'
roles:
- role: rabbit/user
user_name: "elnbuildsync{{ env_suffix }}"
user_sent_topics: ^$
tags:
- config
- fedora-messaging
- rabbitmq_cluster
- role: rabbit/queue
queue_username: "elnbuildsync{{ env_suffix }}"
user_sent_topics: ^$
queue_name: "elnbuildsync{{ env_suffix }}"
# TTL: 10 days (in miliseconds)
queue_message_ttl: 864000000
queue_routing_keys:
- "#.buildsys.repo.init"
- "#.buildsys.repo.done"
- "#.buildsys.tag"
- "#.buildsys.task.state.change"
tags:
- config
- fedora-messaging
- rabbitmq_cluster
- role: openshift/project
project_app: elnbuildsync
project_description: ELNBuildSync is a tool that listens for Fedora Rawhide builds and re-builds them in the Fedora ELN build environment.

View file

@ -23,6 +23,7 @@ spec:
containers:
- name: elnbuildsync
image: "image-registry.openshift-image-registry.svc:5000/elnbuildsync/elnbuildsync:{{ ebs_upstream_ref }}"
args: ['--config-branch', "{{ (env == 'production') | ternary(ebs_config_branch, ebs_stg_config_branch) }}" ]
startupProbe:
httpGet:
path: /startup

View file

@ -0,0 +1,97 @@
# A basic configuration for Fedora's message broker, using the example callback
# which simply prints messages to standard output.
#
# This file is in the TOML format.
amqp_url = "amqps://elnbuildsync{{ env_suffix }}:@rabbitmq{{ env_suffix}}.fedoraproject.org/%2Fpubsub"
callback = "fedora_messaging.example:printer"
passive_declares = true
[tls]
ca_cert = "/etc/fedora-messaging/cacert.pem"
keyfile = "/etc/fedora-messaging/elnbuildsync.key"
certfile = "/etc/fedora-messaging/elnbuildsync.crt"
[client_properties]
app = "ELNBuildSync"
# Some suggested extra fields:
# URL of the project that provides this consumer
app_url = "https://github.com/fedora-eln/elnbuildsync"
# Contact emails for the maintainer(s) of the consumer - in case the
# broker admin needs to contact them, for e.g.
app_contacts_email = ["sgallagh@fedoraproject.org", "yselkowitz@fedoraproject.org"]
[exchanges."amq.topic"]
type = "topic"
durable = true
auto_delete = false
arguments = {}
# Queue names *must* be in the normal UUID format: run "uuidgen" and use the
# output as your queue name. If your queue is not exclusive, anyone can connect
# and consume from it, causing you to miss messages, so do not share your queue
# name. Any queues that are not auto-deleted on disconnect are garbage-collected
# after approximately one hour.
#
# If you require a stronger guarantee about delivery, please talk to Fedora's
# Infrastructure team.
[queues.elnbuildsync{{ env_suffix }}]
durable = true
auto_delete = false
exclusive = false
arguments = {}
[[bindings]]
queue = "elnbuildsync{{ env_suffix }}"
exchange = "amq.topic"
routing_keys = [
"#.buildsys.repo.init",
"#.buildsys.repo.done",
"#.buildsys.tag",
"#.buildsys.task.state.change"
]
[consumer_config]
example_key = "for my consumer"
[qos]
prefetch_size = 0
prefetch_count = 25
[log_config]
version = 1
disable_existing_loggers = true
[log_config.formatters.simple]
format = "[%(module)s %(levelname)s %(name)s] %(message)s"
[log_config.handlers.console]
class = "logging.StreamHandler"
formatter = "simple"
stream = "ext://sys.stdout"
[log_config.loggers.fedora_messaging]
level = "CRITICAL"
propagate = false
handlers = []
[log_config.loggers.twisted]
level = "CRITICAL"
propagate = false
handlers = ["console"]
[log_config.loggers.pika]
level = "CRITICAL"
propagate = false
handlers = ["console"]
# If your consumer sets up a logger, you must add a configuration for it
# here in order for the messages to show up. e.g. if it set up a logger
# called 'example_printer', you could do:
#[log_config.loggers.example_printer]
#level = "INFO"
#propagate = false
#handlers = ["console"]
[log_config.root]
level = "ERROR"
handlers = ["console"]

View file

@ -4,10 +4,10 @@ metadata:
name: fedora-messaging-config
stringData:
config.toml: |-
{{ ebs_fedora_messaging_config | indent(4) }}
{{ lookup('template', 'fedora-messaging-config.toml') | indent(4) }}
cacert.pem: |-
{{ ebs_fedora_messaging_cacert | indent(4) }}
{{ (env == 'staging') | ternary(ebs_fedora_messaging_stg_cacert, ebs_fedora_messaging_cacert) | indent(4) }}
elnbuildsync.crt: |-
{{ ebs_fedora_messaging_client_pem | indent(4) }}
{{ (env == 'staging') | ternary(ebs_fedora_messaging_client_stg_pem, ebs_fedora_messaging_client_pem) | indent(4) }}
elnbuildsync.key: |-
{{ ebs_fedora_messaging_client_key | indent(4) }}
{{ (env == 'staging') | ternary(ebs_fedora_messaging_client_stg_key, ebs_fedora_messaging_client_key) | indent(4) }}

View file

@ -5,103 +5,5 @@ ebs_upstream_ref: 1.1.0
ebs_db_user: elnbuildsync
ebs_db_name: elnbuildsync
ebs_queue_username: distrobuildsync-eln
ebs_fedora_messaging_config: |
# A basic configuration for Fedora's message broker, using the example callback
# which simply prints messages to standard output.
#
# This file is in the TOML format.
amqp_url = "amqps://fedora:@rabbitmq.fedoraproject.org/%2Fpubsub"
callback = "fedora_messaging.example:printer"
passive_declares = true
[tls]
ca_cert = "/etc/fedora-messaging/cacert.pem"
keyfile = "/etc/fedora-messaging/distrobuildsync-eln.key"
certfile = "/etc/fedora-messaging/distrobuildsync-eln.crt"
[client_properties]
app = "Example Application"
# Some suggested extra fields:
# URL of the project that provides this consumer
app_url = "https://github.com/fedora-infra/fedora-messaging"
# Contact emails for the maintainer(s) of the consumer - in case the
# broker admin needs to contact them, for e.g.
app_contacts_email = ["jcline@fedoraproject.org"]
[exchanges."amq.topic"]
type = "topic"
durable = true
auto_delete = false
arguments = {}
# Queue names *must* be in the normal UUID format: run "uuidgen" and use the
# output as your queue name. If your queue is not exclusive, anyone can connect
# and consume from it, causing you to miss messages, so do not share your queue
# name. Any queues that are not auto-deleted on disconnect are garbage-collected
# after approximately one hour.
#
# If you require a stronger guarantee about delivery, please talk to Fedora's
# Infrastructure team.
[queues.distrobuildsync-eln]
durable = true
auto_delete = false
exclusive = true
arguments = {}
[[bindings]]
queue = "distrobuildsync-eln"
exchange = "amq.topic"
routing_keys = [
"org.fedoraproject.prod.buildsys.repo.init",
"org.fedoraproject.prod.buildsys.repo.done",
"org.fedoraproject.prod.buildsys.tag",
"org.fedoraproject.prod.buildsys.task.state.change"
]
[consumer_config]
example_key = "for my consumer"
[qos]
prefetch_size = 0
prefetch_count = 25
[log_config]
version = 1
disable_existing_loggers = true
[log_config.formatters.simple]
format = "[%(module)s %(levelname)s %(name)s] %(message)s"
[log_config.handlers.console]
class = "logging.StreamHandler"
formatter = "simple"
stream = "ext://sys.stdout"
[log_config.loggers.fedora_messaging]
level = "CRITICAL"
propagate = false
handlers = []
[log_config.loggers.twisted]
level = "CRITICAL"
propagate = false
handlers = ["console"]
[log_config.loggers.pika]
level = "CRITICAL"
propagate = false
handlers = ["console"]
# If your consumer sets up a logger, you must add a configuration for it
# here in order for the messages to show up. e.g. if it set up a logger
# called 'example_printer', you could do:
#[log_config.loggers.example_printer]
#level = "INFO"
#propagate = false
#handlers = ["console"]
[log_config.root]
level = "ERROR"
handlers = ["console"]
ebs_config_branch: main
ebs_stg_config_branch: staging