You can use maskpasswods in declarative pipeline, you have to use wrapper step and place your scripts in the code block, however I recommend you to read this article https://support.cloudbees.com/hc/en-us/articles/203802500-Injecting-Secrets-into-Jenkins-Build-Jobs and use credentials and secrets to store your passwords
-- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/6565b53e-3035-4443-8702-bf199ebcff15%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.