I have an inline script as shown. The requirement is that there could be different variables that needs to be passed and those are secretive. In azure pipelines, we can use variable groups and encrypt them. The idea is used below. From the documentation(https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/bash-v3?view=azure-pipelines), arguments can be passed only if we write a shell script file, and execute the file through the task mentioned below.
However, the shell script file fails at the set -eufo pipefail
command and it throws the following error:
/home/vsts/work/1/s/script.sh: line 2: set: pipefail
: invalid option name
##[error]Bash exited with code '2'.
Hence, there is an inline script as below:
variables:
- group: ScheduledUpdate
steps:
- task: Bash@3
inputs:
targetType: 'inline'
arguments: '$(SOURCE_URL)'
script: |
#!usr/bin/sh
set -eufo pipefail
echo "Argument 1 is $1"
echo "done"
However, there is a failure with respect to passing arguments. I get the following error:
/home/pkapikad/myagent/_work/_temp/7dfddc0a-4a40-4235-9752-c1c0e136372c.sh: line 3: $1: unbound variable
##[error]Bash exited with code '1'.
Finishing: Bash
Why is this caused? How can be pass arguments to a inline script inside bash task in azure devops?