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

fix(windows/fast-launch): the fast-launch step fail in packer on the main branch #1769

Draft
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

smerle33
Copy link
Contributor

@smerle33 smerle33 commented Feb 27, 2025

⚠️ DO NOT MERGE ⚠️

WIP

as per jenkins-infra/helpdesk#4565
lets disable this fast-launch feature for now and activate the publish for this PR only : green - #1769 (comment)
now lets revert to fast-launch enable with activate the publish for this PR only : red - #1769 (comment)

lets try to repair the sysprep by changing the delimiter : - https://infra.ci.jenkins.io/job/infra-tools/job/packer-images/job/PR-1769/4/pipeline-console/?selected-node=150 - red

check the installation of ec2launch and if not installed, lets install the latest version with https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2launch-download.html

==================================
the fast-launch option need the sysprep to work, last green build on main shows that sysprep was working:

2025-02-16T10:15:28Z:     amazon-ebs.windows: Sysprep sub-command: shutdown: false clean: false
2025-02-16T10:15:28Z:     amazon-ebs.windows: 2025-02-16 10:15:27 Info: Preparing items to run Sysprep.
2025-02-16T10:15:28Z:     amazon-ebs.windows: 2025-02-16 10:15:27 Console: Message: Successfully disabled hibernation
2025-02-16T10:15:28Z:     amazon-ebs.windows: 2025-02-16 10:15:27 Info: Run sysprep
2025-02-16T10:15:28Z:     amazon-ebs.windows: 2025-02-16 10:15:27 Info: Sysprep command: C:\Windows\System32\Sysprep\Sysprep.exe /oobe /quit /generalize /unattend:C:\ProgramData\Amazon\EC2Launch\sysprep\unattend.xml

whereas it's not anymore:

2025-02-27T09:58:14Z: ==> amazon-ebs.windows: Provisioning with powershell script: /tmp/powershell-provisioner956246413
2025-02-27T09:58:23Z:     amazon-ebs.windows: & : The term 'C:\Program Files/amazon/ec2launch/ec2launch.exe' is not recognized as the name of a cmdlet, function,
2025-02-27T09:58:23Z:     amazon-ebs.windows: script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is
2025-02-27T09:58:23Z:     amazon-ebs.windows: correct and try again.
2025-02-27T09:58:23Z:     amazon-ebs.windows: At C:\Windows\Temp\script-67c03736-6cc3-8d54-5935-b6e955a20b37.ps1:1 char:3
2025-02-27T09:58:23Z:     amazon-ebs.windows: + & "$env:ProgramFiles/amazon/ec2launch/ec2launch.exe" reset --block
2025-02-27T09:58:23Z:     amazon-ebs.windows: +   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2025-02-27T09:58:23Z:     amazon-ebs.windows:     + CategoryInfo          : ObjectNotFound: (C:\Program File...h/ec2launch.exe:String) [], CommandNotFoundException
2025-02-27T09:58:23Z:     amazon-ebs.windows:     + FullyQualifiedErrorId : CommandNotFoundException
2025-02-27T09:58:23Z:     amazon-ebs.windows:
2025-02-27T09:58:23Z:     amazon-ebs.windows: & : The term 'C:\Program Files/amazon/ec2launch/ec2launch.exe' is not recognized as the name of a cmdlet, function,
2025-02-27T09:58:23Z:     amazon-ebs.windows: script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is
2025-02-27T09:58:23Z:     amazon-ebs.windows: correct and try again.
2025-02-27T09:58:23Z:     amazon-ebs.windows: At C:\Windows\Temp\script-67c03736-6cc3-8d54-5935-b6e955a20b37.ps1:2 char:3
2025-02-27T09:58:23Z:     amazon-ebs.windows: + & "$env:ProgramFiles/amazon/ec2launch/ec2launch.exe" sysprep --block
2025-02-27T09:58:23Z:     amazon-ebs.windows: +   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2025-02-27T09:58:23Z:     amazon-ebs.windows:     + CategoryInfo          : ObjectNotFound: (C:\Program File...h/ec2launch.exe:String) [], CommandNotFoundException
2025-02-27T09:58:23Z:     amazon-ebs.windows:     + FullyQualifiedErrorId : CommandNotFoundException
2025-02-27T09:58:23Z:     amazon-ebs.windows:

@smerle33 smerle33 requested a review from dduportal February 27, 2025 10:33
@smerle33 smerle33 marked this pull request as draft February 27, 2025 13:18
@smerle33
Copy link
Contributor Author

smerle33 commented Feb 27, 2025

here are the log for fast-launch=falseand publish on: (see https://infra.ci.jenkins.io/job/infra-tools/job/packer-images/job/PR-1769/2/pipeline-console/?selected-node=150)

[2025-02-27T14:06:26.227Z] �[1;32m2025-02-27T14:06:21Z: ==> amazon-ebs.windows: Creating AMI jenkins-agent-windows-2019-amd64-amd64-20250227131952 from instance i-018ff251b21ff4d11�[0m
[2025-02-27T14:06:26.227Z] �[0;32m2025-02-27T14:06:22Z:     amazon-ebs.windows: AMI: ami-0909dc373d94882e2�[0m
[2025-02-27T14:06:26.227Z] �[1;32m2025-02-27T14:06:22Z: ==> amazon-ebs.windows: Waiting for AMI to become ready...�[0m
[2025-02-27T14:30:18.016Z] �[1;32m2025-02-27T14:30:10Z: ==> amazon-ebs.windows: Skipping Enable AMI deprecation...�[0m
[2025-02-27T14:30:18.016Z] �[1;32m2025-02-27T14:30:10Z: ==> amazon-ebs.windows: Modifying attributes on AMI (ami-0909dc373d94882e2)...�[0m
[2025-02-27T14:30:18.016Z] �[0;32m2025-02-27T14:30:10Z:     amazon-ebs.windows: Modifying: imds_support�[0m
[2025-02-27T14:30:18.016Z] �[1;32m2025-02-27T14:30:11Z: ==> amazon-ebs.windows: Modifying attributes on snapshot (snap-0b70d1d59810c2fe6)...�[0m
[2025-02-27T14:30:18.016Z] �[1;32m2025-02-27T14:30:11Z: ==> amazon-ebs.windows: Adding tags to AMI (ami-0909dc373d94882e2)...�[0m
[2025-02-27T14:30:18.016Z] �[1;32m2025-02-27T14:30:11Z: ==> amazon-ebs.windows: Tagging snapshot: snap-0b70d1d59810c2fe6�[0m
[2025-02-27T14:30:18.016Z] �[1;32m2025-02-27T14:30:11Z: ==> amazon-ebs.windows: Creating AMI tags�[0m
[2025-02-27T14:30:18.016Z] �[0;32m2025-02-27T14:30:11Z:     amazon-ebs.windows: Adding tag: "version": "0.1769.2"�[0m
[2025-02-27T14:30:18.016Z] �[0;32m2025-02-27T14:30:11Z:     amazon-ebs.windows: Adding tag: "Name": "jenkins-agent-windows-2019-amd64-Packer-amd64"�[0m
[2025-02-27T14:30:18.016Z] �[0;32m2025-02-27T14:30:11Z:     amazon-ebs.windows: Adding tag: "build_type": "dev"�[0m
[2025-02-27T14:30:18.016Z] �[0;32m2025-02-27T14:30:11Z:     amazon-ebs.windows: Adding tag: "imageplatform": "amd64"�[0m
[2025-02-27T14:30:18.016Z] �[0;32m2025-02-27T14:30:11Z:     amazon-ebs.windows: Adding tag: "imagetype": "jenkins-agent-windows-2019-amd64"�[0m
[2025-02-27T14:30:18.016Z] �[0;32m2025-02-27T14:30:11Z:     amazon-ebs.windows: Adding tag: "scm_ref": "21c2156db667aa371b6dca20d5753fcaba5774ea"�[0m
[2025-02-27T14:30:18.016Z] �[0;32m2025-02-27T14:30:11Z:     amazon-ebs.windows: Adding tag: "timestamp": "20250227131952"�[0m
[2025-02-27T14:30:18.017Z] �[1;32m2025-02-27T14:30:11Z: ==> amazon-ebs.windows: Creating snapshot tags�[0m
[2025-02-27T14:30:18.017Z] �[1;32m2025-02-27T14:30:11Z: ==> amazon-ebs.windows: Terminating the source AWS instance...�[0m
[2025-02-27T14:30:27.943Z] �[1;32m2025-02-27T14:30:27Z: ==> amazon-ebs.windows: Cleaning up any extra volumes...�[0m
[2025-02-27T14:30:27.943Z] �[1;32m2025-02-27T14:30:27Z: ==> amazon-ebs.windows: No volumes to clean up, skipping�[0m
[2025-02-27T14:30:27.943Z] �[1;32m2025-02-27T14:30:27Z: ==> amazon-ebs.windows: Deleting temporary security group...�[0m
[2025-02-27T14:30:28.197Z] �[1;32m2025-02-27T14:30:27Z: ==> amazon-ebs.windows: Deleting temporary keypair...�[0m
[2025-02-27T14:30:28.452Z] �[1;32m2025-02-27T14:30:28Z: Build 'amazon-ebs.windows' finished after 1 hour 10 minutes.�[0m

took 24mn for the AMI to become ready
14:06:22Z: ==> amazon-ebs.windows: Waiting for AMI to become ready
14:30:10Z: ==> amazon-ebs.windows: Skipping Enable AMI deprecation

I was propose within the AWS console UI to enable fast-launch, I did try and it worked.

@smerle33
Copy link
Contributor Author

as planned the build with fast-launch=true and publish on failed (like on main) with:

2025-02-27T15:32:09Z: ==> amazon-ebs.windows: Waiting for AMI to become ready...
2025-02-27T15:56:28Z: ==> amazon-ebs.windows: Enabling fast boot for AMI ami-00e315c661b4721f2 in region us-east-2
2025-02-27T15:56:30Z: ==> amazon-ebs.windows: Waiting for fast launch to become ready on AMI "ami-00e315c661b4721f2" in region us-east-2...
2025-02-27T16:27:08Z: ==> amazon-ebs.windows: Failed to enable fast launch: %!s(<nil>)
2025-02-27T16:27:08Z: ==> amazon-ebs.windows: Failed to enable fast-launch because of errors

@smerle33 smerle33 self-assigned this Feb 27, 2025
@smerle33
Copy link
Contributor Author

no EC2Launch in C:\Program Files\amazon

2025-02-28T09:29:15Z:     amazon-ebs.windows:     Directory: C:\Program Files\amazon
2025-02-28T09:29:15Z:     amazon-ebs.windows:
2025-02-28T09:29:15Z:     amazon-ebs.windows:
2025-02-28T09:29:15Z:     amazon-ebs.windows: Mode                LastWriteTime         Length Name
2025-02-28T09:29:15Z:     amazon-ebs.windows: ----                -------------         ------ ----
2025-02-28T09:29:15Z:     amazon-ebs.windows: d-----        1/15/2025   5:26 PM                cfn-bootstrap
2025-02-28T09:29:15Z:     amazon-ebs.windows: d-----        2/12/2025   9:58 PM                SSM
2025-02-28T09:29:15Z:     amazon-ebs.windows: d-----       12/12/2024   7:49 PM                XenTools
2025-02-28T09:29:15Z:     amazon-ebs.windows: & : The term 'C:\Program Files\amazon\ec2launch\ec2launch.exe' is not recognized as the name of a cmdlet, function,

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.

1 participant