Add DEV_SERVER_USER credential handling in Jenkinsfile
Updated the Jenkinsfile to include a new credential for the development server user, enhancing the flexibility of user management during deployment. The SSH user variable now defaults to this new credential if available, improving security and maintainability.
This commit is contained in:
3
Jenkinsfile
vendored
3
Jenkinsfile
vendored
@@ -219,6 +219,7 @@ pipeline {
|
||||
steps {
|
||||
withCredentials([
|
||||
usernamePassword(credentialsId: 'harbor-credentials', usernameVariable: 'HARBOR_USERNAME', passwordVariable: 'HARBOR_PASSWORD'),
|
||||
string(credentialsId: 'dev-server-user', variable: 'DEV_SERVER_USER'),
|
||||
string(credentialsId: 'dev-server-host', variable: 'DEV_SERVER_HOST'),
|
||||
sshUserPrivateKey(
|
||||
credentialsId: 'dev-server-ssh',
|
||||
@@ -230,7 +231,7 @@ pipeline {
|
||||
def remote = [
|
||||
name: 'dev-server',
|
||||
host: env.DEV_SERVER_HOST,
|
||||
user: env.DEV_SERVER_SSH_USER,
|
||||
user: env.DEV_SERVER_USER ?: env.DEV_SERVER_SSH_USER,
|
||||
identityFile: env.DEV_SERVER_KEY,
|
||||
allowAnyHosts: true
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user