I am trying to run a bash script in my azure release pipeline. For this, I have used a task from the Visual Studio marketplace: https://marketplace.visualstudio.com/items?itemName=tsuyoshiushio.shell-exec
which will perform a sed operation to replace a value, shown below:
sed -e "s/##BUILD_ID##/${RELEASE_ARTIFACTS__myapp-EBX_BUILDID}/g" "$(System.DefaultWorkingDirectory)/myapp-ebx-acc-repo/myapp-ebx-acc-current.yaml"
I am running the release pipeline in azure devops server (self hosted agent)
Below are the logs from the azure pipeline:
2021-02-22T03:12:14.9277284Z ##[debug]Evaluating condition for step: 'Bash Script'
2021-02-22T03:12:14.9278320Z ##[debug]Evaluating: succeeded()
2021-02-22T03:12:14.9278426Z ##[debug]Evaluating succeeded:
2021-02-22T03:12:14.9278572Z ##[debug]=> True
2021-02-22T03:12:14.9278762Z ##[debug]Result: True
2021-02-22T03:12:14.9278943Z ##[section]Starting: Bash Script
2021-02-22T03:12:14.9436272Z ==============================================================================
2021-02-22T03:12:14.9436376Z Task : Bash
2021-02-22T03:12:14.9436456Z Description : Run a Bash script on macOS, Linux, or Windows
2021-02-22T03:12:14.9436521Z Version : 3.142.2
2021-02-22T03:12:14.9436564Z Author : Microsoft Corporation
2021-02-22T03:12:14.9436617Z Help : [More Information](https://go.microsoft.com/fwlink/?LinkID=613738)
2021-02-22T03:12:14.9436660Z ==============================================================================
2021-02-22T03:12:15.2650538Z ##[debug]agent.TempDirectory=C:\myapp2_agent\_work\_temp
2021-02-22T03:12:15.2652231Z ##[debug]loading inputs and endpoints
2021-02-22T03:12:15.2660837Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN
2021-02-22T03:12:15.2661297Z ##[debug]loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION
2021-02-22T03:12:15.2661699Z ##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION
2021-02-22T03:12:15.2662204Z ##[debug]loading INPUT_FAILONSTDERR
2021-02-22T03:12:15.2662567Z ##[debug]loading INPUT_FILEPATH
2021-02-22T03:12:15.2662926Z ##[debug]loading INPUT_SCRIPT
2021-02-22T03:12:15.2664273Z ##[debug]loading INPUT_TARGETTYPE
2021-02-22T03:12:15.2664641Z ##[debug]loading INPUT_WORKINGDIRECTORY
2021-02-22T03:12:15.2664991Z ##[debug]loaded 8
2021-02-22T03:12:15.2665341Z ##[debug]Agent.ProxyUrl=undefined
2021-02-22T03:12:15.2665681Z ##[debug]Agent.CAInfo=undefined
2021-02-22T03:12:15.2666034Z ##[debug]Agent.ClientCert=undefined
2021-02-22T03:12:15.2666379Z ##[debug]Agent.SkipCertValidation=undefined
2021-02-22T03:12:15.2680845Z ##[debug]check path : C:\myapp2_agent\_work\_tasks\Bash_6c731c3c-3c68-459a-a5c9-bde6e6595b5b\3.142.2\task.json
2021-02-22T03:12:15.2681523Z ##[debug]adding resource file: C:\myapp2_agent\_work\_tasks\Bash_6c731c3c-3c68-459a-a5c9-bde6e6595b5b\3.142.2\task.json
2021-02-22T03:12:15.2682033Z ##[debug]system.culture=en-US
2021-02-22T03:12:15.2686296Z ##[debug]failOnStderr=false
2021-02-22T03:12:15.2692171Z ##[debug]workingDirectory=C:\myapp2_agent\_work\r1\a
2021-02-22T03:12:15.2692661Z ##[debug]check path : C:\myapp2_agent\_work\r1\a
2021-02-22T03:12:15.2696560Z ##[debug]targetType=inline
2021-02-22T03:12:15.2699518Z ##[debug]script=sed -e "s/##BUILD_ID##/${RELEASE_ARTIFACTS__myapp-EBX_BUILDID}/g" "C:\myapp2_agent\_work\r1\a/myapp-ebx-acc-repo/myapp-ebx-acc-current.yaml"
2021-02-22T03:12:15.2745467Z Generating script.
2021-02-22T03:12:15.2747795Z ##[debug]which 'bash'
2021-02-22T03:12:15.2828359Z ##[debug]not found
2021-02-22T03:12:15.2831165Z ##[debug]task result: Failed
2021-02-22T03:12:15.2878275Z ##[error]Unable to locate executable file: 'bash'. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.
2021-02-22T03:12:15.2885718Z ##[debug]Processed: ##vso[task.issue type=error;]Unable to locate executable file: 'bash'. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.
2021-02-22T03:12:15.2900404Z ##[debug]Processed: ##vso[task.complete result=Failed;done=true;]Unable to locate executable file: 'bash'. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.
2021-02-22T03:12:15.2945778Z ##[section]Finishing: Bash Script
Error after adding the Exec Shell
2021-02-22T08:40:02.0724451Z ==============================================================================
2021-02-22T08:40:02.0724559Z Task : Shell Exec
2021-02-22T08:40:02.0724626Z Description : Execute shell commands without creating a shell file
2021-02-22T08:40:02.0724687Z Version : 0.2.0
2021-02-22T08:40:02.0724738Z Author : Tsuyoshi Ushio
2021-02-22T08:40:02.0724781Z Help : Replace with markdown to show in help
2021-02-22T08:40:02.0724824Z ==============================================================================
2021-02-22T08:40:02.3703799Z ##[debug]agent.workFolder=C:\myapp2_agent\_work
2021-02-22T08:40:02.3704912Z ##[debug]loading inputs and endpoints
2021-02-22T08:40:02.3705348Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN
2021-02-22T08:40:02.3705717Z ##[debug]loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION
2021-02-22T08:40:02.3706081Z ##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION
2021-02-22T08:40:02.3706415Z ##[debug]loading INPUT_CODE
2021-02-22T08:40:02.3716803Z ##[debug]loaded 4
2021-02-22T08:40:02.3740815Z ##[debug]Absolute path for pathSegments: C:\myapp2_agent\externals\git\cmd/bash = C:\myapp2_agent\externals\git\cmd\bash
2021-02-22T08:40:02.3752877Z ##[debug]Absolute path for pathSegments: C:\Program Files\Common Files\Oracle\Java\javapath/bash = C:\Program Files\Common Files\Oracle\Java\javapath\bash
2021-02-22T08:40:02.3753334Z ##[debug]Absolute path for pathSegments: C:\windows\system32/bash = C:\windows\system32\bash
2021-02-22T08:40:02.3754760Z ##[debug]Absolute path for pathSegments: C:\windows/bash = C:\windows\bash
2021-02-22T08:40:02.3756901Z ##[debug]Absolute path for pathSegments: C:\windows\System32\Wbem/bash = C:\windows\System32\Wbem\bash
2021-02-22T08:40:02.3760607Z ##[debug]Absolute path for pathSegments: C:\windows\System32\WindowsPowerShell\v1.0\/bash = C:\windows\System32\WindowsPowerShell\v1.0\bash
2021-02-22T08:40:02.3763009Z ##[debug]Absolute path for pathSegments: C:\windows\System32\OpenSSH\/bash = C:\windows\System32\OpenSSH\bash
2021-02-22T08:40:02.3766217Z ##[debug]Absolute path for pathSegments: C:\Program Files\Git\cmd/bash = C:\Program Files\Git\cmd\bash
2021-02-22T08:40:02.3768040Z ##[debug]Absolute path for pathSegments: C:\Users\tsiadm\Downloads/bash = C:\Users\tsiadm\Downloads\bash
2021-02-22T08:40:02.3769821Z ##[debug]Absolute path for pathSegments: C:\Program Files\Docker/bash = C:\Program Files\Docker\bash
2021-02-22T08:40:02.3771587Z ##[debug]Absolute path for pathSegments: F:\agentutility\apache-maven-3.6.3\bin/bash = F:\agentutility\apache-maven-3.6.3\bin\bash
2021-02-22T08:40:02.3773290Z ##[debug]Absolute path for pathSegments: C:\PROGRA~1\Java\jdk-15.0.2\bin/bash = C:\PROGRA~1\Java\jdk-15.0.2\bin\bash
2021-02-22T08:40:02.3776148Z ##[debug]Absolute path for pathSegments: C:\Users\PANDES04\AppData\Local\Microsoft\WindowsApps/bash = C:\Users\ADMPANDES04\AppData\Local\Microsoft\WindowsApps\bash
2021-02-22T08:40:02.3779987Z ##[debug]check path : null
2021-02-22T08:40:02.4326569Z (node:13088) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Failed which: Not found bash: null
2021-02-22T08:40:02.4406217Z ##[section]Finishing: shellexec