buildkite / elastic-ci-stack-for-ec2-mac

CloudFormation template for Auto Scaling AWS EC2 Mac based Buildkite Agents
MIT License
9 stars 5 forks source link

Add Toggle To Instance UserData Field #13

Closed egonbraun closed 1 year ago

egonbraun commented 1 year ago

Description

This PR adds a new flag to toggle the UserData field of the instance's LaunchTemplate.

The commands on the field sometimes break or are not necessary in some environments. I personally prefer to add them directly to the AMI.

I tried a few alternatives, as described below, but at the end a toggle is the solution that made more sense from a technical and user experience perspective.

Alternative Approaches to the Solution

Provide Your Own LaunchTemplate object

I thought about this alternative solution, however the LaunchTemplate is the core object so if you prefer not using the default one it is much better to just create your own template based on Buildkite's one, since you will have to basically bring all of the parameters plus the DedicatedHost as the LaunchTemplate depends on them.

Add custom commands

Instead of a toggle I also thought about enabling the user to provide their own commands. The problem here is that this field uses a lot of interpolation which might not be done. Also, providing multiline values as a parameter in the command line is not a good experience either.

FAQ

Why set the default value of the buildkite token to an empty string?

This value is only used when you have the UserData field enabled as the commands there sets up the agent's configuration. If you disabled the UserData then you do not need to provide the configuration as, for example, you added it directly to the AMI or you do it in another way.

Do the changes respect current users?

Yes, none of the changes I propose will break current users.

elijahchancey commented 1 year ago

Thanks Egon!