Unable to remove new line character in pipeline?

Occasional Contributor

Team,

 

I have created this task 

 

 

- task: AzureCLI@1
displayName: 'Tag Prod Containers'
inputs:
azureSubscription: Production
scriptLocation: inlineScript
inlineScript: |
readarray -t images <<< $(grep -E 'repository|tag' $(Pipeline.Workspace)/values/higher-values.yaml|awk '{print $2}')
registry=$(awk -F. '{print $1}' <<< ${images[0]}|tr -d '\n')
kongingress=$(awk -F/ '{print $2}' <<< ${images[0]}|tr -d '\n')
kong=$(awk -F/ '{print $2}' <<< ${images[2]}|tr -d '\n')
echo "------------------"
sed -z 's/\n/ /g' <<< $(tr -d '\n' <<< ${images[2]})@${{ parameters.Digest_Id }}

sed -z 's/\\n/ /g' <<< $(tr -d '\n' <<< ${images[2]})@${{ parameters.Digest_Id }}
echo "------------------"

 

 

But output is always coming like this. A new line after kong word.

registry.azurecr.io/kong
@SHA256:12345678ccf100aafdda330e50f54b7514ab4d929cf123456789
 
Due to this always getting the error in az acr import command:
 
ERROR: (InvalidImportImageParameter) Invalid value
 
Any suggestions please.. Thanks. 
 
Regards,
Tanul
0 Replies