Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions lisa/tools/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,17 @@ def list_commit_ids(self, cwd: pathlib.PurePath) -> List[str]:
)
return filter_ansi_escape(result.stdout).splitlines()

def get_latest_commit_id(self, cwd: pathlib.PurePath) -> str:
result = self.run(
"--no-pager log -n 1 --pretty=format:%h",
shell=True,
cwd=cwd,
force_run=True,
expected_exit_code=0,
expected_exit_code_failure_message="Failed to fetch latest commit id.",
)
return filter_ansi_escape(result.stdout)

def init_submodules(self, cwd: pathlib.PurePath) -> None:
self.run(
"submodule update --init",
Expand Down
4 changes: 2 additions & 2 deletions lisa/transformers/kernel_source_installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,8 @@ def get_source_code(self) -> PurePath:
self._log.info(f"checkout code from: '{runbook.ref}'")
git.checkout(ref=runbook.ref, cwd=code_path)

commitids = git.list_commit_ids(cwd=code_path)
self._log.info(f"Kernel HEAD is now at : {commitids[0]}")
latest_commit_id = git.get_latest_commit_id(cwd=code_path)
self._log.info(f"Kernel HEAD is now at : {latest_commit_id}")

return code_path

Expand Down