ELNBuildSync: support staging RabbitMQ #3400
Labels
No labels
ai-review-please
freeze-break-request
post-freeze
Backlog Status
Needs Review
Backlog Status
Ready
chore
documentation
points
01
points
02
points
03
points
05
points
08
points
13
Priority
High
Priority
Low
Priority
Medium
Sprint Status
Blocked
Sprint Status
Done
Sprint Status
In Progress
Sprint Status
Review
Sprint Status
To Do
Technical Debt
Work Item
Bug
Work Item
Epic
Work Item
Spike
Work Item
Task
Work Item
User Story
No milestone
No project
No assignees
5 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
infra/ansible!3400
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "sgallagh/infra-ansible:elnbuildsync-deploy"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Signed-off-by: Stephen Gallagher sgallagh@redhat.com
rh-pre-commit.version: 2.4.0
rh-pre-commit.check-secrets: ENABLED
This looks fine to me, probably worth someone with more openshift knowledge having a look too.
AI Code Review
Detailed Code Review
The PR successfully parameterizes the RabbitMQ configuration to support a staging environment by introducing environment-specific suffixes. However, there are critical logic errors in the extracted
fedora-messaging-config.tomlthat will cause the staging deployment to fail or misbehave. Specifically, the AMQP connection string is missing the environment suffix for the username, and the consumer bindings still hardcode theprodenvironment for routing keys, meaning the staging consumer will attempt to listen to production messages instead of staging messages.Additionally, there is an architectural concern with how the TOML file is injected into the ConfigMap. Standard file loading functions read file contents as raw strings without evaluating embedded Jinja tags (like
{{ env_suffix }}). This needs to be parsed as a template to ensure the variables are populated correctly before being embedded into the ConfigMap YAML.📂 File Reviews
📄 `roles/openshift-apps/elnbuildsync/templates/fedora-messaging-config.toml` - Extracted RabbitMQ configuration to a separate TOML file with Jinja templating.
elnbuildsync{{ env_suffix }}, but the URL hardcodeselnbuildsync.{{ env_suffix }}variable in the username section of the AMQP URL to ensure authentication succeeds in staging..prod.environment scope, completely breaking staging functionality as the staging app will bind to production messages.{{ env_short }}(or standard wildcard#as defined in the playbook queue setup).📄 `roles/openshift-apps/elnbuildsync/templates/fedora-messaging-config.yml.j2` - Updated ConfigMap template to load the TOML configuration file and environment-aware certificates.
load_fileto embed a file containing Jinja variables ({{ env_suffix }}) will likely embed the raw strings instead of evaluating them, as standard file lookups do not recursively process templates.lookup('template', ...)functionality to ensure the TOML file's variables are fully evaluated before embedding.Questions:
load_filefunction in your environment natively perform recursive Jinja rendering? If not, the variables inside the TOML won't be replaced.✅ Summary
.prod.in the TOML routing keys to ensure the staging consumer listens to staging events.{{ env_suffix }}for the username in theamqp_urlconfiguration string.load_filewithlookup('template')if needed.routing_keysbindings defined infedora-messaging-config.tomlstrictly with thequeue_routing_keysdefined in the playbook to prevent desyncs.🤖 AI Code Review | Generated with ai-code-review | Model:
gemini-3.1-pro-preview⚠️ AI-generated suggestions may be incorrect. Verify before applying. Not a replacement for human review.
I'm not sure why ansible-lint is complaining. https://forge.fedoraproject.org/infra/ansible/src/branch/main/roles/rabbit/user/tasks/main.yml exists...
One minor comment...
@ -6,3 +6,3 @@config.toml: |-{{ ebs_fedora_messaging_config | indent(4) }}{{ load_file('fedora-messaging-config.toml') | indent(4) }}cacert.pem: |-Instead of inlining these... set them as secrets, ie, look at for example:
playbooks/openshift-apps/fedocal.yml
and the openshift/secret-file role calls there.
Then they are secrets, which I think might be better than adding them here?
I'm not entirely sure what you're saying here. This entire YAML is defining a Kubernetes Secret object. It's doing what the
openshift/secret-filerole does under the hood, except it's adding all of the certificates to a single Secret (and thus directory) rather than individual directories.I can switch to using
openshift/secret-file, but it seems less efficient. And if you want me to giveebs-config.yml.j2the same treatment, that will actually require code changes to EBS, because they expect them to both to be in a default location/etc/elnbuildsync.Ahhh. I didn't look at enough context there. :( Sorry...
no, this approch seems fine to me. +1
076f51b02cd2a3de5315I think I've fixed the AI-detected issues and I've also enhanced the Deployment to use a different config file depending on whether the environment is production or staging.
Hey @sgallagh , it looks like the
distrobuildsync-elnuser in RabbitMQ is not unused (and deprecated in favor orelnbuildsync), is it correct? Can I remove it from RabbitMQ?That's probably correct, but if possible can we not change anything until I have ELNBuildSync up and running on Fedora Infrastructure, just in case I'm mistaken?
The new user
elnbuildsyncis definitely correct for the new deployment, but I'm not 100% sure right now that thedistrobuildsync-elnuser isn't in use by the old/current deployment.