point Fedora Accounts links to staging on stg #3702

Merged
smoliicek merged 2 commits from jonashub/ansible:jonashub-login into main 2026-10-08 08:41:46 +00:00
Contributor
solves: https://forge.fedoraproject.org/infra/tickets/issues/13605
point Fedora Accounts links to staging on stg
Some checks failed
yamllint / yamllint (pull_request) Failing after 30s
Differential yamllint / yamllint-job (pull_request) Successful in 41s
Linter / ansible-lint (pull_request) Successful in 2m9s
AI Code Review / ai-review (pull_request_target) Successful in 9s
fb24540521

AI Code Review

Detailed Code Review

The task replaces Fedora Accounts hostnames with staging URLs in template files when targeting the staging environment. However, in the conditional when: env == staging, staging is unquoted and will be evaluated as a variable reference rather than a string literal. If staging is undefined or contains unexpected values, the condition will not behave as intended or may fail evaluation.

Quoting the literal string "staging" or 'staging' in the Jinja conditional ensures standard variable evaluation in Ansible.

📂 File Reviews

📄 `roles/ipsilon/tasks/main.yml` - Adds a task using ansible.builtin.replace to point template account links to the staging domain conditionally.
  • Major [Bug]: In when: env == staging, staging is evaluated as an Ansible variable rather than a string literal.
    • Suggestion: Quote the string literal 'staging' in the conditional.
- name: Point Fedora Accounts links to staging
  ansible.builtin.replace:
    path: "/usr/share/ipsilon/themes/Fedora/templates/{{ item }}"
    regexp: 'accounts\.fedoraproject\.org'
    replace: 'accounts.stg.fedoraproject.org'
  loop:
    - index.html
    - login/form.html
    - layout.html
  when: env == 'staging'
  notify: Restart apache
  tags:
    - ipsilon
    - patch

✅ Summary

  • Overall Assessment: Found 1 major issue regarding unquoted string literals in the Ansible task conditional statement.
  • Priority Issues:
    • Unquoted string literal staging in when: env == staging condition in roles/ipsilon/tasks/main.yml

🤖 AI Code Review | Generated with ai-code-review | Model: gemini-3.7-flash

⚠️ AI-generated suggestions may be incorrect. Verify before applying. Not a replacement for human review.

## AI Code Review ### Detailed Code Review The task replaces Fedora Accounts hostnames with staging URLs in template files when targeting the staging environment. However, in the conditional `when: env == staging`, `staging` is unquoted and will be evaluated as a variable reference rather than a string literal. If `staging` is undefined or contains unexpected values, the condition will not behave as intended or may fail evaluation. Quoting the literal string `"staging"` or `'staging'` in the Jinja conditional ensures standard variable evaluation in Ansible. #### 📂 File Reviews <details> <summary><strong>📄 `roles/ipsilon/tasks/main.yml`</strong> - Adds a task using ansible.builtin.replace to point template account links to the staging domain conditionally.</summary> - **Major** [Bug]: In `when: env == staging`, `staging` is evaluated as an Ansible variable rather than a string literal. - *Suggestion:* Quote the string literal `'staging'` in the conditional. ```` - name: Point Fedora Accounts links to staging ansible.builtin.replace: path: "/usr/share/ipsilon/themes/Fedora/templates/{{ item }}" regexp: 'accounts\.fedoraproject\.org' replace: 'accounts.stg.fedoraproject.org' loop: - index.html - login/form.html - layout.html when: env == 'staging' notify: Restart apache tags: - ipsilon - patch ```` </details> ### ✅ Summary - **Overall Assessment:** Found 1 major issue regarding unquoted string literals in the Ansible task conditional statement. - **Priority Issues:** - Unquoted string literal `staging` in `when: env == staging` condition in roles/ipsilon/tasks/main.yml --- 🤖 **AI Code Review** | Generated with [ai-code-review](https://gitlab.com/redhat/edge/ci-cd/ai-code-review) | **Model:** `gemini-3.7-flash` ⚠️ *AI-generated suggestions may be incorrect. Verify before applying. Not a replacement for human review.*
Owner

Can you quote the staging when? Otherwise it seems ok...

Can you quote the staging when? Otherwise it seems ok...
quote staging
Some checks failed
AI Code Review / ai-review (pull_request_target) Successful in 11s
yamllint / yamllint (pull_request) Failing after 38s
Differential yamllint / yamllint-job (pull_request) Successful in 46s
Linter / ansible-lint (pull_request) Successful in 1m34s
7dc86a7134

AI Code Review

Detailed Code Review

The task accurately uses ansible.builtin.replace to point production Fedora Accounts URLs to staging on staging environments. The replacement pattern accounts\.fedoraproject\.org is specific enough to avoid unintended text replacement, and because accounts.stg.fedoraproject.org will not match the pattern on subsequent runs, the task remains idempotent.

The commit history indicates that staging quoting requested in review discussions has been addressed via when: env == "staging". The notify handler and tags match existing role conventions.

📂 File Reviews

📄 `roles/ipsilon/tasks/main.yml` - Adds a task to rewrite production Fedora Accounts URLs to staging in template files when the environment is staging.

✅ Summary

  • Overall Assessment: No critical or blocking issues identified. The task is idempotent, properly conditionalized on the staging environment, and addresses previous review feedback.

🤖 AI Code Review | Generated with ai-code-review | Model: gemini-3.7-flash

⚠️ AI-generated suggestions may be incorrect. Verify before applying. Not a replacement for human review.

## AI Code Review ### Detailed Code Review The task accurately uses `ansible.builtin.replace` to point production Fedora Accounts URLs to staging on staging environments. The replacement pattern `accounts\.fedoraproject\.org` is specific enough to avoid unintended text replacement, and because `accounts.stg.fedoraproject.org` will not match the pattern on subsequent runs, the task remains idempotent. The commit history indicates that staging quoting requested in review discussions has been addressed via `when: env == "staging"`. The notify handler and tags match existing role conventions. #### 📂 File Reviews <details> <summary><strong>📄 `roles/ipsilon/tasks/main.yml`</strong> - Adds a task to rewrite production Fedora Accounts URLs to staging in template files when the environment is staging.</summary> </details> ### ✅ Summary - **Overall Assessment:** No critical or blocking issues identified. The task is idempotent, properly conditionalized on the staging environment, and addresses previous review feedback. --- 🤖 **AI Code Review** | Generated with [ai-code-review](https://gitlab.com/redhat/edge/ci-cd/ai-code-review) | **Model:** `gemini-3.7-flash` ⚠️ *AI-generated suggestions may be incorrect. Verify before applying. Not a replacement for human review.*
smoliicek approved these changes 2026-10-08 08:41:37 +00:00
smoliicek left a comment

looks fine to me, yamllint failing is unrelated.
merging, since it only targets staging - somebody should re-run the playbook on stg

looks fine to me, yamllint failing is unrelated. merging, since it only targets staging - somebody should re-run the playbook on stg
Member

Thanks @jonashub for the work!

Thanks @jonashub for the work!
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
infra/ansible!3702
No description provided.