I'm new to Azure Devops and yaml.
We have a CI/CD process running that deploys to Salesforce. As long as the deployment runs completely, the script interprets this as a success, even if the deployment returns an error result.
Current setup:
- script: |
        if [ $(setvarStep.PullRequest) = 'true' ]
            then
                echo 'DevOps Message -- Validation in Progress - Non Feature branch behavior'
                npx sfdx force:source:deploy  --checkonly --testlevel $(setvarStep.SalesforceTestLevel) --sourcepath $(salesforce.sourcepath) --targetusername $(salesforce.connectedApp.Alias)
        fi
What I'd like to do is capture the result in a variable and check for an error message in the result, and throw an error in the script, however, everytime I try to check for the error, the if block returns "no error found"
- script: |
        if [ $(setvarStep.PullRequest) = 'true' ]
            then
                echo 'DevOps Message -- Validation in Progress - Non Feature branch behavior'
                sfdxresult=$(npx sfdx force:source:deploy  --checkonly --testlevel $(setvarStep.SalesforceTestLevel) --sourcepath $(salesforce.sourcepath) --targetusername $(salesforce.connectedApp.Alias)) 
       if ($sfdxresult-like "*Component Failures*")
           then
               echo "found the error!"
           else 
               echo "no error found!"
            fi
        fi            
Any advice?
