How to use the same BUILD_NUM in two different jobs?

93 views
Skip to first unread message

djx...@gmail.com

unread,
Jun 26, 2013, 11:10:36 AM6/26/13
to jenkins...@googlegroups.com
I have two jobs in my jenkins, I should use the same BUILD_NUM in two different jobs. how can i do?

eg: job1 BUILD_NUM is 5, when i build job2 the job2's build num should be 6.

Thanks everyone.

k.thi...@comcast.net

unread,
Jun 26, 2013, 11:19:24 AM6/26/13
to jenkins...@googlegroups.com

Your questions seems a bit confusing.  Are you asking how you can make it so that the jobs are the same build number?

 

Or are you asking how you could make it so that job2 is always 1 build number higher than job1?


--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

djx...@gmail.com

unread,
Jun 26, 2013, 11:42:45 AM6/26/13
to jenkins...@googlegroups.com
i have an branch in git repository to fix bug, and coding new features in master branch.
my job1 is for branch build to verify bug. job2 is for master build.
i should change the version in every job. and the version is job's BUILD_NUM.
so i should use one BUILD_NUM between two jobs.
hao can i do?

在 2013年6月26日星期三UTC+8下午11时19分24秒,KT写道:

Benjamin Lau

unread,
Jun 26, 2013, 1:02:10 PM6/26/13
to jenkins...@googlegroups.com

You don't want to do this.  It's an extremely good practice to make sure that all build numbers are unique.

But if you want to do this anyway... I think there's a plugin which let's you explicitly set the build number. I use it to jump the build number up when I make major backward incompatible changes to my build process.

Ben

djx339

unread,
Jun 26, 2013, 1:06:05 PM6/26/13
to jenkinsci-users
can you tell me the plugin name? thanks
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-users/9VwoT8_5Moo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-use...@googlegroups.com.

Benjamin Lau

unread,
Jun 26, 2013, 1:16:18 PM6/26/13
to jenkins...@googlegroups.com

djx339

unread,
Jun 26, 2013, 1:17:50 PM6/26/13
to jenkinsci-users

Andrew Kujtan

unread,
Jun 26, 2013, 1:38:03 PM6/26/13
to jenkins...@googlegroups.com
I'm having an intermittent error in my builds because a war file the build generates seems to be in use by jenkins, exception shown below. When I navigate to the war file in the filesystem I can't delete it either. It seems that the Jenkins process has a lock on it, as I can only delete it after shutting down Jenkins.

Am I crazy?

Building in workspace D:\jenkins\jobs\Complete Build - Everything\workspace
Cleaning up D:\jenkins\jobs\Complete Build - Everything\workspace\build\scratch
Deleting D:\jenkins\jobs\Complete Build - Everything\workspace\build\scratch\lib
ERROR: Failed to update http://svn/vlpro/vlproprojects/trunk
org.tmatesoft.svn.core.SVNException: svn: E204900: D:\jenkins\jobs\Complete Build - Everything\workspace\build\scratch\lib\Root.war: The process cannot access the file because it is being used by another process.

at hudson.scm.subversion.UpdateWithCleanUpdater$TaskImpl$1.handleStatus(UpdateWithCleanUpdater.java:78)
at org.tmatesoft.svn.core.wc.SVNStatusClient$1.receive(SVNStatusClient.java:356)
at org.tmatesoft.svn.core.wc.SVNStatusClient$1.receive(SVNStatusClient.java:353)
at org.tmatesoft.svn.core.wc2.SvnReceivingOperation.receive(SvnReceivingOperation.java:78)
at org.tmatesoft.svn.core.internal.wc2.ng.SvnNgGetStatus.receive(SvnNgGetStatus.java:201)
at org.tmatesoft.svn.core.internal.wc2.ng.SvnNgGetStatus.receive(SvnNgGetStatus.java:22)
at org.tmatesoft.svn.core.internal.wc17.SVNStatusEditor17.sendUnversionedItem(SVNStatusEditor17.java:208)
at org.tmatesoft.svn.core.internal.wc17.SVNStatusEditor17.getDirStatus(SVNStatusEditor17.java:679)
at org.tmatesoft.svn.core.internal.wc17.SVNStatusEditor17.walkStatus(SVNStatusEditor17.java:575)
at org.tmatesoft.svn.core.internal.wc2.ng.SvnNgGetStatus.run(SvnNgGetStatus.java:123)
at org.tmatesoft.svn.core.internal.wc2.ng.SvnNgGetStatus.run(SvnNgGetStatus.java:22)
at org.tmatesoft.svn.core.internal.wc2.ng.SvnNgOperationRunner.run(SvnNgOperationRunner.java:20)
at org.tmatesoft.svn.core.internal.wc2.SvnOperationRunner.run(SvnOperationRunner.java:20)
at org.tmatesoft.svn.core.wc2.SvnOperationFactory.run(SvnOperationFactory.java:1235)
at org.tmatesoft.svn.core.wc2.SvnOperation.run(SvnOperation.java:291)
at org.tmatesoft.svn.core.wc.SVNStatusClient.doStatus(SVNStatusClient.java:360)
at hudson.scm.subversion.UpdateWithCleanUpdater$TaskImpl.preUpdate(UpdateWithCleanUpdater.java:66)
at hudson.scm.subversion.UpdateUpdater$TaskImpl.perform(UpdateUpdater.java:151)
at hudson.scm.subversion.WorkspaceUpdater$UpdateTask.delegateTo(WorkspaceUpdater.java:153)
at hudson.scm.SubversionSCM$CheckOutTask.perform(SubversionSCM.java:903)
at hudson.scm.SubversionSCM$CheckOutTask.invoke(SubversionSCM.java:884)
at hudson.scm.SubversionSCM$CheckOutTask.invoke(SubversionSCM.java:867)
at hudson.FilePath.act(FilePath.java:905)
at hudson.FilePath.act(FilePath.java:878)
at hudson.scm.SubversionSCM.checkout(SubversionSCM.java:843)
at hudson.scm.SubversionSCM.checkout(SubversionSCM.java:781)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1369)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:676)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:581)
at hudson.model.Run.execute(Run.java:1593)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:242)
Caused by: svn: E204900: D:\jenkins\jobs\Complete Build - Everything\workspace\build\scratch\lib\Root.war: The process cannot access the file because it is being used by another process.

at org.tmatesoft.svn.core.SVNErrorMessage.create(SVNErrorMessage.java:109)
... 34 more
Caused by: java.nio.file.FileSystemException: D:\jenkins\jobs\Complete Build - Everything\workspace\build\scratch\lib\Root.war: The process cannot access the file because it is being used by another process.

at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:86)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)
at sun.nio.fs.WindowsFileSystemProvider.implDelete(WindowsFileSystemProvider.java:268)
at sun.nio.fs.AbstractFileSystemProvider.delete(AbstractFileSystemProvider.java:103)
at java.nio.file.Files.delete(Files.java:1077)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at hudson.Util.deleteFile(Util.java:237)
at hudson.Util.deleteRecursive(Util.java:305)
at hudson.Util.deleteContentsRecursive(Util.java:202)
at hudson.Util.deleteRecursive(Util.java:296)
at hudson.scm.subversion.UpdateWithCleanUpdater$TaskImpl$1.handleStatus(UpdateWithCleanUpdater.java:74)
... 33 more
ERROR: Subversion update failed
java.io.IOException
at hudson.scm.subversion.UpdateUpdater$TaskImpl.perform(UpdateUpdater.java:207)
at hudson.scm.subversion.WorkspaceUpdater$UpdateTask.delegateTo(WorkspaceUpdater.java:153)
at hudson.scm.SubversionSCM$CheckOutTask.perform(SubversionSCM.java:903)
at hudson.scm.SubversionSCM$CheckOutTask.invoke(SubversionSCM.java:884)
at hudson.scm.SubversionSCM$CheckOutTask.invoke(SubversionSCM.java:867)
at hudson.FilePath.act(FilePath.java:905)
at hudson.FilePath.act(FilePath.java:878)
at hudson.scm.SubversionSCM.checkout(SubversionSCM.java:843)
at hudson.scm.SubversionSCM.checkout(SubversionSCM.java:781)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1369)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:676)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:581)
at hudson.model.Run.execute(Run.java:1593)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:242)
Caused by: hudson.scm.subversion.UpdaterException: failed to perform svn update
... 17 more
Caused by: org.tmatesoft.svn.core.SVNException: svn: E204900: D:\jenkins\jobs\Complete Build - Everything\workspace\build\scratch\lib\Root.war: The process cannot access the file because it is being used by another process.

at hudson.scm.subversion.UpdateWithCleanUpdater$TaskImpl$1.handleStatus(UpdateWithCleanUpdater.java:78)
at org.tmatesoft.svn.core.wc.SVNStatusClient$1.receive(SVNStatusClient.java:356)
at org.tmatesoft.svn.core.wc.SVNStatusClient$1.receive(SVNStatusClient.java:353)
at org.tmatesoft.svn.core.wc2.SvnReceivingOperation.receive(SvnReceivingOperation.java:78)
at org.tmatesoft.svn.core.internal.wc2.ng.SvnNgGetStatus.receive(SvnNgGetStatus.java:201)
at org.tmatesoft.svn.core.internal.wc2.ng.SvnNgGetStatus.receive(SvnNgGetStatus.java:22)
at org.tmatesoft.svn.core.internal.wc17.SVNStatusEditor17.sendUnversionedItem(SVNStatusEditor17.java:208)
at org.tmatesoft.svn.core.internal.wc17.SVNStatusEditor17.getDirStatus(SVNStatusEditor17.java:679)
at org.tmatesoft.svn.core.internal.wc17.SVNStatusEditor17.walkStatus(SVNStatusEditor17.java:575)
at org.tmatesoft.svn.core.internal.wc2.ng.SvnNgGetStatus.run(SvnNgGetStatus.java:123)
at org.tmatesoft.svn.core.internal.wc2.ng.SvnNgGetStatus.run(SvnNgGetStatus.java:22)
at org.tmatesoft.svn.core.internal.wc2.ng.SvnNgOperationRunner.run(SvnNgOperationRunner.java:20)
at org.tmatesoft.svn.core.internal.wc2.SvnOperationRunner.run(SvnOperationRunner.java:20)
at org.tmatesoft.svn.core.wc2.SvnOperationFactory.run(SvnOperationFactory.java:1235)
at org.tmatesoft.svn.core.wc2.SvnOperation.run(SvnOperation.java:291)
at org.tmatesoft.svn.core.wc.SVNStatusClient.doStatus(SVNStatusClient.java:360)
at hudson.scm.subversion.UpdateWithCleanUpdater$TaskImpl.preUpdate(UpdateWithCleanUpdater.java:66)
at hudson.scm.subversion.UpdateUpdater$TaskImpl.perform(UpdateUpdater.java:151)
... 16 more
Caused by: svn: E204900: D:\jenkins\jobs\Complete Build - Everything\workspace\build\scratch\lib\Root.war: The process cannot access the file because it is being used by another process.

at org.tmatesoft.svn.core.SVNErrorMessage.create(SVNErrorMessage.java:109)
... 34 more
Caused by: java.nio.file.FileSystemException: D:\jenkins\jobs\Complete Build - Everything\workspace\build\scratch\lib\Root.war: The process cannot access the file because it is being used by another process.

at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:86)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)
at sun.nio.fs.WindowsFileSystemProvider.implDelete(WindowsFileSystemProvider.java:268)
at sun.nio.fs.AbstractFileSystemProvider.delete(AbstractFileSystemProvider.java:103)
at java.nio.file.Files.delete(Files.java:1077)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at hudson.Util.deleteFile(Util.java:237)
at hudson.Util.deleteRecursive(Util.java:305)
at hudson.Util.deleteContentsRecursive(Util.java:202)
at hudson.Util.deleteRecursive(Util.java:296)
at hudson.scm.subversion.UpdateWithCleanUpdater$TaskImpl$1.handleStatus(UpdateWithCleanUpdater.java:74)
... 33 more

Richard Bywater

unread,
Jun 26, 2013, 3:13:36 PM6/26/13
to jenkins...@googlegroups.com
No Jenkins won't be scanning for your War file. Instead it's probably because of, what I deem broken, Windows locking of the file and not releasing it properly. 

Unfortunately I never discovered a way around it apart from moving to Linux :) Hopefully someone can help you out in fixing the issue.

Cheers
Richard.

Chris_W...@dell.com

unread,
Jun 26, 2013, 3:43:19 PM6/26/13
to jenkins...@googlegroups.com

To give an example, we have one master job which calls several other sub-jobs in a pipeline fashion. We use a build step in the master job which makes the calls below to set the build numbers of the sub-jobs to match the master job before it calls them:

 

"C:\Program Files (x86)\Curl\curl.exe" -d "nextBuildNumber=%BUILD_NUMBER%"  http://user:password@localhost:8080/job/SUB_JOB1/nextbuildnumber/submit"

"C:\Program Files (x86)\Curl\curl.exe" -d "nextBuildNumber=%BUILD_NUMBER%" "http://user:password@localhost:8080/job/SUB_JOB2/nextbuildnumber/submit"

 

Chris Williams

Dell | PG Release Engineering

 

 

From: jenkins...@googlegroups.com [mailto:jenkins...@googlegroups.com] On Behalf Of djx339

Sent: Wednesday, June 26, 2013 12:18 PM

________________________________________

Benjamin Lau

unread,
Jun 26, 2013, 3:48:55 PM6/26/13
to jenkins...@googlegroups.com
That's also a handy technique. :-)

I do the same thing but using the Parameterized trigger with a
generated properties list and Build Flow.

Ben

丁剑雄

unread,
Jun 27, 2013, 3:53:25 AM6/27/13
to jenkins...@googlegroups.com
I have solve the problem.
1. set the ssh config without password from node connect to master.
2. use commond "ssh hostname curl -d nextBuildNumber=$BUILD_NUMBER+1 http://user:password@JENKINS_URL/job/ANOTHER_JOB/nextbuildnumber/submit" when build begin.

thanks everyone.


2013/6/27 Benjamin Lau <benjami...@gmail.com>
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-users/9VwoT8_5Moo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-use...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages