In my project, we have requirement like, after testing reports will be generated. That reports need to be send to particular person who did the SVN commit though Jenkins email trigger.
I spent lot of hours to resolve this, could anyone suggest me how to do this?
Thanks in advance!
PierreBtz
(Pierre Beitz)
January 23, 2023, 4:59pm
2
Hello, what did you try? What did happen? Sharing a sample of your work would help people stirring you in the right direction.
1 Like
I will share the script below which am trying out
def filePath = “C:\Users\MuraliR\Desktop\jenkins_test\DevOps_branch\Reports”
def usernameVariable = “USERNAME”
def passwordVariable = “PASSWORD”
pipeline{
agent any
environment{
USERNAME = credentials(‘SVN_user’)
PASSWORD = credentials(‘SVN_pass’)
}
parameters{
booleanParam( name: ‘SVN_Commit’, defaultValue: false, description: ‘Please Check the box to commit the reports to SVN repo’)
string(name: ‘Commit_Message’, defaultValue: ‘Committing reports’, description: ‘Enter commit message’)
}
stages{
stage(‘Checkout’){
steps{
checkout([$class: ‘SubversionSCM’,
additionalCredentials: ,
excludedCommitMessages: ‘’,
excludedRegions: ‘’,
excludedRevprop: ‘’,
excludedUsers: ‘’,
filterChangelog: false,
ignoreDirPropChanges: false,
includedRegions: ‘’,
locations: [[cancelProcessOnExternalsFail: true,
credentialsId: ‘SVN_CREDS’,
depthOption: ‘infinity’,
ignoreExternalsOption: true,
local: ‘.’,
remote: ‘http://192.168.14.80/svn/jenkins_test/DevOps_branch/Unit1 ’]],
quietOperation: true,
workspaceUpdater: [$class: ‘UpdateUpdater’]])
}
}
stage(‘SVN_Commit’){
when {
expression { params.SVN_Commit == true }
}
steps{
script {
// Check if the files exist in the specified file path
if (fileExists(“${filePath}”)) {
// Add the files to SVN
bat “svn add ${filePath} --force”
// Commit the files to SVN
bat “svn commit --username ${USERNAME} --password ${PASSWORD} -m ‘${params.Commit_Message}’ ${filePath}”
} else {
echo “Files do not exist in the specified file path. Commit skipped.”
}
}
}
}
}
}
this script is executing successfully but after svn commit stage file is not checkin to the SVN from jenkins workspace.