atom feed17 messages in com.googlegroups.ccnet-devel[ccnet-devel] Re: CC.NET on Linux - L...
FromSent OnAttachments
johnmanFeb 16, 2009 2:46 am 
Leszek CiesielskiFeb 16, 2009 3:04 am 
johnmanFeb 16, 2009 9:30 am 
johnmanFeb 16, 2009 10:02 am 
Daniel HommelFeb 17, 2009 11:42 am 
JohnMMar 5, 2009 10:18 am 
Daniel NauckMar 7, 2009 1:24 am 
Daniel HommelMar 7, 2009 6:26 pm 
David CameronMar 7, 2009 8:14 pm 
Daniel HommelMar 8, 2009 8:45 am 
JohnMMar 9, 2009 4:56 am 
David CameronMar 10, 2009 4:38 am 
JohnMMar 10, 2009 5:39 am 
Ruben WillemsMar 10, 2009 5:43 am 
Leszek CiesielskiMar 10, 2009 5:46 am 
Daniel NauckMar 10, 2009 11:03 am 
Daniel NauckApr 29, 2009 2:14 pm 
Subject:[ccnet-devel] Re: CC.NET on Linux - Latest
From:Leszek Ciesielski (skol@gmail.com)
Date:Feb 16, 2009 3:04:36 am
List:com.googlegroups.ccnet-devel

Could you file bugs with Mono for those things as well? (excluding path separator problem of course)

On Mon, Feb 16, 2009 at 11:46 AM, johnman <john@gmail.com> wrote:

Next set of changes required in order to get Modifications History to work:

Problem Number 1: Path issue as path to ModificationHistory.xsl is hardcoded.

------------------------------------------------------------------------------------------------------------------------

File: project\WebDashboard\Plugins\ProjectReport \ModificationHistoryProjectPlugin.cs

use:

private string xslFileName = Path.Combine ("xsl","ModificationHistory.xsl");

instead of:

private const string XslFileName = "xsl\\ModificationHistory.xsl";

This gets around the path issue on linux.

Additional enhancement is to allow you to specify your own xsl file by adding:

[ReflectorProperty("xslFileName", Required = false)] public string XslFileName { get { return xslFileName; } set { xslFileName = value; } }

Problem 2: HistoryData.xml is not generated correctly under Linux

------------------------------------------------------------------------------------------------------------------------

Under Linux the Build node was note being closed (it was on windows):

Windows: <Build BuildDate="2009-02-16 05:13:59" Success="True" Label="X-1.0.0.25">

Linux: <Build BuildDate="2009-02-16 05:13:59" Success="True" Label="X-1.0.0.25

File: project\core\publishers\ModificationHistoryPublisher.cs

In method WriteModifications:

Use:

System.IO.StreamWriter sw = new System.IO.StreamWriter(fs, Encoding.Default);

Instead of:

System.IO.StreamWriter sw = new System.IO.StreamWriter(fs);

I also got rid of the WriteXMLAttributeAndValue method and simply used CurrentBuildInfoWriter.WriteAttributeString instead but that change is not required in order to get this working under Linux.

In method LoadHistory:

Use:

System.IO.StreamReader sr = new System.IO.StreamReader (documentLocation, Encoding.Default);

Instead of:

System.IO.StreamReader sr = new System.IO.StreamReader (documentLocation);

These changes seem to work for me so far. Please not if your projects have already generated a HistoryData.xml file under Linux you'll need to either edit it (to close the Build node) or delete it (so a new one is regenerated) before this will work for you.

These changes are all rather minor so I was wondering if they could be added to 1.4.3 or 1.5?

Thanks,

On Feb 13, 1:37 pm, johnman <john@gmail.com> wrote:

Hi All,

Thought I would give some feedback based on my attempts to get CC.NET working on Linux.

Currently testing against Mono 2.4 preview 1 and preview 2

The good news:

-----------------------

- ccnet.exe seems to run without issues (so far). Some changes:

(1) ccnet.exe.config

Changed the paths e.g. from <file name="xsl\header.xsl"/> to <file name="xsl/header.xsl"/>

Replaced:

<appender name="Console" type="log4net.Appender.ColoredConsoleAppender"> <mapping> <level value="ERROR"/> <foreColor value="White" /> <backColor value="Red, HighIntensity" /> </mapping>

<mapping> <level value="DEBUG" /> <foreColor value="Green" /> </mapping>

<mapping> <level value="INFO" /> <foreColor value="White" /> </mapping>

<layout type="log4net.Layout.PatternLayout"> <conversionPattern value="[%thread:%level]
%message%newline"/> </layout> </appender>

with:

<appender name="Console"
type="log4net.Appender.ConsoleAppender"> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="[%thread:%level]
%message%newline"/> </layout> </appender>

As ColoredConsoleAppender does not work under Mono.

(2) ccservice.exe.config

Changed the paths e.g. from <file name="xsl\header.xsl"/> to <file name="xsl/header.xsl"/>

The not so bad news :D

-------------------------------------

- webdashboard works (I need to look into Modifications History but I think that just might be a configuration issue) but requires a few tweaks for it to run under XSP2

-- (1) project\WebDashboard\Configuration \DashboardConfigurationLoader.cs

- When the Webdashboard tries to load up an assembly the path is incorrect (missing "/" at the start of the path) and it fails to load.

Culprit:

newTypeTable.Add(Path.GetDirectoryName(Assembly.GetExecutingAssembly ().CodeBase.Substring(8)), CONFIG_ASSEMBLY_PATTERN);

Fix:

newTypeTable.Add(Path.GetDirectoryName((new System.Uri (Assembly.GetExecutingAssembly().EscapedCodeBase)).AbsolutePath), CONFIG_ASSEMBLY_PATTERN);

-- (2) project\WebDashboard\Dashboard\ProjectGridRow.cs

- Mono does not support System Colours (or at least it was failing on Mono 2.4 preview 1) which causes the webdashboard to fail when loading the project grid.

Culprit:

private string CalculateHtmlColor(IntegrationStatus integrationStatus) { if (integrationStatus == IntegrationStatus.Success) { return Color.Green.Name; } else if (integrationStatus == IntegrationStatus.Unknown) { return Color.Yellow.Name; } else { return Color.Red.Name; } }

Fix: (Although retrieving this from a config file or returning a css style name instead would be better)

private string CalculateHtmlColor(IntegrationStatus integrationStatus) { if (integrationStatus == IntegrationStatus.Success) { return "Green"; } else if (integrationStatus == IntegrationStatus.Unknown) { return "Yellow"; } else { return "Red"; } }

You would also be required to update the unit test as well in: project \UnitTests\WebDashboard\Dashboard\ProjectGridTest.cs

[Test] public void ShouldCopyBuildStatusToProjectRow() { // Setup ProjectStatusOnServer[] statusses = new
ProjectStatusOnServer[] { new
ProjectStatusOnServer(ProjectStatusFixture.New (projectSpecifier.ProjectName, IntegrationStatus.Success), serverSpecifier) };

SetupProjectLinkExpectation(); // Execute ProjectGridRow[] rows =
projectGrid.GenerateProjectGridRows (statusses, "myAction", ProjectGridSortColumn.Name, true, "");

// Verify Assert.AreEqual("Success", rows[0].BuildStatus); Assert.AreEqual(Color.Green.Name,
rows[0].BuildStatusHtmlColor);

// Setup statusses = new ProjectStatusOnServer[] { new
ProjectStatusOnServer(ProjectStatusFixture.New (projectSpecifier.ProjectName, IntegrationStatus.Failure), serverSpecifier) }; SetupProjectLinkExpectation();

// Execute rows = projectGrid.GenerateProjectGridRows(statusses,
"myAction", ProjectGridSortColumn.Name, true, "");

// Verify Assert.AreEqual("Failure", rows[0].BuildStatus); Assert.AreEqual(Color.Red.Name,
rows[0].BuildStatusHtmlColor);

// Setup statusses = new ProjectStatusOnServer[] { new
ProjectStatusOnServer(ProjectStatusFixture.New (projectSpecifier.ProjectName, IntegrationStatus.Unknown), serverSpecifier) }; SetupProjectLinkExpectation();

// Execute rows = projectGrid.GenerateProjectGridRows(statusses,
"myAction", ProjectGridSortColumn.Name, true, "");

// Verify Assert.AreEqual("Unknown", rows[0].BuildStatus); Assert.AreEqual(Color.Yellow.Name,
rows[0].BuildStatusHtmlColor);

// Setup statusses = new ProjectStatusOnServer[] { new
ProjectStatusOnServer(ProjectStatusFixture.New (projectSpecifier.ProjectName, IntegrationStatus.Exception), serverSpecifier) }; SetupProjectLinkExpectation();

// Execute rows = projectGrid.GenerateProjectGridRows(statusses,
"myAction", ProjectGridSortColumn.Name, true, "");

// Verify Assert.AreEqual("Exception", rows[0].BuildStatus); Assert.AreEqual(Color.Red.Name,
rows[0].BuildStatusHtmlColor);

VerifyAll(); }

Becomes:

[Test] public void ShouldCopyBuildStatusToProjectRow() { // Setup ProjectStatusOnServer[] statusses = new
ProjectStatusOnServer[] { new
ProjectStatusOnServer(ProjectStatusFixture.New (projectSpecifier.ProjectName, IntegrationStatus.Success), serverSpecifier) };

SetupProjectLinkExpectation(); // Execute ProjectGridRow[] rows =
projectGrid.GenerateProjectGridRows (statusses, "myAction", ProjectGridSortColumn.Name, true, "");

// Verify Assert.AreEqual("Success", rows[0].BuildStatus); Assert.AreEqual("Green", rows[0].BuildStatusHtmlColor);

// Setup statusses = new ProjectStatusOnServer[] { new
ProjectStatusOnServer(ProjectStatusFixture.New (projectSpecifier.ProjectName, IntegrationStatus.Failure), serverSpecifier) }; SetupProjectLinkExpectation();

// Execute rows = projectGrid.GenerateProjectGridRows(statusses,
"myAction", ProjectGridSortColumn.Name, true, "");

// Verify Assert.AreEqual("Failure", rows[0].BuildStatus); Assert.AreEqual("Red", rows[0].BuildStatusHtmlColor);

// Setup statusses = new ProjectStatusOnServer[] { new
ProjectStatusOnServer(ProjectStatusFixture.New (projectSpecifier.ProjectName, IntegrationStatus.Unknown), serverSpecifier) }; SetupProjectLinkExpectation();

// Execute rows = projectGrid.GenerateProjectGridRows(statusses,
"myAction", ProjectGridSortColumn.Name, true, "");

// Verify Assert.AreEqual("Unknown", rows[0].BuildStatus); Assert.AreEqual("Yellow", rows[0].BuildStatusHtmlColor);

// Setup statusses = new ProjectStatusOnServer[] { new
ProjectStatusOnServer(ProjectStatusFixture.New (projectSpecifier.ProjectName, IntegrationStatus.Exception), serverSpecifier) }; SetupProjectLinkExpectation();

// Execute rows = projectGrid.GenerateProjectGridRows(statusses,
"myAction", ProjectGridSortColumn.Name, true, "");

// Verify Assert.AreEqual("Exception", rows[0].BuildStatus); Assert.AreEqual("Red", rows[0].BuildStatusHtmlColor);

VerifyAll(); }

-- (3) project\WebDashboard\javascript\Dojo folder name.

- When trying to view statistics on a dashboard hosted on Linux it fails to load as it is looking for dojo/dojo.js. Since the folder has a capital D it doesn't see it as a match. Can we rename the folder so it is lowercase (wouldn't impact windows users)?

-- (4) dashboard.config

- I reversed the paths from \ to / in the xsl filename references e.g.:

<xslFile>xsl\header.xsl</xslFile>

becomes

<xslFile>xsl/header.xsl</xslFile>

-- (5) Web.config

Added

<configSections> <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" /> </configSections>

and

<log4net> <root> <!-- Change the value in the next line to alter the
amount of logging generated by CruiseControl.NET. The following values are supported: DEBUG, INFO,
WARN, ERROR, OFF. For more detailed information on how to
configure log4net, seehttp://logging.apache.org/log4net/ --> <level value="DEBUG"/> <appender-ref ref="Console"/> <appender-ref ref="RollingFileAppender"/> </root> <appender name="Console"
type="log4net.Appender.ConsoleAppender"> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="[%thread:%level]
%message%newline"/> </layout> </appender> <appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender"> <file value="ccnet.log"/> <appendToFile value="true"/> <rollingStyle value="Size"/> <maxSizeRollBackups value="10"/> <maximumFileSize value="10MB"/> <staticLogFileName value="true"/> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%date [%thread:%level]
%message%newline"/

</layout> </appender> </log4net>

This is when you are debugging the dashboard (you can log information by modifying the source code so you can see what is happening and what values are being used when it is run under Linux). You can remove this once you have everything working.

I also changed <customErrors mode="RemoteOnly" /> to <customErrors mode="Off" /> so that you can see the errors via ie/firefox (useful if you are only accessing the server via e.g. putty). Remember to change this back once you are happy with the setup.

I think having CC.NET working cross platform is great and would encourage many people to use (or continue to use) CC.NET instead of other projects out there. The features coming in 1.5 will also help increase the popularity of CC.NET (I hope we can maintain Mono compatibility). I am sure there are still more issues to come across but right now I am quite happy with the results (although it would be good to run ccnet and the xsp2 as a daemon).

You could potentially have CC.NET running on Windows, Linux, Mac and Solaris (anyone run it under Solaris? I have heard of others running it under Mac).

Some suggestions:

-----------------------

Make everything lowercase (e.g. the xsl files have been named using different naming conventions). This change wouldn't impact windows users but would reduce the chances that case sensitivity causes problems on other platforms.

Think about bundling XSP 2 (it runs under .NET as well) so that people can easily get up-and-running without requiring IIS. Similar to the way CruiseControl uses Jetty. They can then switch to IIS if they want but they bypass what can sometimes be a painful experience.

Any chance of these changes making it in now that the 1.4.3 release is being pushed back to March?

Cheers to everyone that has helped me and of course hat's off to the people contributing to CC.NET.

Thanks,