- Install build-name-setter plugin https://plugins.jenkins.io/build-name-setter/
pipeline
{
agent any
stages
{
stage('Git-checkout')
{
steps
{
sh '''
rm -rf simple-storage-solution 2>&1
git clone https://github.com/initedit-project/simple-storage-solution.git
cd simple-storage-solution
git log -1 --pretty=format:"%s" > ../gitcommitmsg.txt
'''
script
{
def gitcommitmsg = readFile(file: 'gitcommitmsg.txt')
buildDescription gitcommitmsg
}
}
}
}
}
Output: