br-automation-com / BnR-DevOps-Package

Contains materials for implementing DevOps practices for Automation Studio project development.
21 stars 2 forks source link

AS Docker Buildcontainer planned? #1

Open zeehans opened 1 year ago

zeehans commented 1 year ago

For our CI pipelines it would be really useful to be able to use Docker containers to build and deploy PLC images (in our case RUC and PIPs). Right now we use a shell executor that uses the BR command line tooling to sequentially build our deploy images however it would be really nice to be able to parallelise this process. We are building about 15 different configurations and it takes quite a while to build. If we were able to build each configuration in an isolated container we could easly parallelise this process. We tried pulling relevant tools and dependencies into a Docker Windows container but never got it to build. Surely we are missing some steps here. Is it possible to get instructions as to how to build such a container, preferably a Dockerfile?

knetsooj commented 1 year ago

We have the same question/ challenge. In the presentation 'Automation & Build Server' slide 35 there is also mentioned that B&R uses a docker container on their Jenkins server

langstonb commented 1 year ago

Hi @zeehans - thank you for the suggestion, it is a good one. As @knetsooj mentioned, we do indeed have docker containers set up on our internal server. Therefore, we will add some explanation into the PPT for how you can set this up on your side. We will also add our docker file to the template files. We plan to have this information added by the end of October.

zeehans commented 12 months ago

@langstonb that's great. Please post an update in this issue when you have added that info.

wesleybuchanan commented 10 months ago

@zeehans @knetsooj, I've just committed the Dockerfile and added instructions to the presentation for creating a Jenkins node and creating the docker container installing Automation Studio and the Jenkins agent.

zeehans commented 10 months ago

@wesleybuchanan that's great. We'll try that out shortly.

zeehans commented 9 months ago

@wesleybuchanan we tried building the Docker image using your Dockerfile but are getting stuck at importing the fieldbus devices. I believe that's how far we got the first time around last year as well with our own dockerfile. When we attempt a build of a project using a CP1585 PLC for instances we get the following error messages:

C:\source.plc\Micro\Physical\CP1585_1\Hardware.hw: (Ln: 637, Col: 33) error 4821:Support for hardware module type FBE.0000001D_CPX_FB40 is not available. Please install the corresponding upgrade. C:\source.plc\Micro\Physical\CP1585_1\Hardware.hw: (Ln: 637, Col: 62) warning 4821:Required version '1.0' for hardware module 'FBE.0000001D_CPX_FB40' is not installed currently. Please install the corresponding upgrade. C:\source.plc\Micro\Physical\CP1585_1\Hardware.hw: (Ln: 690, Col: 45) error 4821:Support for hardware module type FBE.00000230_UR20_8DI_P_2W is not available. Please install the corresponding upgrade. C:\source.plc\Micro\Physical\CP1585_1\Hardware.hw: (Ln: 690, Col: 79) warning 4821:Required version '1.0' for hardware module 'FBE.00000230_UR20_8DI_P_2W' is not installed currently. Please install the corresponding upgrade.

On a regular installation of AS the fieldbus dependencies would just be requested to be installed upon opening a project file. Unfortunately we can't seem to run AS out of the container - it just crashes. Can the fieldbus module files simply be copied across from a bare-metal installation or is there another way to install them without going through the UI?

wesleybuchanan commented 9 months ago

Hi @zeehans ,

If you place the needed upgrades into the AS_Upgrades directory before creating the docker container then they should be installed after Automation Studio is installed. Specifically the lines 94 - 101 of the docker file handle this.

If there are upgrades that need to be installed after the container has been created you could mount a volume into the container and run the commands.

To mount a volume in docker first stop your container docker stop as_412 then run it with the -v to specify a volume. docker run -v /C/AS_Upgrades:/C/Temp/AS_Upgrades as_412 Then open a powershell command prompt on the container docker exec -it as_412 powershell Then run the following command in powershell C:\Temp\AS_Upgrade.exe -G='C:\BrAutomation' -V='C:\BrAutomation\AS412' -R | Out-Null; where AS_Upgrade.exe is the upgrade file that you want to install

Once the install is finished you can exit or install additional upgrades.

zeehans commented 9 months ago

@wesleybuchanan in this case it's about third party device description files (extension .xdd). For example the file FBE.0000001D_CPX_FB40 refers to a FESTO Powerlink compatible bus node. These are xml files that are imported via the 3rd Party Device Manager. Is it possible to simply mount the corresponding folder into the container from a bare-metal AS installation?

JobFranken commented 9 months ago

@zeehans Please check the contents of the "C:\ProgramData\BR\AS412\Hardware\Modules" of your local installation. You should see the 3e party FBE.0000001D_CPX_FB40 subfolder. When you copy this to the docker installation it should build correctly.

wesleybuchanan commented 8 months ago

@zeehans can you confirm that copying the FBE.0000001D_CPX_FB40 folder into your docker container allowed you to build your project succesfully?

We plan on updating the package with this information shortly.

zeehans commented 8 months ago

@wesleybuchanan we haven't got around to trying that yet. My colleague who is tasked with building the docker image is still on leave at the moment. I'll let you know as soon as I know more.

zeehans commented 8 months ago

@wesleybuchanan my colleague got around to testing your suggestion. We can build the docker image now and the error messages relating to the description files disappear but when we try to compile a configuration, the build just hangs after a while and never completes.

In the container we build a configuration using the following commands:

As base images we tried:

We built container images using AS Versions 4.11 and 4.12. The behaviour described above occurs in all build setups and the build hangs here:

Generating BR-Module "Visu.br" ...

I attached two build logs:

We'd be grateful if you could provide some help as to how to proceed.

log-container.txt log-shell.txt