Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Python API for GIT extensions

FPawlak
2021-11-03
2023-03-24
  • FPawlak - 2021-11-03

    Hi,
    I use in my developnent process custom python scripts. Mainly for initializing project, saving libraries as compiled-library instaling libraries and so on.
    I wonder if there is any API/python classes to interact with Codesys Git Extension?
    I'm looking for an oportunity to commit, push, fetch or check commit hash. So I will be able to integrate GIT with my scripts.

    Thanks a lot for any info.

     
    πŸ‘
    1
  • eschwellinger

    eschwellinger - 2021-11-03

    Hi,
    this is planned to have, but I have no date when it will be available.

     
  • amir - 2021-12-24

    Hi,
    Any alternative?
    We are using git as our source control and we would like to use automated build for our deployment

    thanks,

     
  • FPawlak - 2021-12-24

    Hi, I want this also for this purpose :)
    Before GIT extension was aviable I write some python scrips and I manualy push Codesys project file to my GITLAB server.
    On GITLAB server I have GITLAB Runner (Windows VM) with installed Codesys. I have configured push action which run Codesys and compile library as compiled on network drive.
    I have also scripts to install all libraries from network drive and so on.

    The main disadventage is that Codesys project is saved as 'binary' file in GIT repo. So you don't have diffs and it is not really helpfull for team work. But for automate building is just fine.

    I have some ideas how to 'integrate' it with Codesys GIT extension but I have no time yet to try it.
    Codesys project under git versioning is still some kind of git repo in file system on your computer. So it should be possible to interact with it with 'classical' git client in order to make some basic check - is everthing commited and pushed to remote? Is local version the same as master on server? Then on local machine you can build project as the latest version and save it on e.g network drive.
    Ofcourse you can still use dedicated virtual machine for building but you will need some extra GIT licence for it :(

    Later I can attach my scripts but for now,
    Marry Chrismass :)

     
    • void - 2021-12-28

      Is most of your project in structured text? If it is, you could get some diff output by saving it as PLCopenXML and pushing it to git

      But if it's mostly the visual diagrams, lists and charts then I guess you will need CODESYS git or a paid service like https://www.copia.io/

       
  • hermsen

    hermsen - 2021-12-28

    Hi, looking forward to those scripts!

     

    Last edit: hermsen 2021-12-28
  • FPawlak - 2022-01-19

    Sorry guys.
    I have completly forgotten to post my script files.
    As I wrote earlier I use it with Gitlab repositories.

    src/config.cfg - config file
    - [LOCAL_REPOSITORY] is your codesys repository where you want to install your compiled libraries and use in final project.
    - [LOCAL_REPOSITORY_DEVELOP] is your codesys repository where you want to install your 'develop', not compiled libraries mainly for testing
    - [REMOTE_REPOSITORY] - network location where you have all yours and your collegues libraries. You install from there to [LOCAL_REPOSITORY] with InitLibrary.py script

    src/InitLibrary.py - init new library - set company name, version and also create gitlab-ci.yml file for use in Gitlab pipes

    src/SaveProjectAsDevelopLibrary.py - save currently open library as 'DEVELOP' not compiled and install it in Codesys DEVELOP_REPO. While it is not *.compiled-library you can easly debug your program.

    src/InstallLibraries.py - installs all libraries from [REMOTE_REPOSITORY] based on Libraries.lst file in that directory

    src/FullDeploy.py - used on Gitlab to compile library and to add to [REMOTE_REPOSITORY]

    runner/RunBuild.bat - Gitlab fires this script on gitlab runner to start codesys and execute FullDeploy.py

     
  • bkuriata - 2022-07-29

    Hello,
    is there any update regarding this topic.
    Is there already some API to work with GIT extension?

     
    • hermsen

      hermsen - 2022-07-29

      no, most probably this will come with the next update as I heard a rumour that the Script API interface will be available before the end of this year. In the mean time all we can do is wait.

       
  • kevinrn - 2022-10-19

    Hi community,

    is there any news on this?
    I would like to build our CD/CD for codesys libraries.
    I need a solution to clone the repository content and open it with codesys headless to save the library as a compiled library.

    Thank you in advance.

     
  • tba123 - 2023-03-24

    any news on this?

     
    πŸ‘
    1

Log in to post a comment.