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

Wait until source instance OK before continuing #5678

Merged
merged 1 commit into from
Dec 7, 2017
Merged

Conversation

mwhooker
Copy link
Contributor

@mwhooker mwhooker commented Dec 7, 2017

Closes #5627

Seems to work every time for me. If anyone wants to confirm that would be appreciated!

@mwhooker mwhooker requested a review from a team as a code owner December 7, 2017 20:32
@mwhooker mwhooker added this to the v1.1.3 milestone Dec 7, 2017
@mwhooker
Copy link
Contributor Author

mwhooker commented Dec 7, 2017

oh I should do this to builder/amazon/common/step_run_spot_instance.go too

@mwhooker
Copy link
Contributor Author

mwhooker commented Dec 7, 2017

really working to restrain myself from removing all the custom state change code

@SwampDragons
Copy link
Contributor

This seems clean, simple, and way better. 👍 I tested on the c5 instance example, as well with a few other aws repro cases I have lying around; it all seems good. Interestingly, it takes longer than our old wait for these windows instances, pushing back the amount of time we wait for winRM to connect... meaning this change might resolve some other random flakiness that occurs from trying to connect too early.

@elisiano
Copy link

I am assuming this change is responsible for the error I'm facing right now, but I'm not 100% certain of it.

Error waiting for instance (i-XXXX) to become ready: ResourceNotReady: exceeded wait attempts

The instance is up, everything is ready but it would not appear that packer is able to identify that.
I've also enable -debug which saves the temporary key in the current directory and attempted an ssh while packer was waiting for it. That worked.
Additionally I also tested aws cli with: aws ec2 wait instance-running --instance-ids i-XXXX and also exited with 0 once the instance was running (yet packer was still waiting).

Switching back to packer v1.1.2 everything works as expected.
Logs are not very useful, please find below an excerpt ran with the environment variable PACKER_LOG=1 and the -debug flag.

[...]
2017/12/18 10:37:01 ui:     centos-6-goldmaster: Adding tag: "Name": "Packer Builder"
    centos-6-goldmaster: Adding tag: "Name": "Packer Builder"
2017/12/18 10:37:03 ui:     centos-6-goldmaster: Instance ID: i-01a3ad1f2409ac0c6
    centos-6-goldmaster: Instance ID: i-01a3ad1f2409ac0c6
2017/12/18 10:37:03 ui: ==> centos-6-goldmaster: Waiting for instance (i-01a3ad1f2409ac0c6) to become ready...
==> centos-6-goldmaster: Waiting for instance (i-01a3ad1f2409ac0c6) to become ready...
2017/12/18 10:47:23 ui error: ==> centos-6-goldmaster: Error waiting for instance (i-01a3ad1f2409ac0c6) to become ready: ResourceNotReady: exceeded wait attempts
2017/12/18 10:47:23 ui: ==> centos-6-goldmaster: Terminating the source AWS instance...
==> centos-6-goldmaster: Error waiting for instance (i-01a3ad1f2409ac0c6) to become ready: ResourceNotReady: exceeded wait attempts
==> centos-6-goldmaster: Terminating the source AWS instance...
2017/12/18 10:47:25 packer: 2017/12/18 10:47:25 Waiting for state to become: terminated
2017/12/18 10:47:25 packer: 2017/12/18 10:47:25 Using 2s as polling delay (change with AWS_POLL_DELAY_SECONDS)
2017/12/18 10:47:25 packer: 2017/12/18 10:47:25 Allowing 300s to complete (change with AWS_TIMEOUT_SECONDS)
2017/12/18 10:47:55 ui: ask: ==> centos-6-goldmaster: Pausing before cleanup of step 'stepCleanupVolumes'. Press enter to continue.
==> centos-6-goldmaster: Pausing before cleanup of step 'stepCleanupVolumes'. Press enter to continue.
2017/12/18 10:48:48 ui: ==> centos-6-goldmaster: No volumes to clean up, skipping
==> centos-6-goldmaster: No volumes to clean up, skipping
2017/12/18 10:48:48 ui: ask: ==> centos-6-goldmaster: Pausing before cleanup of step 'StepSecurityGroup'. Press enter to continue.
==> centos-6-goldmaster: Pausing before cleanup of step 'StepSecurityGroup'. Press enter to continue.
2017/12/18 10:48:48 ui: ==> centos-6-goldmaster: Deleting temporary security group...
==> centos-6-goldmaster: Deleting temporary security group...
2017/12/18 10:48:50 ui: ask: ==> centos-6-goldmaster: Pausing before cleanup of step 'StepKeyPair'. Press enter to continue.
==> centos-6-goldmaster: Pausing before cleanup of step 'StepKeyPair'. Press enter to continue.
2017/12/18 10:48:50 ui: ==> centos-6-goldmaster: Deleting temporary keypair...
==> centos-6-goldmaster: Deleting temporary keypair...
2017/12/18 10:48:51 ui: ask: ==> centos-6-goldmaster: Pausing before cleanup of step 'StepSourceAMIInfo'. Press enter to continue.
==> centos-6-goldmaster: Pausing before cleanup of step 'StepSourceAMIInfo'. Press enter to continue.
2017/12/18 10:48:51 ui: ask: ==> centos-6-goldmaster: Pausing before cleanup of step 'StepPreValidate'. Press enter to continue.
==> centos-6-goldmaster: Pausing before cleanup of step 'StepPreValidate'. Press enter to continue.
2017/12/18 10:48:52 [INFO] (telemetry) ending amazon-ebs
2017/12/18 10:48:52 [INFO] (telemetry) found error: Error waiting for instance (i-01a3ad1f2409ac0c6) to become ready: ResourceNotReady: exceeded wait attempts
2017/12/18 10:48:52 ui error: Build 'centos-6-goldmaster' errored: Error waiting for instance (i-01a3ad1f2409ac0c6) to become ready: ResourceNotReady: exceeded wait attempts
2017/12/18 10:48:52 Waiting on builds to complete...
2017/12/18 10:48:52 Builds completed. Waiting on interrupt barrier...
2017/12/18 10:48:52 machine readable: error-count []string{"1"}
2017/12/18 10:48:52 ui error:
==> Some builds didn't complete successfully and had errors:
2017/12/18 10:48:52 machine readable: centos-6-goldmaster,error []string{"Error waiting for instance (i-01a3ad1f2409ac0c6) to become ready: ResourceNotReady: exceeded wait attempts"}
2017/12/18 10:48:52 ui error: --> centos-6-goldmaster: Error waiting for instance (i-01a3ad1f2409ac0c6) to become ready: ResourceNotReady: exceeded wait attempts
2017/12/18 10:48:52 ui:
==> Builds finished but no artifacts were created.
2017/12/18 10:48:52 [INFO] (telemetry) Finalizing.
Build 'centos-6-goldmaster' errored: Error waiting for instance (i-01a3ad1f2409ac0c6) to become ready: ResourceNotReady: exceeded wait attempts

==> Some builds didn't complete successfully and had errors:
--> centos-6-goldmaster: Error waiting for instance (i-01a3ad1f2409ac0c6) to become ready: ResourceNotReady: exceeded wait attempts
[...]

@SwampDragons
Copy link
Contributor

@elisiano You're right, and we're tracking this in #5705

@ghost
Copy link

ghost commented Apr 2, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Packer uses private IP (and fails) when building on C5.* instance
3 participants