Skip to content

Conversation

@will4j
Copy link
Contributor

@will4j will4j commented Dec 3, 2025

What type of PR is this?

/kind bug

What this PR does / why we need it:

  1. .set_hostname variable is used in roles when expression, but actual variable is .native.set_hostname.
  2. mark task as skip when all loop is skipped to indicates some unexpected conditions.

Which issue(s) this PR fixes:

Fixes #

Special notes for reviewers:

Does this PR introduced a user-facing change?

none

Additional documentation, usage docs, etc.:


@kubesphere-prow
Copy link

This PR has multiple commits, and the default merge method is: squash.
You can request commits to be merged using the label: tide/merge-method-merge

Details

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 kubernetes-sigs/prow repository.

@kubesphere-prow kubesphere-prow bot added kind/bug Categorizes issue or PR as related to a bug. do-not-merge/release-note-label-needed labels Dec 3, 2025
@gemini-code-assist
Copy link

Summary of Changes

Hello @will4j, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a bug where Ansible roles failed to correctly set or validate hostnames due to a mismatch in variable names. It rectifies these when conditions to use the proper .native.set_hostname variable. Additionally, the PR improves the robustness of the task execution engine by ensuring that tasks with loops are only marked as skipped if every iteration of the loop is skipped, providing more accurate task status reporting.

Highlights

  • Ansible Variable Correction: Fixed incorrect variable usage (from .set_hostname to .native.set_hostname) in Ansible when conditions across multiple roles, resolving a bug where hostname settings might not have been applied or validated correctly.
  • Refined Task Skipping Logic: Enhanced the task executor's logic to accurately determine when a task should be marked as skipped, specifically for tasks involving loops. A task is now only skipped if all its loop iterations are skipped, preventing premature skipping.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@kubesphere-prow kubesphere-prow bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Dec 3, 2025
@will4j
Copy link
Contributor Author

will4j commented Dec 3, 2025

/assign @redscholar

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly fixes the usage of the .set_hostname variable in main.yaml and precheck/os/tasks/main.yaml by changing it to .native.set_hostname. However, the changes in pkg/executor/task_executor.go to handle skipped tasks in a loop introduce a bug. The logic to check if all loop iterations were skipped is placed inside the loop, which can cause it to exit prematurely. I've added a critical comment with a suggested fix.

@will4j will4j force-pushed the set-hostname-failed branch from ee8d282 to 9eb3f19 Compare December 3, 2025 15:28
@will4j will4j force-pushed the set-hostname-failed branch from 9eb3f19 to 2b5f060 Compare December 3, 2025 16:03
@redscholar
Copy link
Contributor

I have a new idea for the loop. The result should support scenarios both with and without an item. Once I’m done, I’ll update your PR.

@kubesphere-prow kubesphere-prow bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Dec 4, 2025
@will4j
Copy link
Contributor Author

will4j commented Dec 9, 2025

I have a new idea for the loop. The result should support scenarios both with and without an item. Once I’m done, I’ll update your PR.

This should be fully tested, execute tasks will fail now using this new patch.

@redscholar
Copy link
Contributor

I have a new idea for the loop. The result should support scenarios both with and without an item. Once I’m done, I’ll update your PR.

This should be fully tested, execute tasks will fail now using this new patch.

I’m working on it.

@mumuhhh
Copy link
Contributor

mumuhhh commented Dec 20, 2025

I have a new idea for the loop. The result should support scenarios both with and without an item. Once I’m done, I’ll update your PR.

This should be fully tested, execute tasks will fail now using this new patch.

I’m working on it.

由于结构性改变正常运行需要删除历史运行runtime状态目录,循环loop的registry行为了发生了变化,多item的任务受到影响,目前看hook目录下那俩*_install.yaml将会受到影响

@redscholar redscholar force-pushed the set-hostname-failed branch 3 times, most recently from 11a4385 to aba7ead Compare December 26, 2025 02:53
@redscholar
Copy link
Contributor

/lgtm

@kubesphere-prow kubesphere-prow bot added the lgtm Indicates that a PR is ready to be merged. label Dec 26, 2025
@kubesphere-prow
Copy link

LGTM label has been added.

DetailsGit tree hash: f3c2ed91b1254cb99befd4c4e2fb19579272e8a2

@kubesphere-prow kubesphere-prow bot removed the lgtm Indicates that a PR is ready to be merged. label Dec 26, 2025
@kubesphere-prow kubesphere-prow bot requested a review from redscholar December 26, 2025 03:18
Signed-off-by: redscholar <[email protected]>
@sonarqubecloud
Copy link

@redscholar
Copy link
Contributor

/approve
/lgtm

@kubesphere-prow kubesphere-prow bot added the lgtm Indicates that a PR is ready to be merged. label Dec 26, 2025
@kubesphere-prow
Copy link

LGTM label has been added.

DetailsGit tree hash: 0afea4a02d9a9d1a602926a30e96c2aab58d5d70

@kubesphere-prow
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: redscholar, will4j

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

@kubesphere-prow kubesphere-prow bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 26, 2025
@kubesphere-prow kubesphere-prow bot merged commit 7d7e2f9 into kubesphere:main Dec 26, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. release-note-none size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants