effortless icon indicating copy to clipboard operation
effortless copied to clipboard

[Tracking]Windows issue with build config when config folder present in user plan

Open TheLunaticScripter opened this issue 5 years ago • 5 comments

This is an issue with the Invoke-BuildDefaultConfig. Right now we are building the config files as part of the Invoke-BuildDefaultService. We are creating a config directory in the expected place but when Habitat's build service runs it attempts to run a Copy-Item "$PLAN_CONTEXT/config" $pkg_prefix -Recurse and there is already a config directory at $pkg_prefix. There are two ways to fix this in the user plan. The first is to delete the config folder. The second is to override the Invoke-BuildConfig and only copy the individual config files that are in the user's config directory. Instead, it would be better to move the config build to the Invoke-BuildDefaultConfig so that there is no conflict and still preform the recursive copy.

TheLunaticScripter avatar Jul 31 '19 14:07 TheLunaticScripter

@TheLunaticScripter cloud the override in your second option be handled in the users plan.ps1 or is this something we need to fix on the backend. For my current engagement this is effecting our builds which currently we need to use the confign folder for but, cannot build successfully. If it's something on the backend, is there a workaround that doesnt involve deleting the folder?

sam1el avatar Aug 18 '19 14:08 sam1el

@sam1el Yes the override is in the user plan you just need to add this function

function Invoke-BuildConfig {
    Write-BuildLine "Writing configuration"
    if (Test-Path "$PLAN_CONTEXT/config/bootstrap-inspec.json") {
        Copy-Item "$PLAN_CONTEXT/config/bootstrap-inspec.json" "$pkg_prefix/config/bootstrap-inspec.json"
    }
}

You can change out the bootstrap-inspec.json to be whatever you need it to be but this is only a problem on Windows.

TheLunaticScripter avatar Aug 19 '19 13:08 TheLunaticScripter

Great. I have about 1200 or so windows boxes i'm working with. Will test this out today.

sam1el avatar Aug 19 '19 14:08 sam1el

Test that this still exists with 0.14.0

TheLunaticScripter avatar Aug 20 '19 15:08 TheLunaticScripter

Propose fix to the habitat windows plan build do be similar to https://github.com/habitat-sh/habitat/blob/master/components/plan-build/bin/hab-plan-build.sh#L1989

TheLunaticScripter avatar Aug 20 '19 15:08 TheLunaticScripter