I want to write if condition that satisfies below:
- running axe analysis should be set to true
- Build reason should be pull request
- source branch should be develop branch (when the user select any other branch[ ex:release] axe should not run)
- custom tag value should not be null
i tried with the below conditions
- ${{ if or(eq(parameters.axe_flag, true) , eq(variables['Build.Reason'], 'PullRequest')) }}:
- ${{ if and(not(eq(parameters.cust_tagName, 'null' )) ,startsWith(variables['Build.SourceBranch'], 'refs/heads/develop')) }}:
condition: and(succeeded(), or(startsWith(variables['Build.SourceBranch'], 'refs/heads/develop'), startsWith(variables['Build.SourceBranch'], 'refs/heads/release/'), startsWith(variables['Build.SourceBranch'], 'refs/heads/develop-map')))
Multiple if conditions are not working. keep getting below error
Exactly 1 parameter(s) were expected following the directive 'if'. Actual parameter count: 2
/templates/build.yml@templates (Line: 40, Col: 3): Unexpected value '${{ if or(eq(parameters.sonarqube_flag, true) , eq(variables['Build.Reason'], 'PullRequest')), and(not(eq(parameters.cust_tagName, 'null' )) ,startsWith(variables['Build.SourceBranch'], 'refs/heads/develop')) }}'
/templates/build.yml@templates: (Line: 46, Col: 14, Idx: 1828) - (Line: 46, Col: 14, Idx: 1828): Mapping values are not allowed in this context.
first if statement with or condition works perfectly without errors when i add the second if statement with and condition, keep getting the below error. Any advise on how to handle multiple conditions would be really helpful. Thanks in advance.