Skip to content
This repository was archived by the owner on Sep 9, 2026. It is now read-only.

OSAC-1641: fix double role prefix in bare metal instance playbook - #359

Merged
openshift-merge-bot[bot] merged 5 commits into
osac-project:mainfrom
adriengentil:fix/bmi-template-double-prefix
Jun 22, 2026
Merged

openshift-merge-bot[bot] merged 5 commits into
osac-project:mainfrom
adriengentil:fix/bmi-template-double-prefix

Conversation

@adriengentil

@adriengentil adriengentil commented Jun 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • playbook_osac_create_bare_metal_instance.yml was prepending osac.templates. to bare_metal_instance.spec.templateID, which already contains the fully qualified role name (e.g. osac.templates.bm_host_metal3_provisioning)
  • This caused AAP job failures: role 'osac.templates.osac.templates.bm_host_metal3_provisioning' was not found
  • Fix: use {{ bare_metal_instance.spec.templateID }} directly, matching the convention in playbook_osac_create_compute_instance.yml

Jira

https://redhat.atlassian.net/browse/OSAC-1641

Test plan

  • ansible-lint passes
  • Verified against live cluster — AAP job progressed past role lookup failure

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added default Fedora 44 cloud image support for bare metal instance provisioning, including pre-configured checksum validation.
  • Improvements

    • Enhanced provisioning workflow with automatic image parameter defaults, eliminating manual configuration requirements.
    • Deprovisioning now conditionally handles external host references for more intelligent lifecycle management.

@openshift-ci-robot

openshift-ci-robot commented Jun 19, 2026 •

Copy link
Copy Markdown

@adriengentil: This pull request references OSAC-1641 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the bug to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Summary

  • playbook_osac_create_bare_metal_instance.yml was prepending osac.templates. to bare_metal_instance.spec.templateID, which already contains the fully qualified role name (e.g. osac.templates.bm_host_metal3_provisioning)
  • This caused AAP job failures: role 'osac.templates.osac.templates.bm_host_metal3_provisioning' was not found
  • Fix: use {{ bare_metal_instance.spec.templateID }} directly, matching the convention in playbook_osac_create_compute_instance.yml

Jira

https://redhat.atlassian.net/browse/OSAC-1641

Test plan

  • ansible-lint passes
  • Verified against live cluster — AAP job progressed past role lookup failure

🤖 Generated with Claude Code

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci
openshift-ci Bot requested review from danmanor and rgolangh June 19, 2026 14:04
@coderabbitai

coderabbitai Bot commented Jun 19, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@adriengentil, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 54 minutes and 15 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: osac-project/coderabbit/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 06b349bf-1c2f-4fd1-8ee1-8df60d34c786

📥 Commits

Reviewing files that changed from the base of the PR and between a8a219a and e7cfc83.

📒 Files selected for processing (1)
  • collections/ansible_collections/osac/templates/roles/bm_host_metal3_provisioning/tasks/delete.yaml

Walkthrough

Adds default Fedora 44 image variables to the bm_host_metal3_provisioning role, replaces the hard-fail on missing imageURL with a defaults-merge approach in create.yaml, adds an externalHostID presence guard to delete.yaml, and removes the osac.templates. prefix from include_role in both bare metal instance playbooks.

Changes

Metal3 provisioning role hardening and role name fix

Layer / File(s) Summary
Default image vars and create task injection
collections/.../bm_host_metal3_provisioning/defaults/main.yaml, collections/.../bm_host_metal3_provisioning/tasks/create.yaml
Three role defaults (bm_host_metal3_default_image_url, bm_host_metal3_default_image_checksum, bm_host_metal3_default_checksum_type) are added. create.yaml merges these into template_params via set_fact + combine, replacing the prior hard-fail for missing imageURL; the BMH patch fields drop their default('')/default('auto') fallbacks.
externalHostID guard in delete task
collections/.../bm_host_metal3_provisioning/tasks/delete.yaml
An early skip task halts deprovisioning with a debug message when externalHostID is empty. The full BMH deprovisioning sequence (parse, existence check, image-URL-conditional patch + wait, Secret deletion) is wrapped in a when block conditioned on externalHostID being present.
Remove osac.templates. prefix from include_role
playbook_osac_create_bare_metal_instance.yml, playbook_osac_delete_bare_metal_instance.yml
Both playbooks now pass bare_metal_instance.spec.templateID directly as the include_role name, removing the previously prepended osac.templates. namespace prefix.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • osac-project/osac-aap#342: Introduced the dynamic include_role wiring via bare_metal_instance.spec.templateID in the same create/delete playbooks that this PR modifies.
  • osac-project/osac-aap#358: Introduced the bm_host_metal3_provisioning role task files (create.yaml, delete.yaml) that this PR directly modifies for image defaulting and the externalHostID guard.

Suggested labels

lgtm

Suggested reviewers

  • danmanor
  • tzumainn

Poem

🔩 No more hard fails when imageURL's bare,
A Fedora 44 default waits right there.
If externalHostID's empty — just skip and be free,
Strip osac.templates. — let the templateID be.
Metal3 provisioning, now sharper and lean! ⚙️

🚥 Pre-merge checks | ✅ 11
✅ Passed checks (11 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the primary fix: correcting the double role prefix bug in bare metal instance playbooks by removing the redundant 'osac.templates.' prepending.
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.
No-Hardcoded-Secrets ✅ Passed No hardcoded secrets (API keys, tokens, passwords, private keys, credentials, URLs with embedded credentials, or secret variable assignments) detected. Checksum hash is public verification data, no...
No-Weak-Crypto ✅ Passed PR uses SHA-256 (strong algorithm), not weak crypto. No MD5, SHA1, DES, RC4, 3DES, Blowfish, ECB, custom implementations, or insecure constant-time comparisons detected.
No-Injection-Vectors ✅ Passed No injection vector patterns detected: no shell=True, eval/exec, pickle.loads, unsafe yaml.load, os.system, or dangerouslySetInnerHTML found in PR files.
Container-Privileges ✅ Passed PR contains only Ansible playbooks and role files (no K8s manifests). No privileged container configurations, hostPID/Network/IPC, SYS_ADMIN capabilities, or root escalations found.
No-Sensitive-Data-In-Logs ✅ Passed No sensitive data exposure in logs detected. SSH keys, checksums, user data, template parameters, and Kubernetes secrets are never logged in debug/msg statements; only non-sensitive identifiers and...
Ai-Attribution ✅ Passed PR mentions AI tool use (Claude Code); commit e7cfc83 includes proper "Assisted-by: Claude Code" trailer and Red Hat author Signed-off-by. No inappropriate Co-Authored-By used for AI.

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

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

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

templateID already contains the fully qualified role name
(e.g. osac.templates.bm_host_metal3_provisioning), so prepending
osac.templates. caused a lookup failure. Use the templateID directly,
matching the convention in playbook_osac_create_compute_instance.yml.

Assisted-by: Claude Code <noreply@anthropic.com>
Signed-off-by: Adrien Gentil <agentil@redhat.com>
Assisted-by: Claude Code <noreply@anthropic.com>
Signed-off-by: Adrien Gentil <agentil@redhat.com>
@adriengentil
adriengentil force-pushed the fix/bmi-template-double-prefix branch from 81eb931 to 6bdce18 Compare June 19, 2026 14:15
…sioning role

Without defaults, imageURL and imageChecksum must be passed explicitly in
templateParameters. The fulfillment-controller only forwards sshKey today,
so defaults ensure the role can provision without requiring callers to supply
image parameters.

Defaults can be overridden per-instance via templateParameters.

Assisted-by: Claude Code <noreply@anthropic.com>
Signed-off-by: Adrien Gentil <agentil@redhat.com>
When externalHostID is not set there is no BMH to deprovision.
Wrapping all tasks in a block conditioned on externalHostID prevents
NoneType split errors during deletion of unprovisioned instances.

Assisted-by: Claude Code <noreply@anthropic.com>
Signed-off-by: Adrien Gentil <agentil@redhat.com>
@openshift-ci-robot

openshift-ci-robot commented Jun 19, 2026 •

Copy link
Copy Markdown

@adriengentil: This pull request references OSAC-1641 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the task to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Summary

  • playbook_osac_create_bare_metal_instance.yml was prepending osac.templates. to bare_metal_instance.spec.templateID, which already contains the fully qualified role name (e.g. osac.templates.bm_host_metal3_provisioning)
  • This caused AAP job failures: role 'osac.templates.osac.templates.bm_host_metal3_provisioning' was not found
  • Fix: use {{ bare_metal_instance.spec.templateID }} directly, matching the convention in playbook_osac_create_compute_instance.yml

Jira

https://redhat.atlassian.net/browse/OSAC-1641

Test plan

  • ansible-lint passes
  • Verified against live cluster — AAP job progressed past role lookup failure

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

  • Added default Fedora 44 cloud image support for bare metal instance provisioning, including pre-configured checksum validation.

  • Improvements

  • Enhanced provisioning workflow with automatic image parameter defaults, eliminating manual configuration requirements.

  • Deprovisioning now conditionally handles external host references for more intelligent lifecycle management.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

default('') only substitutes undefined variables, not null values.
default('', true) also substitutes falsy values including None.

Assisted-by: Claude Code <noreply@anthropic.com>
Signed-off-by: Adrien Gentil <agentil@redhat.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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
`@collections/ansible_collections/osac/templates/roles/bm_host_metal3_provisioning/defaults/main.yaml`:
- Around line 2-4: The hardcoded value for bm_host_metal3_default_image_checksum
lacks a documented, verifiable source which creates a supply-chain security
risk. Either add a clear comment above bm_host_metal3_default_image_checksum
explaining where the checksum value originated from (e.g., official Fedora build
artifacts, signed manifest URL, or manual verification), or refactor the
configuration to fetch the checksum dynamically at runtime from an official
Fedora checksum source instead of hardcoding it. Ensure the chosen approach is
documented so future maintainers understand the validation chain.
🪄 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: Repository: osac-project/coderabbit/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 3f7b84ea-ae1e-407a-b353-6b00ff8b5ac4

📥 Commits

Reviewing files that changed from the base of the PR and between 75b6796 and a8a219a.

📒 Files selected for processing (5)
  • collections/ansible_collections/osac/templates/roles/bm_host_metal3_provisioning/defaults/main.yaml
  • collections/ansible_collections/osac/templates/roles/bm_host_metal3_provisioning/tasks/create.yaml
  • collections/ansible_collections/osac/templates/roles/bm_host_metal3_provisioning/tasks/delete.yaml
  • playbook_osac_create_bare_metal_instance.yml
  • playbook_osac_delete_bare_metal_instance.yml

Comment on lines +2 to +4
bm_host_metal3_default_image_url: >-
https://download.fedoraproject.org/pub/fedora/linux/releases/44/Cloud/x86_64/images/Fedora-Cloud-Base-Generic-44-1.7.x86_64.qcow2
bm_host_metal3_default_image_checksum: "28680fe5b371a5a82ebf43a31926e086a168e59949d03969c5093e7071f90b7f"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify Fedora 44 image URL accessibility and checksum

URL="https://download.fedoraproject.org/pub/fedora/linux/releases/44/Cloud/x86_64/images/Fedora-Cloud-Base-Generic-44-1.7.x86_64.qcow2"
EXPECTED_CHECKSUM="28680fe5b371a5a82ebf43a31926e086a168e59949d03969c5093e7071f90b7f"

# Check if URL is accessible
echo "Checking URL accessibility..."
HTTP_STATUS=$(curl -I -s -o /dev/null -w "%{http_code}" "$URL")
echo "HTTP Status: $HTTP_STATUS"

if [ "$HTTP_STATUS" -eq 200 ]; then
    echo "✓ URL is accessible"
    
    # Verify checksum from Fedora's checksum file
    echo "Fetching official checksum..."
    CHECKSUM_URL="https://download.fedoraproject.org/pub/fedora/linux/releases/44/Cloud/x86_64/images/Fedora-Cloud-44-1.7-x86_64-CHECKSUM"
    curl -s "$CHECKSUM_URL" | grep -i "Fedora-Cloud-Base-Generic.*\.qcow2" || echo "Checksum file not found or pattern not matched"
else
    echo "✗ URL returned status $HTTP_STATUS"
fi

Repository: osac-project/osac-aap

Length of output: 138


🏁 Script executed:

#!/bin/bash
# Better verification with redirect following and official checksum validation

URL="https://download.fedoraproject.org/pub/fedora/linux/releases/44/Cloud/x86_64/images/Fedora-Cloud-Base-Generic-44-1.7.x86_64.qcow2"
EXPECTED_CHECKSUM="28680fe5b371a5a82ebf43a31926e086a168e59949d03969c5093e7071f90b7f"
CHECKSUM_URL="https://download.fedoraproject.org/pub/fedora/linux/releases/44/Cloud/x86_64/images/CHECKSUM"

echo "=== Checking URL with redirect support ==="
HTTP_STATUS=$(curl -I -s -L -o /dev/null -w "%{http_code}" "$URL")
echo "Final HTTP Status (following redirects): $HTTP_STATUS"

if [ "$HTTP_STATUS" -eq 200 ]; then
    echo "✓ URL resolves successfully (including redirects)"
else
    echo "✗ URL returned status $HTTP_STATUS"
fi

echo ""
echo "=== Fetching official Fedora checksum file ==="
CHECKSUM_CONTENT=$(curl -s "$CHECKSUM_URL" 2>/dev/null || echo "NOT_FOUND")

if [ "$CHECKSUM_CONTENT" != "NOT_FOUND" ]; then
    echo "Checksum file found. Searching for image entry..."
    echo "$CHECKSUM_CONTENT" | grep -i "Fedora-Cloud-Base-Generic-44-1.7.*\.qcow2" || echo "Image pattern not found in checksum file"
    
    # Try alternate patterns
    echo ""
    echo "Checking all SHA256 entries:"
    echo "$CHECKSUM_CONTENT" | grep -i "sha256" | head -5
else
    echo "Could not fetch checksum file from: $CHECKSUM_URL"
fi

Repository: osac-project/osac-aap

Length of output: 372


🏁 Script executed:

#!/bin/bash

CHECKSUM_BASE="https://download.fedoraproject.org/pub/fedora/linux/releases/44/Cloud/x86_64/images"
IMAGE_NAME="Fedora-Cloud-Base-Generic-44-1.7.x86_64.qcow2"
EXPECTED_CHECKSUM="28680fe5b371a5a82ebf43a31926e086a168e59949d03969c5093e7071f90b7f"

echo "=== Trying various checksum file formats ==="
for VARIANT in "CHECKSUM" "CHECKSUM.txt" "CHECKSUM.sha256" "sha256sum" "sha256sum.txt" "CHECKSUMS"; do
    URL="${CHECKSUM_BASE}/${VARIANT}"
    echo ""
    echo "Attempting: $VARIANT"
    RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" "$URL")
    if [ "$RESPONSE" = "200" ]; then
        echo "✓ Found: $URL"
        echo "Content preview:"
        curl -s "$URL" | head -20
    else
        echo "✗ Not found (HTTP $RESPONSE)"
    fi
done

echo ""
echo "=== Checking image metadata ==="
echo "Expected checksum: $EXPECTED_CHECKSUM"
echo "Image URL: ${CHECKSUM_BASE}/${IMAGE_NAME}"

# Try to get Content-Length or Last-Modified headers
echo ""
echo "Image metadata:"
curl -I -s -L "${CHECKSUM_BASE}/${IMAGE_NAME}" | grep -E "Content-Length|Last-Modified|Content-Type"

Repository: osac-project/osac-aap

Length of output: 786


Document the source of the hardcoded checksum or verify it can be validated.

The URL is accessible and the image exists, but the SHA256 checksum cannot be verified against Fedora's official sources—standard checksum files (CHECKSUM, sha256sum, etc.) are not published at the Fedora release mirror. Hardcoding a checksum without a documented, verifiable source is a supply-chain risk. Either:

  • Document where this checksum came from (official Fedora build, signed manifest, etc.)
  • Remove the checksum and fetch it from a documented official source at runtime
  • Provide an alternative validation method
🤖 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
`@collections/ansible_collections/osac/templates/roles/bm_host_metal3_provisioning/defaults/main.yaml`
around lines 2 - 4, The hardcoded value for
bm_host_metal3_default_image_checksum lacks a documented, verifiable source
which creates a supply-chain security risk. Either add a clear comment above
bm_host_metal3_default_image_checksum explaining where the checksum value
originated from (e.g., official Fedora build artifacts, signed manifest URL, or
manual verification), or refactor the configuration to fetch the checksum
dynamically at runtime from an official Fedora checksum source instead of
hardcoding it. Ensure the chosen approach is documented so future maintainers
understand the validation chain.

@omer-vishlitzky

Copy link
Copy Markdown
Contributor

/retest

@openshift-ci

openshift-ci Bot commented Jun 22, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: adriengentil, carbonin

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot
openshift-merge-bot Bot merged commit f130cf4 into osac-project:main Jun 22, 2026
8 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants