h1990
h1990

Reputation: 155

Adding multiple commands under scripts stage in Azure YAML pipeline

I need to execute following commands in the project repo to a do a build

 echo Building Software/linux_framework
 source /opt/pkg/linux/settings.sh
 cd Software/linux_framework
 make images HARDWARE=../my_xsa/ BOARD=local

Snippet from my YAML file:

pool:
  name: Default

steps:
- script: echo Building Software/linux_framework
          source /opt/pkg/linux/settings.sh
          cd Software/linux_framework 
          make images HARDWARE=../my_xsa/ BOARD=local   
  displayName: 'Make Project'

When I run the build all 4 commands are just echoed on the terminal. How to execute them as separate commands in the same terminal session

Upvotes: 7

Views: 13807

Answers (1)

LoLance
LoLance

Reputation: 28086

Try something like this:

- script: |
    echo Building Software/linux_framework
    source /opt/pkg/linux/settings.sh
    cd Software/linux_framework
    make images HARDWARE=../my_xsa/ BOARD=local
  displayName: 'Make Project'

Pay attention to the difference between one-line script and multi-line script:

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

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

Upvotes: 16

Related Questions