Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testflinger-yaml-generator: add provision parameters for oem_autoinstall connector #76

Merged
Merged
Changes from 2 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
33 changes: 31 additions & 2 deletions Tools/PC/testflinger_yaml_generator/testflinger_yaml_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,11 +263,28 @@ def __init__(self, cid, default_yaml_file_path="./template/template.yaml",
self.is_distupgrade = is_distupgrade

def provision_setting(self, is_provision, image="desktop-22-04-2-uefi",
provision_type="distro"):
provision_type="distro", provision_token="",
provision_auth_keys="", provision_user_data=""):
if not is_provision:
self.yaml_remove_field("provision_data")
return
setting_dict = {'provision_data': {provision_type: image}}

# additional parameters if use oem_autoinstall connector
attachments = []
if provision_user_data:
setting_dict['provision_data']['user_data'] = provision_user_data
attachments.append({'local': provision_user_data})
if provision_token:
setting_dict['provision_data']['token_file'] = provision_token
attachments.append({'local': provision_token})
if provision_auth_keys:
setting_dict['provision_data'][
'authorized_keys'] = provision_auth_keys
attachments.append({'local': provision_auth_keys})
if attachments:
setting_dict['provision_data']['attachments'] = attachments

self.yaml_update_field(setting_dict)

def reserve_setting(self, is_reserve, lp_username, timeout=120):
Expand Down Expand Up @@ -326,6 +343,15 @@ def parse_input_arg():
help='The provision image. \
ie, desktop-22-04-2-uefi. \
If didn\'t set this mean no provision')
opt_args.add_argument('--provisionToken', default="", type=str,
help='File with username and token for image \
URL auth')
Copy link
Contributor

Choose a reason for hiding this comment

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

Could add more detail in the help and give the sample on it?
ie File with username and token for Jenkins image url auth, and it will be the yaml format.
ie. [$JENKINS_USERNAME]\n token = $JENKINS_API_TOKEN

opt_args.add_argument('--provisionUserData', default="", type=str,
help='user-data file for autoinstall and cloud-init \
provisioning')
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you give the sample file or the link to let us know how to write it?
Add the help info This argument is MUST required if deploy the image using the autoinstall image (ie. 24.04 image)

opt_args.add_argument('--provisionAuthKeys', default="", type=str,
help='authorized_keys file to add in provisioned \
system')
Copy link
Contributor

@seankingyang seankingyang Aug 22, 2024

Choose a reason for hiding this comment

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

Could you give the sample file or the link to let us know how to write it?
change the help info to ssh authorized_keys file to add in provisioned system

opt_args.add_argument('--globalTimeout', type=int, default=43200,
help="Set the testflinger's global timeout. \
Max:43200")
Expand Down Expand Up @@ -392,7 +418,10 @@ def parse_input_arg():

builder.provision_setting(is_provision=provision,
image=args.provisionImage,
provision_type=args.provisionType)
provision_type=args.provisionType,
provision_token=args.provisionToken,
provision_user_data=args.provisionUserData,
provision_auth_keys=args.provisionAuthKeys)

builder.reserve_setting(is_reserve=reserve,
lp_username=args.LpID,
Expand Down
Loading