skip to Main Content

I have deploy.sh file in my azure repository and i need to execute this deploy.sh file from azure pipeline.

enter image description here

Here is the steps that i defined in pipeline. I tried two ways to do it through cmd and bash, both are not picking the right location of deploy.sh file

enter image description here

Here is the error i am getting:

This is the error from CMD, but CMD shows green even though path is not correct

enter image description here

This is the error for bash

enter image description here

Question

How to correct the path and do successful execution of deploy.sh?

2

Answers


  1. Chosen as BEST ANSWER

    This solved my issue

      - task: CmdLine@2
        inputs:
          script: |
            echo Write your commands here
            cd $(Build.Repository.Name)/Orchestration/dev/
            chmod +x deploy.sh
            ./deploy.sh      
            echo deploy.sh execution completed
    

  2. You should never hard code the path of the pipeline run. Instead you should use the predefined variables that will automatically pick the build ID and also path. For your case you will need the

    $(Pipeline.Workspace)/s/Orchestration/dev/deploy.sh
    

    If you have multiple repositories checkout you should also use the name of the repository like

    $(Pipeline.Workspace)/s/dotnetpipeline/Orchestration/dev/deploy.sh
    

    $(Pipeline.Workspace)/s should be also replaced by $(Build.SourcesDirectory)

    The predefined variables should follow the $(var) notation on the .YML file

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search