This might help you with your problem.
In the normal pipeline or any Jenkins job, we can define parameters which can be accessed via say
My solution for using environment variables in the Jenkins Multibranch Pipeline.
Scenario. Say you have a variable named VARIABLE whose value is
Create a secret text with id and description.
NOTE: In Jenkins, the secret text will be completely hidden.
NOTE: You can define it as you want. If left empty a random value will be assigned to it in the form as45f2sf-43rs-4sdf-s3f3-329f9bc9ae269
NOTE: Description for the variable.
Once this is created in your multibranch pipeline Jenkinsfile, you can add the following to access those variables whenever required.
SECRET_VARIABLE = credentials("VARIABLE")
echo "This is a secret variable: $SECRET_VARIABLE"
**PS: The variables will appear in a format