tobania / VSTS.Extension.SqlReportingServices

VSTS Extension for uploading SSRS Reports
MIT License
14 stars 20 forks source link

IncludeDataSource: false seems broken #62

Open rick-weyrauch-lol opened 3 years ago

rick-weyrauch-lol commented 3 years ago

I am not sure how "IncludeDataSource: false" is able to work for anyone. I am not a PowerShell expert, but when I look at this if:

if($IncludeDataSource -eq $true)

... it's not right since $IncludeDataSource is a string in the PS:

[string]$IncludeDataSource,

... and so both 'false' and 'true' -eq to $true, and causes the run to display this error (which actually makes sense based on the Write-Error code inside the if):

Uploading files
##[error]Microsoft.PowerShell.Commands.WriteErrorException: No file(s) matching the path/wildcard False were found
##[error]PowerShell script completed with 1 errors.
##########################################################
#                      Testing files                     #
##########################################################

    Write-Host "Uploading files" -NoNewline;
    #Get all Files using the $ReportFiles parameter (expecting it is a Wildcard or direct link to 1 file)
    $pathIsValid = Test-Path $ReportFiles;
    if($pathIsValid -eq $False){
        Write-Error "No file(s) matching the path/wildcard $ReportFiles were found";#NotFound 1
        exit -1;
    }

    if($IncludeDataSource -eq $true){
        $pathRdsIsValid = Test-Path $DataSourceLocalPath;
        if($pathRdsIsValid -eq $false){
            Write-Error "No file(s) matching the path/wildcard $pathRdsIsValid were found";#NotFound 1
            exit -1;
        }
    }

I need to be able to run without deploying Data Sources - any chance that can get fixed? Is this tool still being maintained?

rick-weyrauch-lol commented 3 years ago

On a side note - I also do not understand why having no files that match the pattern needs to be a fatal error - if I forget to deploy any matching files, then there is simply nothing for that section to do. The code could output a Warning I guess, but there should be nothing wrong with an empty file list. One could easily have conditional deployment steps that under unique circumstance renders no files... but then the tool would blow up the run.