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 AMI build failed #1239

Conversation

triarius
Copy link
Contributor

@triarius triarius commented Oct 17, 2023

The base AMI seems to have shifted a bit, it was failing to build. After debugging, it was found that the docker installation step required a restart, and the next part of the script (docker --version) errored out because of that. Even, then, the installation would not work until the restart was made. Eventually, we found this was because the docker install script check is checking if the windows feature called "Containers" is enabled and otherwise running

Add-WindowsFeature Containers

This necessitates a restart, and the install script would not install docker until that happened.

So, in this PR, we use the windows-restart provisioner in packer to restart the builder instance after enabling containers and before installing docker. This did not seem to correctly wait for the previous provisioner, so I also added a 10s pause. The image building job takes ~21 min, so a 10s pause should not have a significant impact. The greater concern is if

Add-WindowsFeature Containers

takes longer than 10s. I think this is unlikely, as it just toggles some windows configuration. If it starts becoming a source of build flake, we can look into debugging why the windows-restart provisioner is not waiting correctly.

Also, I:

  • converted the packer json to hcl. This allows us to put comments in the packer file and hcl is easier to read than json (if you know it)
  • added some tags to built AMIs

Copy link
Contributor

@moskyb moskyb left a comment

Choose a reason for hiding this comment

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

fuck yes, this is so good 👏

@@ -26,8 +26,6 @@ steps:
name: ":go: fixperms build"
agents:
queue: "${BUILDKITE_AGENT_META_DATA_QUEUE}"
depends_on:
- "fixperms-tests"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's faster if you build and test at the same time

@triarius triarius merged commit 4fcc1f3 into main Oct 17, 2023
1 check passed
@triarius triarius deleted the pdp-1831-packer-builds-on-windows-fail-bc-docker-requires-a-restart branch October 17, 2023 05:14
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