Skip to content

Use templates for defining coverage threshold in gotests#145

Merged
joselsegura merged 1 commit into
RedHatInsights:masterfrom
joselsegura:jinja-templating-gotests
May 8, 2026
Merged

Use templates for defining coverage threshold in gotests#145
joselsegura merged 1 commit into
RedHatInsights:masterfrom
joselsegura:jinja-templating-gotests

Conversation

@joselsegura
Copy link
Copy Markdown
Contributor

Description

Using templates for define the coverage threshold in some of the synced gotests.yaml files across repositories.

Type of change

  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (refactoring code, removing useless files)
  • Configuration update

Testing steps

To be tested in CI

@joselsegura joselsegura requested a review from a team as a code owner May 7, 2026 12:06
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 7, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Switched several .github/sync.yml gotests mappings from workflows_examples/gotests.yaml to workflows_examples/gotests.yaml.tmpl. Updated workflows_examples/gotests.yaml.tmpl to conditionally render a with.coverage_threshold parameter when that value is defined; CODECOV_TOKEN secrets wiring remains unchanged.

Changes

gotests template + sync mappings

Layer / File(s) Summary
Template
workflows_examples/gotests.yaml.tmpl
Adds a Jinja conditional that emits a with: mapping containing coverage_threshold only when coverage_threshold is defined; leaves secrets: CODECOV_TOKEN placement unchanged.
Sync Mappings
.github/sync.yml
Changed gotests mapping source from workflows_examples/gotests.yamlworkflows_examples/gotests.yaml.tmpl for: RedHatInsights/ccx-notification-service, RedHatInsights/ccx-notification-writer, RedHatInsights/content-service, RedHatInsights/insights-operator-gathering-conditions-service, RedHatInsights/insights-operator-utils, RedHatInsights/insights-results-aggregator-cleaner, RedHatInsights/insights-results-aggregator-exporter, RedHatInsights/insights-results-aggregator-mock, RedHatInsights/insights-results-smart-proxy, RedHatInsights/parquet-factory. No template.coverage_threshold blocks were added in the diff.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: using templates to define coverage thresholds in gotests files across multiple repositories.
Description check ✅ Passed The description is related to the changeset, explaining the purpose of using templates for coverage threshold definitions in synced gotests files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@workflows_examples/gotests.yaml`:
- Around line 11-14: The YAML linter fails because
workflows_examples/gotests.yaml contains Jinja templating and is processed by
the check-yaml hook; update the pre-commit configuration to exclude that
directory or move the templated examples out of lint scope: modify the
check-yaml hook in .pre-commit-config.yaml (the hook named check-yaml) to add an
exclude pattern matching workflows_examples/ (or add a specific exclude for
workflows_examples/gotests.yaml), or alternatively relocate the templated
file(s) so they are not covered by the check-yaml hook.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: bed79766-cdd5-4d38-aa7e-906d6562d477

📥 Commits

Reviewing files that changed from the base of the PR and between b0f2c0c and f26c90e.

📒 Files selected for processing (2)
  • .github/sync.yml
  • workflows_examples/gotests.yaml

Comment thread workflows_examples/gotests.yaml.tmpl Outdated
@joselsegura joselsegura force-pushed the jinja-templating-gotests branch 4 times, most recently from 6f0056e to 874801b Compare May 7, 2026 14:19
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/sync.yml:
- Around line 8-9: The sync entries that map "source:
workflows_examples/gotests.yaml.tmpl" to various "dest:
.github/workflows/gotests.yaml" are missing the required template rendering
flag; for each occurrence of that mapping add "template: true" alongside the
source/dest pair so the BetaHuhn/repo-file-sync-action will render the Jinja2
before writing; update all ten entries that reference
workflows_examples/gotests.yaml.tmpl (the ones listed in the review) to include
template: true.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: 8c80a80b-8b55-4158-9d23-b73915ac54b1

📥 Commits

Reviewing files that changed from the base of the PR and between 6f0056e and 874801b.

📒 Files selected for processing (2)
  • .github/sync.yml
  • workflows_examples/gotests.yaml.tmpl
✅ Files skipped from review due to trivial changes (1)
  • workflows_examples/gotests.yaml.tmpl

Comment thread .github/sync.yml
Comment on lines +8 to 9
- source: workflows_examples/gotests.yaml.tmpl
dest: .github/workflows/gotests.yaml
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot May 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Find the workflow(s) that consume sync.yml and identify the sync action used
rg -n "repo-file-sync\|sync-action\|BetaHuhn\|sync\.yml" --type yaml -A3 -B3

# Also check for any custom scripts that might pre-process .tmpl files
fd -e sh -e py | xargs rg -l "tmpl\|nunjucks\|jinja" 2>/dev/null

Repository: RedHatInsights/processing-tools

Length of output: 59


🏁 Script executed:

# Find all GitHub Actions workflows
find .github/workflows -name "*.yml" -o -name "*.yaml" 2>/dev/null | head -20

Repository: RedHatInsights/processing-tools

Length of output: 457


🏁 Script executed:

# Search for any references to sync.yml or sync action in workflows
cat .github/workflows/*.yml .github/workflows/*.yaml 2>/dev/null | grep -E "sync|\.yml" -i -A2 -B2 | head -50

Repository: RedHatInsights/processing-tools

Length of output: 734


🏁 Script executed:

# Check if there's documentation about sync configuration
find . -name "README*" -o -name "*.md" | xargs grep -l "sync\|workflow" 2>/dev/null | head -10

Repository: RedHatInsights/processing-tools

Length of output: 185


🏁 Script executed:

# Read the sync.yml file to see all entries and their configuration
cat .github/sync.yml

Repository: RedHatInsights/processing-tools

Length of output: 7444


🏁 Script executed:

# Check the gotests.yaml.tmpl to see if it has template directives
cat workflows_examples/gotests.yaml.tmpl

Repository: RedHatInsights/processing-tools

Length of output: 443


🏁 Script executed:

# Check the workflows_examples README for context
cat workflows_examples/README.md

Repository: RedHatInsights/processing-tools

Length of output: 231


Add template: true to all 10 entries syncing gotests.yaml.tmpl.

The file workflows_examples/gotests.yaml.tmpl contains Jinja2 template directives ({% if coverage_threshold is defined %}, {{ coverage_threshold }}) that must be processed before deployment. The BetaHuhn/repo-file-sync-action requires an explicit template: true field to enable template rendering—the .tmpl file extension alone does not trigger processing.

Without template: true, the raw template syntax will be written verbatim to .github/workflows/gotests.yaml in all 10 target repositories, producing invalid YAML and breaking those GitHub Actions workflows.

Required fix: add template: true to each of these entries
- source: workflows_examples/gotests.yaml.tmpl
  dest: .github/workflows/gotests.yaml
+ template: true

Apply to all 10 affected repositories:

  • ccx-notification-service (line 8)
  • ccx-notification-writer (line 18)
  • content-service (line 48)
  • insights-operator-gathering-conditions-service (line 115)
  • insights-operator-utils (line 125)
  • insights-results-aggregator-cleaner (line 143)
  • insights-results-aggregator-exporter (line 156)
  • insights-results-aggregator-mock (line 166)
  • insights-results-smart-proxy (line 189)
  • parquet-factory (line 205)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- source: workflows_examples/gotests.yaml.tmpl
dest: .github/workflows/gotests.yaml
- source: workflows_examples/gotests.yaml.tmpl
dest: .github/workflows/gotests.yaml
template: true
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/sync.yml around lines 8 - 9, The sync entries that map "source:
workflows_examples/gotests.yaml.tmpl" to various "dest:
.github/workflows/gotests.yaml" are missing the required template rendering
flag; for each occurrence of that mapping add "template: true" alongside the
source/dest pair so the BetaHuhn/repo-file-sync-action will render the Jinja2
before writing; update all ten entries that reference
workflows_examples/gotests.yaml.tmpl (the ones listed in the review) to include
template: true.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

@joselsegura joselsegura force-pushed the jinja-templating-gotests branch 2 times, most recently from 7ffcf3e to adb7708 Compare May 8, 2026 11:53
ikerreyes
ikerreyes previously approved these changes May 8, 2026
Comment thread workflows_examples/gotests.yaml.tmpl Outdated
@joselsegura joselsegura merged commit 5523c28 into RedHatInsights:master May 8, 2026
3 checks passed
@joselsegura joselsegura deleted the jinja-templating-gotests branch May 8, 2026 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants