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

RequiredModulesDirectory Override Parameter in build.ps1 not working #176

Open
beardjo opened this issue Jul 13, 2022 · 3 comments
Open

Comments

@beardjo
Copy link

beardjo commented Jul 13, 2022

Problem description

When trying to use the RequiredModulesDirectory parameter to override the default location of the RequireModules folder (output/RequiredModules) the path passed in never gets populated with the RequiredModule files, they continue to land in output/RequiredModules.

Verbose logs

No logs, just the resultant RequiredModules files are in the wrong place during build.

How to reproduce

Launch the build as follows:
.\build.ps1 -ResolveDependency -RequiredModulesDirectory RequiredModules

Expected behavior

RequiredModules files should end up in ./RequiredModules.

Current behavior

RequiredModules files currently end up in the default location of./output/RequiredModules.

Suggested solution

Add Target parameter to the Invoke-PSDepend call as follows:

    if (Test-Path -Path $DependencyFile)
    {
        $psDependParameters = @{
            Force = $true
            Path  = $DependencyFile
            Target = $PSDependTarget
        }

        # TODO: Handle when the Dependency file is in YAML, and -WithYAML is specified.
        Invoke-PSDepend @psDependParameters
    }

Operating system the target node is running

OsName               : Microsoft Windows 10 Enterprise
OsOperatingSystemSKU : EnterpriseEdition
OsArchitecture       : 64-bit
WindowsVersion       : 2009
WindowsBuildLabEx    : 19041.1.amd64fre.vb_release.191206-1406
OsLanguage           : en-US
OsMuiLanguages       : {en-US}

PowerShell version and build the target node is running

Name                           Value
----                           -----
PSVersion                      5.1.19041.1682
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.1682
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Module version used

0.7.0 (latest)
@gaelcolas
Copy link
Member

that parameter changes where it looks for them. The RequiredModules.psd1 defines where to save them.

@beardjo
Copy link
Author

beardjo commented Jul 13, 2022

Ok thanks...I guess I don't see the point of the -RequiredModulesDirectory parameter then.

@beardjo
Copy link
Author

beardjo commented Jul 13, 2022

I tried your suggestion and changed the path for the output in RequiredModules.psd1.

Everything seems to work until the build tries to compress the modules:

ERROR: Cannot validate argument on parameter 'Name'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command 
again.
At C:\Users\beardjo\repos_local\BECU.DSCDatum.POCLocal\RequiredModules\DscBuildHelpers\0.2.1\DscBuildHelpers.psm1:367 char:27
+         $AllDscResource = Get-DscResource
+                           ~~~~~~~~~~~~~~~
At C:\Users\beardjo\repos_local\BECU.DSCDatum.POCLocal\RequiredModules\Sampler.DscPipeline\0.2.0\tasks\CompressModulesWithChecksum.build.ps1:35 char:1
+ task CompressModulesWithChecksum {
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Build FAILED. 11 tasks, 1 errors, 0 warnings 00:12:05.8890476
Get-DscResource : Cannot validate argument on parameter 'Name'. The argument is null or empty. Provide an argument that is not null or empty, and then try 
the command again.
At C:\Users\beardjo\repos_local\BECU.DSCDatum.POCLocal\RequiredModules\DscBuildHelpers\0.2.1\DscBuildHelpers.psm1:367 char:27
+         $AllDscResource = Get-DscResource
+                           ~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Get-DscResource], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Get-DscResource

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

No branches or pull requests

2 participants