From: Rollo, D. <DRollo@ETS.ORG> - 2007-08-23 15:39:08
|
Now I'm sure I'm getting confused. Maybe we should start sharing small conf= ig.xml examples (this stuff is always so hard to communicate...). Any attempt to use the agent props (user-defined.properties) for other purp= oses will likely be messy as that's not what the agent props are intended f= or. That said, I'd still like to better understand your use case to see if = there's some other feature we're lacking, or if there's some other solution= possible with the current code. My thought was to setup "projects" in config.xml in such a way that you can= be sure no two projects with the same IPXXX values will be run concurrentl= y=2E This is where I'm not sure I understand your case, 'cause I'm still no= t sure how to set that up. Keep in mind that with CC in multi-threaded mode= , you can be certain that a single Project will NEVER be running at the sam= e time in two different threads. Trying to help, but missing the mark I think, Dan -----Original Message----- From: Jerome Hourquebie [mailto:jho...@nd...]=20 Sent: Thursday, August 23, 2007 5:34 AM To: Rollo, Dan Cc: cru...@li... Subject: Re: [Cruisecontrol-user] Using agent property in task? Hi Dan, You seems to have understood what I want to do, but there is something that= worry me with your approach. Perhaps I haven't been clear enough. The agent property IPXXXX isn't used t= o select agent with different capabilities but to give more information to = the build.xml on the agent environment. I'm going to take a little example: - 5 BUILDS -> 5 TESTS. Each BUILD and TEST are managed by a different CC pr= oject (10 projects). I won't talk about the BUILD anymore which are managed by a specific agent. - 3 server to run tests: IP0001, IP0002 & IP0003 -> 3 agents to manage each= IPXXXX but all agent are not run on IPXXXX (they are on another specific m= achine because we couldn't run agent on IPXXXX) Each TEST (TEST1, TEST2 ...), can be run indifferently on any IPXXXX. Each agent knows its associated IPXXXX so, I ensure that all IPXXXX will wo= rk if any TEST are queued. Now if I define the IPXXXX parameter directly in the CC project. Ex.: TEST1 <-> IP0001 TEST2 <-> IP0002 TEST3 <-> IP0003 TEST4 <-> IP0001 TEST5 <-> IP0002 With 3 agents, I could have in queue: TEST1, TEST2, TEST3, TEST4, TEST5=20 -> it is fine all should be well run. But If I have this configuration: TEST1, TEST4, TEST2, TEST5, TEST2 -> agent1 run TEST1 on IP0001 while agent2 run TEST4 on IP0001 I will have a c= onflict because a IPXXXX can only run a test at a time.=20 It is the reason why I want the agent to give this information to the build= .xml. Is this what I thought to do or did I misunderstood something? Thanks, Jerome. Rollo, Dan a =E9crit : > OK, I think I'm getting a clearer picture: For each agentXXX, you have a = single instance of a server (IPXXX), and you want the build on agentXXX (an= d only the build on agentXXX) to call IPXXX. > > The problem is the user-defined.properties are only available to the Buil= dAgent, and are intentionally decoupled (not available) to the Builder that= a given agent might run. Typically, any agent can execute any Builder (ass= uming the entries in config.xml for that Builder config match the set of Ag= ent entries defined in user-defined.properties). > > It sounds like the key requirement is that a given instance of IPXXX is o= nly called by one build at a time. If so, another approach is to configure = multiple "Projects" (one per IPXXX). The build in each projectXXX would be = configured to call a specific IPXXX. If this is practical/possible, it allo= ws any available Agent to run a build. This allows many more concurrent bui= lds, and even allows you to build more projectXXX's than you have agents.=20 > > This is were I was thinking the "projectname" property that is available = to the running build might be useful to ensure that build calls the correct= IPXXX. > > With this approach, config <distributed> "entries" and=20 > user-defined.properties can still be used to group/categorize/match=20 > agents that have specific environmental differences. (IE: if=20 > project001 to project005 need agents configured for access to IP001 to=20 > IP005, and project006-009/IP006-IP009 need agents with different=20 > capabilities...) > > Dan > > -----Original Message----- > From: Jerome Hourquebie [mailto:jho...@nd...] > Sent: Wednesday, August 22, 2007 11:40 AM > To: Rollo, Dan > Subject: Re: [Cruisecontrol-user] Using agent property in task? > > Hi Dan, > > Yes, you have understood what I want to do. As you said, I managed to do = it in the build.xml while using an environment var with the path of the age= nt directory. > I use this script to start the agent: > > set AGENTROOTDIR=3D%CD% > C:\CC\ant\bin\ant.bat > > And I use this in the build.xml: > > <property environment=3D"env"/> > <property=20 > file=3D"${env.AGENTROOTDIR}/conf/user-defined.properties"/> > > But it is a bit restricting. If the config.xml is parsed on the master, p= erhaps I could copy all user-defined.properties agent file in a directory o= f the master and use the properties file of the agent which will execute th= e build.xml. > I think about something like this: > Somewhere in a directory I copy/rename all user-defined.properties=20 > agent file .../conf/agent1-user-defined.properties > .../conf/agent2-user-defined.properties > .../conf/agent3-user-defined.properties > .../conf/agent4-user-defined.properties > > And in the config.xml: > <property=20 > file=3D".../conf/${agent.name}-user-defined.properties"/> > > Could you tell me if such thing is possible? > > I haven't understood how the projectname property could help me. I don't = want the agent to act in a different way according to the projectname, but = I want to modify the way the build.xml will be run according to the agent p= roperties. It would be very useful: > - we could echo the agent name which did the job (it s easier to=20 > debug, sometime the build is ok on a server but not on another one...) > - we could specify different tools path (the configuration of the=20 > agent machine could be different from one another) > - and what is the most important for me: we can manage several resources = at the same time. my IPXXXX property contains the address of the server whi= ch will do the job (one server can only to a job at a time). I create as ma= ny agent as IPXXXX and I am sure that I won't have any unused IPXXX serve= r if some job are in the queue. > > Thanks a lot for your help Dan, > > Jerome. > > > Rollo, Dan a =E9crit : > =20 >> Hi Jerome, >> >> Just to make sure I understand: >> You want to access values defined in user-defined.properties during the = execution of an Ant build on a BuildAgent, correct? >> >> The config.xml is completely parsed on the master (and a fully instantia= ted AntBuilder java object is passed to the Agent). Also, any "entries" def= ined in the config.xml are only used for finding matching agents, and are n= ot available to the Builder object when executing on the Agent. >> >> That said, could you use the ant build.xml file with a <property file=3D= "[path to agent conf]/user-defined.properties"/> tag to load the settings y= ou need into the ant build? (Which is maybe what you're already doing...). = BTW, the "projectname" property (not "project.name") is available in the an= t build by default (http://cruisecontrol.sourceforge.net/main/configxml.htm= l#schedule - Properties Passed to Builders), which may be useful also. >> >> Sorry if I've missed the point, and please do explain further if I'm off= track. >> >> Dan >> >> -----Original Message----- >> From: Jerome Hourquebie [mailto:jho...@nd...] >> Sent: Wednesday, August 22, 2007 4:38 AM >> To: Rollo, Dan >> Cc: cru...@li... >> Subject: Re: [Cruisecontrol-user] Using agent property in task? >> >> Hi Dan, >> >> No there is no value set in config.xml, I wanted to retrieve some values= from the user-defined.properties file used by an agent. >> I have many different agents on the same machine with their own director= y and own user-defined.properties file. >> I hope that the config.xml file would be parsed by the agent and not the= master. >> I have found a solution I doesn't like very much: >> >> I use a script to run the agent and before starting it, I put the agent = directory path in an environment vars. >> Doing so, I can include the user-defined.properties file in build.xml ca= lled by the ant task in the config.xml. >> >> Now I would like to include it directly at the config.xml level, but if = it is parsed on the master, it certainly won't work. >> >> Perhaps you have other idea? >> >> Thanks, >> >> Jerome. >> >> >> Rollo, Dan a =E9crit : >> =20 >> =20 >>> Hi Jerome, >>> >>> A couple of questions: >>> 1. Is there someplace else in your config.xml where the value of=20 >>> "agent.IP5100" is being set? I don't see how it resolves to the=20 >>> loopback address (127.0.0.1) from your snippet. >>> >>> 2. Once my first question is answered, I believe the next stumbling=20 >>> block will be that the config.xml is fully parsed and resolved on=20 >>> the master. This means, whatever config.xml property substitutions=20 >>> exist, will occur before the build moves off to the Agent. (At a=20 >>> lower level, the Builder.validate() and Builder.build() methods are=20 >>> the only calls executed on the Agent.) >>> >>> If you need the agentIP during the build, could you change the=20 >>> build.xml to determine the agentIP? >>> >>> Dan >>> >>> >>> >>> Date: Tue, 07 Aug 2007 09:14:56 +0200 >>> Subject: [Cruisecontrol-user] Using agent property in task? >>> >>> Hi everyone, >>> >>> I?m using cruisecontrol 2.7 with agent distrib. I would like to know=20 >>> how could I retrieve an agent property into an ant task. >>> >>> Here is what I have tested but it doesn?t work: >>> >>> config.xml: >>> >>> <schedule interval=3D"30"> >>> <distributed> >>> <!--ant anthome=3D"/CC/ant" >>> buildfile=3D"/CC/checkout/${project.name}/build.xml"/--> >>> <ant anthome=3D"/CC/ant"=20 >>> buildfile=3D"/CC/checkout/${project.name}/build.xml"> >>> <property name=3D"ip5100" value=3D"${agent.IP5100}"/> </ant>=20 >>> </distributed> </schedule> >>> >>> >>> build.xml: >>> >>> <project name=3D"connectfour" default=3D"all"> <target name=3D"all"=20 >>> depends=3D"compile, test, jar"/> >>> >>> <target name=3D"compile"> >>> <echo message=3D"${ip5100}"/> >>> <mkdir dir=3D"target/classes"/> >>> <javac srcdir=3D"src" destdir=3D"target/classes"/> </target> ? >>> >>> conf/user-defined.properties: >>> >>> >>> agent.name=3Dnumber1 >>> agent.IP5100=3D127.0.0.1 >>> >>> Any idea ? >>> >>> Thanks a lot, >>> >>> Jerome. >>> >>> >>> -------------------------------------------------- >>> This e-mail and any files transmitted with it may contain privileged or= confidential information. >>> It is solely for use by the individual for whom it is intended, even if= addressed incorrectly. >>> If you received this e-mail in error, please notify the sender; do=20 >>> not disclose, copy, distribute, or take any action in reliance on=20 >>> the contents of this information; and delete it from your system. Any o= ther use of this e-mail is prohibited. >>> >>> Thank you for your compliance. >>> -------------------------------------------------- >>> =20 >>> =20 >>> =20 >> ********************************************************************* >> * >> ************* This e-mail is confidential, the property of NDS Ltd=20 >> and intended for the addressee only. Any dissemination, copying or dist= ribution of this message or any attachments by anyone other than the intend= ed recipient is strictly prohibited. If you have received this message in = error, please immediately notify the pos...@nd... and destroy the ori= ginal message. Messages sent to and from NDS may be monitored. NDS cannot= guarantee any message delivery method is secure or error-free. Informatio= n could be intercepted, corrupted, lost, destroyed, arrive late or incomple= te, or contain viruses. We do not accept responsibility for any errors or = omissions in this message and/or attachment that arise as a result of trans= mission. You should carry out your own virus checks before opening any att= achment. Any views or opinions presented are solely those of the author an= d do not necessarily represent those of NDS. >> >> To protect the environment please do not print this e-mail unless necess= ary. >> >> NDS Limited Registered office: One Heathrow Boulevard, 286 Bath Road, We= st Drayton, Middlesex, UB7 0DQ, United Kingdom. A company registered in Eng= land and Wales Registered no. 3080780 VAT no. GB 603 8808 40-00 >> ********************************************************************* >> * >> ************* >> >> -------------------------------------------------- >> This e-mail and any files transmitted with it may contain privileged or = confidential information. >> It is solely for use by the individual for whom it is intended, even if = addressed incorrectly. >> If you received this e-mail in error, please notify the sender; do=20 >> not disclose, copy, distribute, or take any action in reliance on the=20 >> contents of this information; and delete it from your system. Any other = use of this e-mail is prohibited. >> >> Thank you for your compliance. >> -------------------------------------------------- >> =20 >> =20 > > > > ********************************************************************** > ************* This e-mail is confidential, the property of NDS Ltd and=20 > intended for the addressee only. Any dissemination, copying or distribut= ion of this message or any attachments by anyone other than the intended re= cipient is strictly prohibited. If you have received this message in error= , please immediately notify the pos...@nd... and destroy the original= message. Messages sent to and from NDS may be monitored. NDS cannot guar= antee any message delivery method is secure or error-free. Information cou= ld be intercepted, corrupted, lost, destroyed, arrive late or incomplete, o= r contain viruses. We do not accept responsibility for any errors or omiss= ions in this message and/or attachment that arise as a result of transmissi= on. You should carry out your own virus checks before opening any attachme= nt. Any views or opinions presented are solely those of the author and do = not necessarily represent those of NDS. > > To protect the environment please do not print this e-mail unless necessa= ry. > > NDS Limited Registered office: One Heathrow Boulevard, 286 Bath Road, Wes= t Drayton, Middlesex, UB7 0DQ, United Kingdom. A company registered in Engl= and and Wales Registered no. 3080780 VAT no. GB 603 8808 40-00 > ********************************************************************** > ************* > > -------------------------------------------------- > This e-mail and any files transmitted with it may contain privileged or c= onfidential information. > It is solely for use by the individual for whom it is intended, even if a= ddressed incorrectly. > If you received this e-mail in error, please notify the sender; do not=20 > disclose, copy, distribute, or take any action in reliance on the=20 > contents of this information; and delete it from your system. Any other u= se of this e-mail is prohibited. > > Thank you for your compliance. > -------------------------------------------------- > =20 ***************************************************************************= ******** This e-mail is confidential, the property of NDS Ltd and intended for the a= ddressee only. Any dissemination, copying or distribution of this message = or any attachments by anyone other than the intended recipient is strictly = prohibited. If you have received this message in error, please immediately= notify the pos...@nd... and destroy the original message. Messages = sent to and from NDS may be monitored. NDS cannot guarantee any message de= livery method is secure or error-free. Information could be intercepted, c= orrupted, lost, destroyed, arrive late or incomplete, or contain viruses. = We do not accept responsibility for any errors or omissions in this message= and/or attachment that arise as a result of transmission. You should carr= y out your own virus checks before opening any attachment. Any views or op= inions presented are solely those of the author and do not necessarily repr= esent those of NDS. To protect the environment please do not print this e-mail unless necessary. NDS Limited Registered office: One Heathrow Boulevard, 286 Bath Road, West = Drayton, Middlesex, UB7 0DQ, United Kingdom. A company registered in Englan= d and Wales Registered no. 3080780 VAT no. GB 603 8808 40-00 ***************************************************************************= ********=20 -------------------------------------------------- This e-mail and any files transmitted with it may contain privileged or con= fidential information. It is solely for use by the individual for whom it is intended, even if add= ressed incorrectly. If you received this e-mail in error, please notify the sender; do not disc= lose, copy, distribute, or take any action in reliance on the contents of this information; and del= ete it from your system. Any other use of this e-mail is prohibited. Thank you for your compliance. -------------------------------------------------- |