Skip to content

Conversation

@anirudhrb
Copy link
Collaborator

get_tag() throws an error whenever the current commit doesn't correspond to a tag. This is undesirable. There could be cases where we want to use untagged commits. For example, running kernel installer on an arbitrary kernel branch (instead of official one).

Add an argument to get_tag() that controls if the function fails when not tag is found. Set it to true by default to accommodate existin users.

For kernel installer, pass it as false.

get_tag() throws an error whenever the current commit doesn't correspond
to a tag. This is undesirable. There could be cases where we want to use
untagged commits. For example, running kernel installer on an arbitrary
kernel branch (instead of official one).

Add an argument to get_tag() that controls if the function fails when
not tag is found. Set it to true by default to accommodate existin
users.

For kernel installer, pass it as false.

Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR enhances the get_tag() function in the Git tool to support scenarios where commits may not have associated tags. A new fail_on_not_found parameter allows callers to control whether the function should raise an exception or return an empty string when no tags are found.

Key Changes:

  • Added optional fail_on_not_found parameter to get_tag() with a default value of True for backward compatibility
  • Replaced assertpy.assert_that with LisaException for more consistent error handling
  • Updated kernel source installer to gracefully handle untagged commits by setting fail_on_not_found=False

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
lisa/tools/git.py Added fail_on_not_found parameter to get_tag() method, replaced assertion-based error handling with conditional logic using LisaException, removed unused assertpy import
lisa/transformers/kernel_source_installer.py Updated get_tag() call to use fail_on_not_found=False to allow retrieving information from untagged kernel branches

Test Suggestions per LISA Testing Guidelines:

Key Test Cases:
Since this change affects the Git tool's get_tag() functionality and the kernel source installer, no specific integration/end-to-end test methods are required as there is no comprehensive test suite for the tools module in this repository.

Impacted LISA Features:
This change does not directly impact specific LISA feature classes. It's an infrastructure improvement to the Git tool that provides more flexibility for kernel source installation scenarios.

Tested Azure Marketplace Images:
For validating the kernel source installer changes with untagged commits, consider testing on:

  • canonical 0001-com-ubuntu-server-jammy 22_04-lts-gen2 latest
  • canonical ubuntu-24_04-lts server latest

These images represent common Ubuntu distributions where kernel source installation is frequently performed.

@LiliDeng LiliDeng merged commit d66a2fd into microsoft:main Jan 1, 2026
33 checks passed
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.

2 participants