Skip to content

Conversation

kostyanf14
Copy link
Member

No description provided.

Signed-off-by: Kostiantyn Kostiuk <[email protected]>
Signed-off-by: Kostiantyn Kostiuk <[email protected]>
Signed-off-by: Kostiantyn Kostiuk <[email protected]>
Copy link

Summary of Changes

Hello @kostyanf14, 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 significantly enhances the hardware submission automation tool by introducing a new capability to monitor and download the results of a submission. It also modernizes the command-line interface by switching to argparse, which provides a more structured and user-friendly way to define and handle arguments for both existing and new functionalities.

Highlights

  • New Action: wait_download: Introduced a new command-line action wait_download to the automation script, allowing users to wait for a hardware submission to complete and then download its results and associated metadata.
  • Argument Parsing Refactor: Migrated the command-line argument parsing from the older getopt module to the more modern and robust argparse module, improving argument definition, help messages, and validation.
  • SDCM Metadata Download: Added a new download_metadata method to the SDCMWrapper class, enabling the retrieval of submission metadata when available.
  • Credential File Exclusion: Updated the .gitignore file to explicitly ignore authconfig.json, preventing sensitive SDCM credentials from being committed to the repository.
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

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.

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 refactors the script to use argparse for command-line argument parsing and introduces a new wait_download action. The move to argparse is a good improvement. However, I've found a critical issue where the new action is unusable due to an inconsistent name in the parser configuration versus the application logic. I've also identified several areas for improvement regarding code robustness, maintainability, and adherence to best practices, such as using argparse subparsers for action-specific arguments and making string-based checks less brittle. My detailed comments provide specific suggestions to address these points.

Comment on lines +483 to +459
# Validate required arguments for submit action
if not args.product_name:
print("Error: --product_name is required for submit action")
sys.exit(1)
if not args.guest_names:
print("Error: --guest_names is required for submit action")
sys.exit(1)
if not args.package_path:
print("Error: --package_path is required for submit action")
sys.exit(1)

Choose a reason for hiding this comment

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

medium

The manual validation of required arguments for the 'submit' action (and similarly in 'main_wait_download') is functional but can be improved. Using argparse subparsers is the idiomatic way to handle different sets of arguments for different actions. Each subparser can define its own required arguments, which simplifies the main functions, removes code duplication, and leverages argparse to provide standard, helpful error messages to the user. Consider refactoring to use subparsers for better maintainability.

wrapper.download_results(args.product_id, args.submission_id, output_file)
print(f"Results downloaded to: {output_file}")

if "> driverMetadata Url" in results:

Choose a reason for hiding this comment

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

medium

Relying on the string "> driverMetadata Url" from the stdout of an external tool is brittle. Any change in the tool's output formatting (e.g., spacing, capitalization) could break this logic silently. A more robust solution would be to have wait_for_submission return a status, or to call another method after it completes to programmatically check for the availability of the metadata URL from a structured response rather than parsing plain text.

@menli820
Copy link

when applying this patch, there is a warning message:
[root@localhost hw_submission_automation]# git am 4.patch
Applying: Use argparse instead of getopt
.git/rebase-apply/patch:84: trailing whitespace.

warning: 1 line adds whitespace errors.
Applying: Add initial skeleton for download action
Applying: Add authconfig.json to gitignore
Applying: Fix error message when SDCM fails
Applying: Implement wait and download action
[root@localhost hw_submission_automation]#

@menli820
Copy link

menli820 commented Sep 23, 2025

@kostyanf14

Test with the following commands:

submit:-- pass

python3 hw_submission_automation.py -n 'Red Hat VirtIO Block Drivers for Windows Server 2016' -g 16 -p /home/signing-windows-machine-configs/scripts/signed/290_BLK_Win2016_unsigned.hlkx -d 2025-12-15

wait_download : -- Error - Access to the path '/home/debug' is denied.

python3 hw_submission_automation.py wait_download --product_id 14079040174508234 --submission_id 1152921505699872126 --output_file /home/debug

SDCM output:
SurfaceDevCenterManager v1.2025.326.2

Download Option /home/debug
Fetch Submission Info
signedPackage Url: https://ingestionpackagesprod1.blob.core.windows.net/ingestion/bfc1659b-7168-4c59-829a-54bca8f6edbc?skoid=6a05eb41-c97a-4f14-a5ce-d392056c0e00&sktid=975f013f-7f24-47e8-a7d3-abc4752bf346&skt=2025-09-23T01%3A15%3A19Z&ske=2025-09-30T01%3A15%3A19Z&sks=b&skv=2024-05-04&sv=2024-05-04&se=2025-09-23T09%3A34%3A12Z&sr=b&sp=rl&rscd=attachment%3B+filename%3DSigned_1152921505699872126.zip&sig=I1IaCND6TU7ms7DAmTPuW85%2BJlQqOwgsqLkdJaqji9E%3D
BlobStorageHandler DownloadToString - Exception downloading blob to file. Error - Access to the path '/home/debug' is denied.
Correlation Id: 1dd95281-8733-4ec3-92b8-ef2847924f35
Return: 0 (SUCCESS)
Results downloaded to: /home/debug
Driver metadata URL found in submission results
SDCM output:

def main_submit(args):
# Validate required arguments for submit action
if not args.product_name:
print("Error: --product_name is required for submit action")

Choose a reason for hiding this comment

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

Consider using argparse.ArgumentParser.error() for consistent error reporting.

Copy link
Member Author

Choose a reason for hiding this comment

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

This will be complicated because "product_name" is not a mandatory option for argparse, because it is required only for the commit action. So, from the argparse point of view, there is no error.

@kostyanf14
Copy link
Member Author

wait_download : -- Error - Access to the path '/home/debug' is denied.

You need to provide a path to the ZIP file. Similar to PS: $SCDM -productid $SDCM_PID -submissionid $SDCM_SID -download $InputPath.signed.zip

Do you think we need to change this behaviour in our wrapper?

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