rdagumampan / yuniql-azure-pipelines-tasks

Tasks for running YUNIQL natively on Azure Release Pipelines
0 stars 0 forks source link

##[error]Path must be a string. Received undefined #4

Open fakhrulhilal opened 3 years ago

fakhrulhilal commented 3 years ago

I'm having error ##[error]Path must be a string. Received undefined which I don't understand the cause. I thought it's about missing yuniql tool, but it doesn't help when I install yuniql.cli manually. Here's my config:

- task: DotNetCoreCLI@2
  displayName: 'Install yuniql'
  inputs:
    command: 'custom'
    custom: 'tool'
    arguments: 'install -g yuniql.cli --add-source https://api.nuget.org/v3/index.json --ignore-failed-sources --version $(YuniqlVersion)'
    workingDirectory: $(DBcheckoutPath)
- task: RunYuniqlCLI@1
  displayName: 'Deploy DB'
  inputs:
    autoCreateDatabase: true
    version: '$(YuniqlVersion)'
    targetVersion: 'latest'        
    additionalArguments: '--environment dev'
    targetPlatform: sqlserver
    workspacePath: $(DBcheckoutPath)
    connectionString: 'Data Source=$(DBServer);Password=$(DBPassword);Persist Security Info=True;User ID=$(DBUser);Initial Catalog=$(DbNameGenerator.DBName);'
    tokenKeyValuePair: 'Dummy=Test'

And this's the error log detail:

Starting: Deploy DB
==============================================================================
Task         : Run yuniql
Description  : Runs database migrations with Yuniql CLI using version acquired from Use Yuniql task.
Version      : 1.190.0
Author       : Rodel E. Dagumampan
Help         : https://yuniql.io/docs/migrate-via-azure-devops-pipelines/
==============================================================================
yuniql/input_version: latest
yuniql/input_workspacePath: D:\ws\2\db
yuniql/input_connectionString: Data Source=(local);Password=***;Persist Security Info=True;User ID=sa;Initial Catalog=APItest_3a7cbf864df541e88230dd1e6d586b5d;
yuniql/input_targetPlatform: sqlserver
yuniql/input_autoCreateDatabase: true
yuniql/input_targetVersion: latest
yuniql/input_tokenKeyValuePair: Dummy=Test
yuniql/input_delimiter: ,
yuniql/input_additionalArguments: --environment dev
yuniql/var_osPlat: win32
yuniql/var_osArch: x64
yuniql/error: Path must be a string. Received undefined
##[error]Path must be a string. Received undefined
Finishing: Deploy DB
johansandblom commented 3 years ago

A shot in the dark here since I'm not using the YAML version of Yuniql in Azure. I hade the exactly same error message when I forgot to install Yuniql and as far as I can deduce this is related to the Yuniql task trying to locate the executable https://github.com/rdagumampan/yuniql-azure-pipelines-tasks/blob/0fb660eb3880b900f4d946e6a070455ee3817ebf/src/run/runyuniql.ts#L46

Try installing Yuniql via the dedicated task as described here:

- task: UseYUNIQLCLI@1
  inputs:
    version: 'latest'
rdagumampan commented 3 years ago

@fakhrulhilal @johansandblom, thanks for reaching out and thanks for the suggested solution. It surprises me that many people find the yaml pipelines helpful and appreciate the feeedback. Yes, the pipelines tasks expects the specific yuniql version installed in a dedicated tools directory of the build agent. This is just how custom pipelines tasks works. If you wish to run pure CLI based, you can very well do so by calling dotnet install and yuniql run on two Command Line tasks. HTH/Rodel - Maintainer