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

Conversation

Artur-at-work
Copy link
Contributor

@Artur-at-work Artur-at-work commented Aug 21, 2024

Expand tf-yaml-generator to support oem_autoinstall device connector in 24.04.
It adds 3 more parameters + attachments in the provision stage of job.yaml. These parameters are optional, so if args not added, then no changes to original behavior and templates.

Sample provisioning data for 24.04:

job_queue: artur-oemscript-2404
provision_data:
  url: http://10.131.60.220:8080/job/somerville-noble-oem-24.04a/lastSuccessfulBuild/artifact/out/somerville-noble-oem-24.04a-20240806-59.iso
  token_file: "jenkins-token.txt"
  user_data: "ubuntu-oem-image-builder/alloem-init/cloud-configs/redeploy/user-data"
  authorized_keys: "ubuntu-oem-image-builder/injections/alloem-init/chroot/minimal.standard.live.hotfix.squashfs/etc/ssh/authorized_keys"
  attachments:
    - local: "ubuntu-oem-image-builder/alloem-init/cloud-configs/redeploy/user-data"
    - local: "ubuntu-oem-image-builder/injections/alloem-init/chroot/minimal.standard.live.hotfix.squashfs/etc/ssh/authorized_keys"
    - local: "jenkins-token.txt"

Test:
generate with original args:
./testflinger_yaml_generator.py -c 202405-33980 -o prov.yaml --LpID artur-at-work --provisionImage http://10.131.60.220:8080/job/somerville-noble-oem-24.04a/lastSuccessfulBuild/artifact/out/somerville-noble-oem-24.04a-20240820-71.iso

./testflinger_yaml_generator.py -c 202405-33980 -o prov-url.yaml --LpID artur-at-work --provisionType url --provisionImage http://10.131.60.220:8080/job/somerville-noble-oem-24.04a/lastSuccessfulBuild/artifact/out/somerville-noble-oem-24.04a-20240820-71.iso

generate with new args:
./testflinger_yaml_generator.py -c 202405-33980 -o prov-new.yaml --LpID artur-at-work --provisionType url --provisionImage http://10.131.60.220:8080/job/somerville-noble-oem-24.04a/lastSuccessfulBuild/artifact/out/somerville-noble-oem-24.04a-20240820-71.iso --provisionToken ~/testflinger/test-yaml/jenkins-token.txt --provisionAuthKeys ~/testflinger/test-yaml/authorized_keys --provisionUserData ~/testflinger/test-yaml/user-data

Sample prov-new.yaml

Closes: https://warthogs.atlassian.net/browse/OEX86-412

@Artur-at-work Artur-at-work marked this pull request as draft August 21, 2024 06:13
@Artur-at-work Artur-at-work marked this pull request as ready for review August 21, 2024 13:47
@Artur-at-work
Copy link
Contributor Author

hi @seankingyang , could you help to review please?
It seems I can't request the reviewers directly..

Copy link
Contributor

@seankingyang seankingyang left a comment

Choose a reason for hiding this comment

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

Thanks for this great changing, and there are some suggestions at below

@@ -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

URL auth')
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)

provisioning')
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

@Artur-at-work
Copy link
Contributor Author

@seankingyang Thank you for the feedback. I've updated as requested.
Also, Testflinger documentation will have the user-data example for reference.

@seankingyang seankingyang merged commit 99373c3 into canonical:main Aug 23, 2024
5 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