function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
AndrewTaylorAndrewTaylor 

Azure deployment failure

I have an pipeline running in Azure with a yaml file.

In one of our steps, we run the Salesforce deployment (validation only), but whether it is succsesful or not, the yaml file performs as a successful deployment.
 
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

I'm trying to catch this deployment now into a string, but unsure/unable to do a check to see if there's an error:
 
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 ($deploymentresult -like "*Component Failures*")
               then
                   echo "found the error!"
               else 
                   echo "no error found!"
                fi
                    
fi

The above always writes "no error found!"

Any advice?

 
AndrewTaylorAndrewTaylor
Above if block should be:
 
if ($sfdxresult -like "*Component Failures*")
               then
                   echo "found the error!"
               else 
                   echo "no error found!"
                fi