I am new to shell and groovy and I have already googled and read solutions below, but none of it seems to be working
Groovy parameter to shell script Pass groovy variable to shell script read file to variable shell script How to pass a groovy variable to a shell block jenkins How to pass groovy variable to shell script in Jenkinsfile?
Issue: I want to read value from the groovy variable and pass it to shell script but either I get blank value or the literal variable name
Below is my code:
        def Tenant_Instances = ''
       //some more declarations and code
          if(tenant_created)
            {
  Tenant_Instances = "author.${ciTenant}.rally-dev.com,publish.${ciTenant}.rally-dev.com"
       println("tenant instance are -"+Tenant_Instances) //value coming fine here
                //some code here
           println("tenant instance again are -"+Tenant_Instances) //values coming fine here too
                  
                         sh '''#!/bin/bash
                                echo "[MNR] - Beginning deployment of bundle(s) to AEM Package Manager"
                                
                                IFS="," read -ra INSTANCES <<< $Tenant_Instances
                                echo "demo ${INSTANCES}" -->here value does not come properly
I have tried replacing Tenant_Instances with 'Tenant_Instances' or "${Tenant_Instances}" or $Tenant_Instances or '$Tenant_Instances'... but none of it seem to work.