Forum Discussion

Sai_Bellam's avatar
Sai_Bellam
Copper Contributor
Nov 19, 2021

Decorator skipping not working

I developed a decorator based on Microsoft documentation. The injecting part is working as expected and the skipping part is not working as expected. i tried it multiple times, in different ways according  to documentation provided by Microsoft and the injected decorator is not getting skipped.

 

Below is the method i followed from documentation. There is not enough documentation on capturing the decorator logs can you please advise.

 

steps:

- ${{ if ne(variables['skipInjecting'], 'true') }}:

  - script: echo Injected the decorator

 

and in the pipeline i added the variables

 

variables:

  skipInjecting: true

    steps:

     - script: echo This is the only step. No decorator is added.

 

I used the same syntax from the Microsoft Documentation.  somehow i don't see the decorator getting skipped.

 

Can you please advise?

 

Thanks

Sai

  • Sai_Bellam's avatar
    Sai_Bellam
    Copper Contributor
    can you please help me getting this decorator skipper fixed.
    when i match the command line task from the decorator pipeline to the one in pipeline.yaml file. it is skipping, once i remove the command it is not working.

    Please find the decorator.yaml and pipeline.yaml below.
    steps:
    - ${{ if ne(variables['skipInjecting'], 'true') }}:
    - script: echo "$(variables['skipInjecting'])"
    - bash: echo This is the Bash task
    - task: PowerShell@2
    inputs:
    targetType: inline
    script: echo "$(variables['skipInjecting'])"
    - task: ADOSecurityScanner@1
    inputs:
    OrgName: '$(System.CollectionUri)'
    ProjectNames: '$(System.TeamProject)'
    ScanFilter: 'All'


    trigger:
    - master

    pool:
    vmImage: ubuntu-latest

    variables:
    skipInjecting: 'true'

    steps:
    - script: echo This is the only step. No decorator is added.

    - script: echo Hello, world!
    displayName: 'Run a one-line script'

    - script: |
    echo Add other tasks to build, test, and deploy your project.
    echo See https://aka.ms/yaml
    displayName: 'Run a multi-line script'

    - task: CmdLine@2
    task: PowerShell@2
    inputs:
    targetType: inline
    script: echo "$(variables['skipInjecting'])"

    can you please help in getting this fixed.

Resources