After pushing to git I want Jenkins to build and deploy the new version of my software (docker image) to a staging environment immediately.
I can make it work but I feel there should be a better way of doing this, especially pulling and running the docker image on the staging server.
How I do it now:
The problems with this (those that I see, there are probably more)
You can use the Jenkins credentials store directly. Just create a credential with the username and password and add this to your pipeline.
withCredentials([usernamePassword(credentialsId: '<credentials-id>', passwordVariable: 'password', usernameVariable: 'username')]) {
sh "docker login -u $username -p $password ..."
}
It will hide the password automatically.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.