
Create "Credentials" with type "Secret text". Fill in the ID and add a secret description optional.

Add the following to Jenkinsfile:
pipeline {
    agent none
    environment {
        MY_PASSWORD = credentials('my-secret-password')
    }
After that, you can use the variable "MY_PASSWORD", without fear that it will be shown in clear text.