CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum by 3S-Smart Software Solutions GmbH | A member of the CODESYS Group
Deutsche Version English version russian version 
It is currently Mon Dec 17, 2018 6:35 pm

All times are UTC+01:00




Post new topic  Reply to topic  [ 14 posts ] 

Would anyone else find this useful?
Poll ended at Fri Jun 20, 2014 2:54 am
Yes 0%  0%  [ 0 ]
No 0%  0%  [ 0 ]
Don't Care 0%  0%  [ 0 ]
Total votes: 0
Author Message
 Post subject: Continuous Build Server
PostPosted: Sat Mar 22, 2014 2:54 am 
Offline

Joined: Mon Sep 26, 2005 2:16 pm
Posts: 23
Just a suggestion...

Has anyone at Codesys considered offering an automated build server solution?

We've had a bit of success with Cruisecontrol.NET for automating build/packaging with Codesys 2.3.

I can imagine with 3.x would be quite a bit more flexible.
With every SVN commit or by request:
Checkout --> Roll Version Number-->Build --> Unit Test --> Static Analysis --> Create Documentation --> Package --> Deploy


Top
   
PostPosted: Mon Mar 24, 2014 11:13 am 
Offline
Frequent User
Frequent User
User avatar

Joined: Fri Mar 18, 2011 4:12 pm
Posts: 266
Hi,

Such solutions exist, both inside 3S and at some customers sites.

They usually utilize Python Scripting, the SVN AddOn and the Test-Manager AddOn, and several improvmenents in CODESYS were implemented (and others planned) due to the experience and feedback we got from our customers.

However, there is no product offer of a CI server yet. I'm not sure whether that is a good idea - the customers have different work flows, different CI systems and a different server infrastructure where they want CODESYS to be integrated.

So I think that 3S and our OEMs can provide the building blocks, but I doubt we will be able to create a complete "one-size-fits-all" solution to the CI problem in the form of a hypothetic "CODESYS CI Server" product. However, I'll take this suggestion into our product management.

HTH,
Markus

_________________
Check out the CODESYS store: http://store.codesys.com/

CODESYS® a trademark of 3S-Smart Software Solutions GmbH
Inspiring Automation Solutions


Last edited by M.Schaber on Tue Mar 25, 2014 9:13 am, edited 1 time in total.

Top
   
PostPosted: Mon Mar 24, 2014 9:16 pm 
Offline

Joined: Fri Nov 23, 2012 11:42 am
Posts: 54
We perform CI utilising Codesys 3.5.4 on a Jenkins build cluster. As part of this we use the SVN, static analysis and test manager plugins, these are typically invoked by using python scripts running codesys from the command line. We also use the automation platform.

Our CI system builds our entire codesys offering including the PLC firmware, automation platform components and packages to extend codesys. We test the firmware using googletest. We test the automation platform with NUnit. We use Jenkins to upgrade virtual machines with the new packages and to upgrade out PLCs. Jenkins then invokes Test Manager to run tests on Codesys Control V3 and on each of our PLCs. These tests include unit tests and functional tests. We use python scripting from within Test Manager to drive LabView to stimulate and test the PLC IO system.

On every build we get a full set of all of the items we would ship if we choose to release. We also have the confidence of many thousands of tests being run.

The only step that we are missing from the build sequence you show is rolling the version number. Version number changes are still manual. However each codesys build is identifiable as the SVN plugin includes the SVN version information in some global variables available in each project or library.

There is effort required to learn how to use these tools, there is investment required to build a CI system like this. But once you have worked like this you will not turn back.

There are parts of this process that could be improved, however that appears to be happening. The tools have improved over the time we have been using them and they continue to do so.


Top
   
PostPosted: Tue Mar 25, 2014 9:15 am 
Offline
Frequent User
Frequent User
User avatar

Joined: Fri Mar 18, 2011 4:12 pm
Posts: 266
Hi,

I just wanted to add that the "Roll Version Number" part can be done two ways:

  1. Using the SVN_VERSION_INFO object as mentioned by David Cozens.
  2. The scripting interface also allows access to the Project Information object, so you can increase the project version number (like increasing once each build, or encoding the date and time), or set it to a value derived from the SVN revision if you want.
HTH,
Markus

_________________
Check out the CODESYS store: http://store.codesys.com/

CODESYS® a trademark of 3S-Smart Software Solutions GmbH
Inspiring Automation Solutions


Top
   
PostPosted: Tue Mar 25, 2014 10:46 am 
Offline

Joined: Fri Nov 23, 2012 11:42 am
Posts: 54
Markus is it possible when using the scripting interface to also update the versions of libraries referenced within the library manager? This would be very interesting, we have a few instances of libraries that reference other libraries. We also have Template projects that should be updated to have reference to the current version of libraries. If I can script the library manager interface then we will move to this method for versioning in the very near future.


Top
   
PostPosted: Tue Mar 25, 2014 3:25 pm 
Offline
Frequent User
Frequent User
User avatar

Joined: Fri Mar 18, 2011 4:12 pm
Posts: 266
Hi, David,

You can use the script interface to modify the referenced libraries in a library manager object.

However, you should carefully check whether placeholders may be the better solution for your problem than hardcoding library references (whether those are updated via script or manually).

I did attach two python scripts working on the lib man object as examples.


You do not have the required permissions to view the files attached to this post.

_________________
Check out the CODESYS store: http://store.codesys.com/

CODESYS® a trademark of 3S-Smart Software Solutions GmbH
Inspiring Automation Solutions


Top
   
PostPosted: Wed Jan 13, 2016 12:12 pm 
Offline

Joined: Fri Nov 06, 2015 12:10 pm
Posts: 34
Hi,

We are busy to set-up a Continuous build system and I have the a question about this.
Is it possible to run the Static Analysis from the Test Manager and add the results (or a summary) to the test report?
Or to run the Static Analysis by starting Codesys with a command line option? (and save the results in a file)

Regards, Bakkertje

I use Codesys V3.5 SP7 Patch 2, Test Manager 4.0.1.1, Static Analysis 4.0.2.0 and SVN 4.0.3.0


Top
   
PostPosted: Thu Jan 14, 2016 10:50 am 
Offline
Frequent User
Frequent User

Joined: Tue Nov 13, 2012 9:20 am
Posts: 232
Hi.

We have the improvement SAN-22 listed in our Jira tracker and it will provide a scripting API for the Static Analysis.

For now, you could manually configure the rules in the project settings and use a test script to execute the command "Run Static Analysis" and add the messages to the test report.

BR
Martin

_________________
Check out the CODESYS store: http://store.codesys.com/

CODESYS® a trademark of 3S-Smart Software Solutions GmbH
Inspiring Automation Solutions


Top
   
PostPosted: Thu Jan 14, 2016 11:25 am 
Offline

Joined: Fri Nov 06, 2015 12:10 pm
Posts: 34
Hi Martin,

Thanks for the reply.

What do you mean with:
Quote:
use a test script to execute the command "Run Static Analysis" and add the messages to the test report.

Run the command TestManager.Scripting with ExecuteScript ?
If the answer is yes. Do you have an example of this script? (I'am a newbie with Python scripts :wink:)

Regards, Bakkertje


Top
   
PostPosted: Thu Jan 14, 2016 11:54 am 
Offline
Frequent User
Frequent User

Joined: Tue Nov 13, 2012 9:20 am
Posts: 232
Hi Bakkertje.

Bakkertje wrote:
Run the command TestManager.Scripting with ExecuteScript ?
If the answer is yes. Do you have an example of this script? (I'am a newbie with Python scripts :wink:)

If you have the CODESYS Test Manager for Automation Platform then you can use the command "ExecuteCommand" from CoDeSys.Base for executing the command "Run Static Analysis". To add the messages to the test report you use the test command "FindMessage" from TestManager.System.

Or you can use the following example as base for your own python script and execute it by adding the necessary parameters to your command line:
Code:
system.commands["staticanalysis", "run"].execute()

msgs = system.get_message_objects("{97F48D64-A2A3-4856-B640-75C046E37EA9}")
for msg in msgs:
   if msg.prefix == "SA":
      print("%s%s: %s" % (msg.prefix, msg.number or "", msg.text)

BR
Martin

_________________
Check out the CODESYS store: http://store.codesys.com/

CODESYS® a trademark of 3S-Smart Software Solutions GmbH
Inspiring Automation Solutions


Top
   
PostPosted: Thu Jan 14, 2016 2:08 pm 
Offline

Joined: Mon Sep 26, 2005 2:16 pm
Posts: 23
All,

This is really good information... We had tried to incorporate Static analysis into reporting some time ago without success. (I don't think it was possible then).

1) Regarding the object ID (97F48D64-A2A3-4856-B640-75C046E37EA9) Is this valid for all users or is it license/computer/customer specific?


2) I've heard you (3S/Codesys) use Jenkins internally for CI. I think it might be good for other forum members to be aware of this when implementing version control. We started out using Cruise Control.NET and still use it for unit testing 2.3 projects, but we currently use Jenkins for 3.x. For those unfamiliar... Jenkins is free. It's easy to use and has over a thousand plugins and it's language agnostic, so check it out if you're evaluating CI solutions.

We're in pretty good shape now, but it would be really cool to see:
a. Some sort of Codesys/Jenkins "How To" Document or Webinar.
b. A Jenkins Plugin to make CI even easier.
- Version Control
- Roll Version
- Static Analysis
- Unit Test
- Packaging
- Deployment
- Documentation/Reporting
- etc...

Regards,

John.


Top
   
PostPosted: Thu Jan 14, 2016 2:40 pm 
Offline
Frequent User
Frequent User
User avatar

Joined: Fri Mar 18, 2011 4:12 pm
Posts: 266
Hi, John,

jking22 wrote:
This is really good information... We had tried to incorporate Static analysis into reporting some time ago without success. (I don't think it was possible then).

1) Regarding the object ID (97F48D64-A2A3-4856-B640-75C046E37EA9) Is this valid for all users or is it license/computer/customer specific?


This GUID / UUID is not an Object ID, but it identifies the message category of the compiler messages. You can use the following three methods of "system" to dump info about existing message catebories, or find the Guid to an interesting category:

/// <summary>
/// Gets all message categories.
/// </summary>
/// <param name="bActive">If set to <c>true</c> (the default), only the active ones (those
/// which had at least one message since the current codesys instance was started) are
/// returned. If set to false, all categories existing in the current installation are
/// returned.</param>
/// <returns>A list of guids.</returns>
IList<Guid> get_message_categories(bool bActive = true);

/// <summary>
/// Gets a description for the secified message category.
/// </summary>
/// <param name="category">The category.</param>
/// <returns>The description of that message category.</returns>
string get_message_category_description(Guid category);

Note that the description string is localized, and thus will vary between installations (and might change in newer versions), but the GUID is expected to remain constant.

jking22 wrote:
2) I've heard you (3S/Codesys) use Jenkins internally for CI. I think it might be good for other forum members to be aware of this when implementing version control. We started out using Cruise Control.NET and still use it for unit testing 2.3 projects, but we currently use Jenkins for 3.x. For those unfamiliar... Jenkins is free. It's easy to use and has over a thousand plugins and it's language agnostic, so check it out if you're evaluating CI solutions.

We're in pretty good shape now, but it would be really cool to see:
a. Some sort of Codesys/Jenkins "How To" Document or Webinar.
b. A Jenkins Plugin to make CI even easier.
- Version Control
- Roll Version
- Static Analysis
- Unit Test
- Packaging
- Deployment
- Documentation/Reporting
- etc...


I'll forward that info to our webinar guys and trainers.

_________________
Check out the CODESYS store: http://store.codesys.com/

CODESYS® a trademark of 3S-Smart Software Solutions GmbH
Inspiring Automation Solutions


Top
   
PostPosted: Mon Jan 18, 2016 9:44 am 
Offline

Joined: Fri Nov 06, 2015 12:10 pm
Posts: 34
Hi Martin,

Thanks this works fine. I run this from the Test manager now and collect the result in a global variable "sSAinfo". Because the "print()" is not visible in the test report.
Code:
system.commands["staticanalysis", "run"].execute()
sSAinfo = "Messages: "

msgs = system.get_message_objects("{97F48D64-A2A3-4856-B640-75C046E37EA9}")
for msg in msgs:
  if msg.prefix == "SA":
    sSAinfo = sSAinfo + msg.prefix + str(msg.number) + ": "  + msg.text + ".<br/>  "

sSAresult = msg

Where can I find which column names are available? I cannot found a explanation in the help. Now I see the: msg.prefix, msg.number and msg.text.
But I want to sort and show also the first column with the "type": Error, Warning or Information. What is the name of this column?

Regards, Bakkertje


Top
   
PostPosted: Mon Jan 18, 2016 10:08 am 
Offline
Frequent User
Frequent User

Joined: Tue Nov 13, 2012 9:20 am
Posts: 232
Hi Bakkertje.

Bakkertje wrote:
Where can I find which column names are available? I cannot found a explanation in the help. Now I see the: msg.prefix, msg.number and msg.text.
But I want to sort and show also the first column with the "type": Error, Warning or Information. What is the name of this column?

Well, the first column in the message view is "Description" but the content is put together from the following properties: severity, prefix, number, text

BR
Martin

_________________
Check out the CODESYS store: http://store.codesys.com/

CODESYS® a trademark of 3S-Smart Software Solutions GmbH
Inspiring Automation Solutions


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 14 posts ] 

All times are UTC+01:00


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited