Thanks Jeff a lot.
Finally it worked. I was taking unnecessary difficult path.

Thanks again for your help.

Cheers,
Umesh

On Sat, Mar 23, 2013 at 3:18 AM, Ng, Jeff <jeff...@lmco.com> wrote:

>  Umesh,****
>
> ** **
>
> All you need to do is create a build step to write the string
> “product.version=YOUR-BUILD-NUM” to a file in the workspace (e.g.
> version.properties).  From your original post, I assume you already have
> (or know how to write) a script/batch file to parse out the “builddate”
> from your text file.  Just have the script print the string I mentioned and
> redirect ( > ) it to ${WORKSPACE}/version.properties.  The
> build-name-setter plugin will do the rest.****
>
> ** **
>
> -Jeff Ng****
>
> ** **
>
> *From:* jenkinsci-users@googlegroups.com [mailto:
> jenkinsci-users@googlegroups.com] *On Behalf Of *Umesh Padhye
> *Sent:* Wednesday, March 20, 2013 11:45 PM
>
> *To:* jenkinsci-users@googlegroups.com
> *Subject:* Re: EXTERNAL: Build name setting****
>
>  ** **
>
> Hi Jeff,
>
> This text file gets created at a particular location when I install my
> Application.
> So we can say its automatic.
>
> Umesh
>
> ****
>
> On Thu, Mar 21, 2013 at 1:36 AM, Ng, Jeff <jeff...@lmco.com> wrote:****
>
> How is the text file ABC.txt getting created (manually, script, etc.)?****
>
>  ****
>
> -Jeff Ng****
>
>  ****
>
> *From:* jenkinsci-users@googlegroups.com [mailto:
> jenkinsci-users@googlegroups.com] *On Behalf Of *Umesh Padhye
> *Sent:* Wednesday, March 20, 2013 1:27 PM
> *To:* jenkinsci-users@googlegroups.com
> *Subject:* Re: EXTERNAL: Build name setting****
>
>  ****
>
> Hello Jeff,
>
> I am new to Java as well as Jenkins. Please let me know how to write
> properties file from text file.
>
> Lets say I have text file ABC.txt, it has got 3 lines
>
> builddate, time stamp
> revision no.
> package id
>
> Now I want to extract and store 1st line till builddate only in the java
> property file
> which Jenkins can recognize.
> How to handle this writing of property file? Can you please explain?
>
> Thanks,
> Umesh
>
>
> ****
>
> On Thu, Mar 21, 2013 at 12:00 AM, Ng, Jeff <jeff...@lmco.com> wrote:****
>
> Here’s how I do it using the “build-name-setter” and “Post_build_task”
> plugins:****
>
>  ****
>
> The “build-name-setter” plugin can read a value from a property file in
> the workspace.  It reads it twice during a job run; first before any build
> tasks are executed, then again after all build tasks complete
> successfully.  My ant build generates our desired build name and writes it
> to a file named “version.properties” in the form
> “product.version=ACME-1.0_0052”.  That version.properties file actually
> gets used for our solaris packaging, but I have a build step that copies it
> to the jenkins workspace so that I can also use it to set the build name in
> jenkins so they match.****
>
>  ****
>
> 1.  Configure build-name-setter to read a property file.  “Build Name”
> field should have the following:****
>
>  ****
>
> ${PROPFILE,file=”version.properties”,property=”product.version”}****
>
>  ****
>
> NOTE:  The first time you run the job, the version.properties file will
> not yet exist in the workspace, so the job will fail since it can’t find
> the file.  No big deal since you will have a post-build task that will then
> create one for you (explained later).  If you don’t want the first build to
> fail because of this, simply create the version.properties file in the
> workspace (on every node it can run on) ahead of time with this:
> “product.version=BUILD_IN_PROGRESS”.  I’ve intended to try to find a plugin
> that can create the file in the workspace before the build-name-setter
> runs, but it hasn’t been a high enough priority for me yet.  ;-)****
>
>  ****
>
> 2.  After my ant build step, I created a build step that simply copies the
> version.properties file (generated from my ant build) to the ${WORKSPACE}.
> The build-name-setter will read that file again after all build steps
> complete successfully and set the build name.  Note that if any build steps
> fail, the build name will remain “BUILD_IN_PROGRESS” (pros and cons to
> that).****
>
>  ****
>
> 3.  Create a “Post build task” that will change the value of the
> “product.version” property back to “BUILD_IN_PROGRESS” for the next build.
> ****
>
>  ****
>
> Log text field:  version.properties****
>
> Script:  echo product.version=BUILD_IN_PROGRESS >
> ${WORKSPACE}/version.properties****
>
>  ****
>
> -Jeff Ng****
>
>  ****
>
> *From:* jenkinsci-users@googlegroups.com [mailto:
> jenkinsci-users@googlegroups.com] *On Behalf Of *Umesh Padhye
> *Sent:* Wednesday, March 20, 2013 8:07 AM
> *To:* jenkinsci-users@googlegroups.com
> *Subject:* EXTERNAL: Build name setting****
>
>  ****
>
> Hello,
>
> Below is my requirement.
> I am grabbing build date info from a text file for my application and I
> want to set that as build name in Jenkins.
> I tried approach of env var as build name.
> I was running few batch files to extract build info from text file and
> setting them as env var.
> But Jenkins nodes (one as win service and another as web slave agent) only
> recognize that env var if I reboot the system and nodes are relaunched.
>
> I want basically build name to be set dynamically checking the text file
> content continuously.
>
> Please help me how to achieve this.
>
> Umesh****
>
> --
> 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-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>  ****
>
> --
> 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/6wVJZtBQI1M/unsubscribe?hl=en
> .
> To unsubscribe from this group and all its topics, send an email to
> jenkinsci-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>  ****
>
>
>
>
> -- ****
>
> Thanks & Regards,****
>
>  ****
>
> Umesh C. Padhye****
>
>  ****
>
> Technology Specialist, ****
>
> CDU Geometry Testing****
>
> ANSYS Fluent India Pvt. Ltd.
> Direct: 91 20 66522693
> Website: www.ansys.com****
>
> --
> 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-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>  ****
>
> --
> 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/6wVJZtBQI1M/unsubscribe?hl=en
> .
> To unsubscribe from this group and all its topics, send an email to
> jenkinsci-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>  ****
>
>
>
>
> -- ****
>
> Thanks & Regards,****
>
>  ****
>
> Umesh C. Padhye****
>
>  ****
>
> Technology Specialist, ****
>
> CDU Geometry Testing****
>
> ANSYS Fluent India Pvt. Ltd.
> Direct: 91 20 66522693
> Website: www.ansys.com****
>
> --
> 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-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>  ****
>
> --
> 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/6wVJZtBQI1M/unsubscribe?hl=en
> .
> To unsubscribe from this group and all its topics, send an email to
> jenkinsci-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Thanks & Regards,

Umesh C. Padhye

Technology Specialist,
CDU Geometry Testing
ANSYS Fluent India Pvt. Ltd.
Direct: 91 20 66522693
Website: www.ansys.com

-- 
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-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to