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

Error when using validateNextMinor/NextMajor/Current in combination #3577

Open
PaulFurlet opened this issue Jun 12, 2024 · 4 comments
Open

Comments

@PaulFurlet
Copy link

Describe the issue
When I try to use Run-AlValidation with combination of -validateCurrent, -validateNextMinor and -validateNextMajor parameters, I get an error

Run-AlValidation : Cannot process argument transformation on parameter 'credential'. userName

Scripts used to create container and cause the issue

param (
    [String[]]$validationRequiredFor = ("dk"),
    [String]$validationRequiredWith = "NextMajor",
    [String]$appFileName = "c:\Development\app_1.0.0.1.app",
    [String]$oldAppFileName = "c:\Development\app_1.0.0.0.app"
)

Import-Module BCContainerHelper

$ValidateCurrent = $true
$ValidateMajor = $false
$ValidateMinor = $false
if ($validationRequiredFor -ne $null) {
    if ($validationRequiredWith -ne $null) {
        if ($validationRequiredWith -contains "NextMajor") {
            $ValidateCurrent = $false
            $ValidateMajor = $true
        }
        if ($validationRequiredWith -contains "NextMinor") {
            $ValidateCurrent = $false
            $ValidateMinor = $true
        }
        if ($validationRequiredWith -contains "Current") {
            $ValidateCurrent = $true
        }            
    }
    Run-AlValidation `
        -apps $appFileName `
        -previousApps  $oldAppFileName `
        -affixes "CUST" `
        -countries $validationRequiredFor `
        -validateCurrent $ValidateCurrent `
        -validateNextMinor $ValidateMinor `
        -validateNextMajor $ValidateMajor `
        -failOnError true
}

Full output of scripts

PS C:\Development> .\validate.ps1 -validationRequiredFor ("dk") -validationRequiredWith "NextMajor" -appFileName "c:\Development\app_1.0.0.1.app" -oldAppFileName "c:\Development\app_1.0.0.0.app"
BcContainerHelper version 6.0.18
BC.HelperFunctions emits usage statistics telemetry to Microsoft
Running on Windows, PowerShell 5.1.20348.2400
WARNING: The names of some imported commands from the module 'BCContainerHelper' include unapproved verbs that might make them less discoverable. To find the commands with unapproved verbs, run the Import-
Module command again with the Verbose parameter. For a list of approved verbs, type Get-Verb.
Run-AlValidation : Cannot process argument transformation on parameter 'credential'. userName
At C:\Development\validate.ps1:34 char:28
+         -validateNextMajor $ValidateMajor `
+                            ~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Run-AlValidation], ParameterBindingArgumentTransformationException
    + FullyQualifiedErrorId : ParameterArgumentTransformationError,Run-AlValidation

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context

  • does it happen all the time? yes, tried using non-variables or different order - all the same
  • did it use to work? do not know, started checking today
@PaulFurlet PaulFurlet changed the title Error when using validateNextMinor Error when using validateNextMinor/NextMajor/Current in combination Jun 12, 2024
@freddydk
Copy link
Contributor

ValidateCurrent, ValidateNextMinor, ValidateNextMajor and failOnError are switch parameters (not boolean)
According to PowerShell syntax, you need to add a colon (and remove the true):

    Run-AlValidation `
        -apps $appFileName `
        -previousApps  $oldAppFileName `
        -affixes "CUST" `
        -countries $validationRequiredFor `
        -validateCurrent:$ValidateCurrent `
        -validateNextMinor:$ValidateMinor `
        -validateNextMajor:$ValidateMajor `
        -failOnError

@PaulFurlet
Copy link
Author

Thanks for the answer.
So if just in case of necessity, we cannot validate against all versions in one run, have to make three separate calls.

@freddydk
Copy link
Contributor

No, you can run all 3 - you just had a powershell syntax error in your command.

@PaulFurlet
Copy link
Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants