I'm trying to use comparison of variables in workflow rule section. My job:
variables:
isDBExists: 0
compareValue: 0
job1:
stage: createVar
script:
- Import-Module C:\SqlServer.21.1.18221\sqlserver
- $isDBExists = Invoke-sqlcmd -Query "SELECT 1" -ConnectionString $CONNSTR | format-table -property column1 -HideTableHeaders
- $compareValue = Invoke-sqlcmd -Query "SELECT 1" -ConnectionString $CONNSTR | format-table -property column1 -HideTableHeaders
- $isDBExists = [int]($isDBExists | Out-String).Trim()
- $compareValue = [int]($compareValue | Out-String).Trim()
job2:
stage: compare
tags:
- ps
script:
- Import-Module C:\SqlServer.21.1.18221\sqlserver
- Invoke-Sqlcmd -ConnectionString $CONN -InputFile $script
rules:
- if: $isDBExists == $compareValue
when: on_success
Why $isDBExists and $compareValue are not equial? I tried to compare by strings, checked the data types with the gettype() function, checked the values, they are equal in powershell. Thanks