I'm very new to Jenkins
.
I'm using this built-in plugin to do Git Checkout
with my GitHub credentials, what I wanna achieve is somehow get the git commit id
as a variable so that I can use that commit id
on any build step of my pipeline.
I searched but couldn't find any documentation for this plugin.
pipeline {
agent any
stages {
stage('Git Checkout') {
steps {
git(
branch: 'dev',
credentialsId: 'Aniket-IN-Github',
url: 'https://github.com/ComputerReflex/ComputerReflex-Laravel-React.git'
)
# Want to get the commit id.
echo "Git Commit # ${GIT_COMMIT}"
}
}
}
}
Thank you so much in advance :)
you can use this after checkout ( kind of workaround)