Für Menschen, die nicht die obigen Arbeits ich die sshagent direkt Plugin verwendet bekommen konnte, die das tat Trick:
stage('tag build'){
checkout([
$class: 'GitSCM', branches: [[name: '*/master']],
userRemoteConfigs: [[credentialsId: 'git',
url: 'ssh://<ssh URL>']],
extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'targeted-dir']]
])
sshagent(credentials: ['<credentials ID.']){
dir('targeted-dir'){
sh("git config user.email '<email>")
sh("git config user.name '<user>.com'")
// deletes current snapshot tag
sh ("git tag -d ${PARAM_VERSION_NUMBER} || true")
// tags current changeset
sh ("git tag -a ${PARAM_VERSION_NUMBER} -m \"versioning ${PARAM_VERSION_NUMBER}\"")
// deletes tag on remote in order not to fail pushing the new one
sh ("git push origin :refs/tags/snapshot")
// pushes the tags
sh ("git push --tags")
}
}
}
Das ist interessant. Wie machst du Authentifizierung an der Fernbedienung (wie sendest du das Passwort)? – octavian