Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins export build number to file

Tags:

jenkins

I'm using the Export parameters plugin. I want to export the build number to a file.

I'm using string parameter:

jenkins-build
${BUILD_NUMBER}

Export to properties file using key:

jenkins-build

But the exported file does not update the build number. I get:

jenkins-build=${BUILD_NUMBER}

Do I need to do something else?

like image 773
En-Motion Avatar asked Dec 06 '25 03:12

En-Motion


1 Answers

Your configuration using these plugins should work if you manually input BUILD_NUMBER at the time of triggering a build. However, you may also use below build steps for your requirement.

Linux Platforms - Execute shell

echo "jenkins-build=$BUILD_NUMBER" > /path/to/file.properties

Shell

Windows Platform - Execute windows batch command

echo jenkins-build=%BUILD_NUMBER% > Drive:\path\to\file.properties

Batch

like image 175
Beginner Avatar answered Dec 09 '25 00:12

Beginner