Re: After Build Custom Label Incrementer Problem

Jeffrey Fredrick <[email protected]>
Newsgroups gmane.comp.java.cruise-control.user
Message-ID <[email protected]>
The model for CruiseControl is that the value of the label is
determined before the build -- the value of the label is one of the
value passed into the build, so it has to be determined ahead of time.

You are trying to have the label determined by the build. That won't work.

What you could do is call your build script with a bootstrapper to
write the current label to a file, then use your custom label
incrementer to read that and set it as the label -- but you'll need to
make it a preBuildIncrementer so that it can set the label before the
build.

Does that makes sense?

Jtf

-- 
 Free hour of CI consulting: http://the.ci-guys.com



On Fri, Feb 6, 2009 at 12:05 AM, Mustafa DEMİR <[email protected]> wrote:
> Hi all,
>
> i have written an after build label incrementer. While build process, latest
> build version is entered a property file. On successfull builds, label
> incrementer parses the property file for latest build version and returns
> newly generated label for current build. But, build log always contains the
> previous build version. Since, buildlog is prepared before
> afterBuildLabelIncrementer method call. Returned label is set for the next
> build process.
>
> I have described this situation in here.
>
> As it is mentioned, this can be resolved by JMX instead of patching the
> cruisecontrol.jar. However, updating projecy label by using JMX is not
> resolve my problem. This is also sets the label of subsequent build.
>
> Here is my code to update project label using JMX interface.
>
> ....
> public boolean isPreBuildIncrementer() {
>         //Must be false. To understand whether project artefact published or
> not,
>         //incrementer has to be called after build.
>         return false;
>     }
>
> ....
> private void updateTargetProjectBuildLabelViaJMX(String buildLabel) {
>         String errorMessage = "Error occured while updating project ''{0}''
> build label via JMX. Exception details: {1}";
>         JMXConnector connector;
>         try {
>             connector = getJMXConnection();
>
>             MBeanServerConnection mbsc =
> connector.getMBeanServerConnection();
>             try {
>                 ObjectName cruiseObjectName =
> ObjectName.getInstance("CruiseControl Project:name=" + projectName);
>                 mbsc.setAttribute(cruiseObjectName, new
> Attribute(BUILD_LABEL_ATTRIBUTE_NAME,buildLabel));
>             } catch (Exception e) {
>                 error(MessageFormat.format(errorMessage, projectName,e));
>             }
>             finally{
>                 connector.close();
>             }
>
>         } catch (MalformedURLException e) {
>             error(MessageFormat.format(errorMessage, projectName,e));
>         } catch (IOException e) {
>             error(MessageFormat.format(errorMessage, projectName,e));
>         }
>     }
>
>     private JMXConnector getJMXConnection() throws MalformedURLException,
> IOException {
>         JMXServiceURL serviceURL = new
> JMXServiceURL("rmi",getCcHost(),Integer.valueOf(getCcRmiPort()).intValue(),"/jndi/jrmp");
>
>         HashMap<String, String> environment = new HashMap<String, String>();
>         environment.put(Context.INITIAL_CONTEXT_FACTORY,
> RegistryContextFactory.class.getName());
>         environment.put(Context.PROVIDER_URL, "rmi://" + getCcHost() + ":" +
> getCcRmiPort());
>
>         JMXConnector connector = JMXConnectorFactory.connect(serviceURL,
> environment);
>         return connector;
>     }
>
> Secondly, it is mentioned in related jira issue comment that this problem
> can be resolved by deleting serialized project file. However deleting ser
> file after build will result in forcing new build, am i right? If it is
> true, this doesnt resolve the problem.
> How can i achieve this situation instead of patching the Project.class
> located in cruisecontrol.jar?
>
> Thanks in advance.
> Regards.

------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
Cruisecontrol-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cruisecontrol-user
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.