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

Using kitchen_root as part of the instance name produces clashes or too long names #210

Closed
arielsalvo opened this issue Feb 20, 2016 · 10 comments
Assignees
Milestone

Comments

@arielsalvo
Copy link

Hi,

I have issue with using {kitchen_root_directory} as part of the instance name due to directories with the same name or producing instance names that are too long.

How about using a CRC32 of the full path?
It would make the instance name unique and shorter, getting the actual path would still be easy by running vagrant global-status and it should be quite easy to implement too.

Any thoughts?

@rlaveycal
Copy link

I'd like to +1 this as I've been battling a problem with the Hyper-V provider and path name exceeding the 260 character limit in Windows caused by the concatenation of cookbook, suite and platform. I'd also like to suggest that instance.name is CRC'ed to shorten the path further.

@cheeseplus
Copy link
Contributor

I closed the existing PR but will open a new one myself

@cheeseplus cheeseplus modified the milestones: 0.20.2, 0.21.3, 0.21.2 Jan 5, 2017
@cheeseplus cheeseplus modified the milestones: 0.21.3, 1.1.0 Feb 10, 2017
@cheeseplus cheeseplus self-assigned this Jul 26, 2017
@jkerry
Copy link

jkerry commented Aug 17, 2017

+1 here. We started running into numerous windows agent build failures after pushing an upgrade to chefdk 2.1.11

@cloneluke
Copy link

+1 encountered major issues launching vagrant from windows test-kitchen after chefdk 2.1

Also think it might have to do with this commit not allowing spaces in path name on line 429:

a946fb6#diff-746c6817cd7ffe8b6bd9acc333fa5852R429

@lamont-granquist
Copy link
Contributor

can you use or can test-kitchen be modified to use extended length paths with the "\?" prefix?

@jkerry
Copy link

jkerry commented Aug 18, 2017

I might be misunderstanding the question but the limit is really at the windows OS level. 260 characters is the max before the OS shuts you down.

@jkerry
Copy link

jkerry commented Aug 21, 2017

an example of a path generated too long for windows:
C:\Jenkins\workspace\PRTests\XXXXX_one-cookbook-pr\cookbooks\XXXXX_one\.kitchen\kitchen-vagrant\kitchen-XXXXX_one-default-windows-2012r2\kitchen-XXXXX_one-default-windows-2012r2_default_1503316491808_83138\kitchen-XXXXX_one-default-windows-2012r2_default_1503316491808_83138.vbox

@jkerry
Copy link

jkerry commented Aug 21, 2017

a substring or a digest on 1503316491808_83138 might be feasible. It looks like default made it into the path twice.

@robbkidd
Copy link
Contributor

robbkidd commented Aug 22, 2017

Could we omit kitchen-#{something_unique}- from the vagrant root entirely? That would yield:

C:\Jenkins\
workspace\
PRTests\
XXXXX_one-cookbook-pr\
cookbooks\
XXXXX_one\
.kitchen\
kitchen-vagrant\
default-windows-2012r2\
default-windows-2012r2_default_1503316491808_83138\
default-windows-2012r2_default_1503316491808_83138.vbox

One consequence: machines listed in the hypervisor would not have kitchen-#{something_unique}- prefixed in their names.

robbkidd added a commit that referenced this issue Aug 22, 2017
This omits "kitchen-#{something}" from the vagrant root directories that
will appear under .kitchen/kitchen-vagrant. 

Windows users will run into a path length limit of 260 characters.[1]
We have been repeating in the directory structure "kitchen-" and the
basename of kitchen-root--the directory that contains the .kitchen.yml
which most of the time works out to be the name of the cookbook being
tested. This made for meaningful if verbose names for virtual machines
so as to correlate a machine running in a Vagrant-supported hypervisor
to a test-kitchen config.

The inclusion of this string was _not_ for any unique identifier to
avoid naming collusions within the hypervisor. This change should be
safe for an upgrade for kitchens that have running instances prior to
upgrade. The state file for a machine that was successfully created will
have recorded the vagrant_root path used at creation time. This will
allow kitchen commands to continue to operate on the running instances.

[1] #210

Signed-off-by: Robb Kidd <[email protected]>
@robbkidd robbkidd self-assigned this Aug 22, 2017
@robbkidd
Copy link
Contributor

Proposed fix (omit kitchen-#{basename(kitchen_root)}- from vagrant_root) submitted over on #323.

robbkidd added a commit that referenced this issue Aug 22, 2017
This omits "kitchen-#{something}" from the vagrant root directories that
will appear under .kitchen/kitchen-vagrant. 

Windows users will run into a path length limit of 260 characters.[1]
We have been repeating in the directory structure "kitchen-" and the
basename of kitchen-root--the directory that contains the .kitchen.yml
which most of the time works out to be the name of the cookbook being
tested. This made for meaningful if verbose names for virtual machines
so as to correlate a machine running in a Vagrant-supported hypervisor
to a test-kitchen config.

The inclusion of this string was _not_ for any unique identifier to
avoid naming collusions within the hypervisor. This change should be
safe for an upgrade for kitchens that have running instances prior to
upgrade. The state file for a machine that was successfully created will
have recorded the vagrant_root path used at creation time. This will
allow kitchen commands to continue to operate on the running instances.

[1] #210

Signed-off-by: Robb Kidd <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants