GIT Call v2
  • 23 Feb 2021
  • 4 Minutes To Read
  • Contributors
  • Print
  • Share
  • Dark
    Light

GIT Call v2

  • Print
  • Share
  • Dark
    Light

Git Call v2 - is the next step in using code from Git repositories in your Corezoid processes. We have added support for private repositories, improved executable code isolation, and extended the list of supported languages to 5: JS, Python, Go, PHP, Java. Also, we optimized code startup and idle shutdown.

Node settings

git call v2

Basic node settings:

  • Language - select the programming language to be used in the node (JS, GoLang, Python, PHP);
  • Code - executable code

Note:
each language requires a different wrapper, examples are available at link.

  • Repo URL path to the repository, code of which will be used in business logic;
  • Tag / Branch / Commit - Git tag, branch or commit to checkout before build;
  • Handler (Java only) - name of the class that implements UsercodeHandler interface
  • Build command - build a deployable entity command;
  • Build - a button that starts building a deployable entity;
  • Show/Hide terminal - a button to display the build progress.

Requirements:

  1. Executable code in the Code field must be wrapped with the handle function (examples for supported languages are available at link.
  2. Having filled in the Repo URL field, it is necessary to specify the Tag / Branch / Commit field, from which the building of the library will be carried out.
  3. When connecting the repository you may not want to write any executable code in the Code field, but in this case you need to add it to the repository as a usercode.{{extension_for_language_scripts}} file:
    • js - usercode.js,
    • php - usercode.php
    • go - usercode.go
    • python - usercode.py
    • java - usercode.java
  4. When building, the executable code in the Code field overwrites the code in the usercode.xxx file in the connected repository - be careful..
  5. The Build command field is optional.

Additional node settings:

  1. Alert when there is tasks queue - configure logic behavior when a critical number of tasks is reached in a node. More at article.
  2. Limit the time of the task in the node - setting the time interval at which the task will go further in the process logic if the Git Call node does not respond.

Connect with private repositories

Git Call v2 Node supports two ways to connect to a private repository’s:

  1. Via SSH protocol - generate an SSH key in the Git Call node and add it to your account
  2. Via passing the login and password of an account, which has access to that repository, in the Repo URL field in the format https://login:pass@github.com/account/repository.

Editing and Deploying of Code

The deployment process of Git Call node is quite different from that for the Code node - to apply changes, you must perform a code rebuild (click the Build button in the node settings) and Deploy the process. Notice, that in this case the Git Call node will be started in cold start mode.

Cold start mode of Git Call node

After the code is built and the process deployed the Git Call node goes to a cold start mode. This means that Git Call node will wait for task to initiate components and start task processing.

At the moment of "warming up" the Git Call node, requests will be queued in the node.

This procedure may take 10-15 seconds, after which all Tasks will be processed as usual.

If no Tasks passes through the node within 10 minutes, the Git Call node will be automatically switched to the "cold start" mode.

Note:
Passing the new task will start the "warm-up" of the node and update the ten-minute idle timer
Users of Private Cloud and On-premises Hosting types can set the idle time of Git Call node.

Code Isolation

Each code is executed in its own, separate environment. This means that even if all other users of corezoid.com decide to run a code with an infinite loop in the Git Call node, your code will continue to run as normal.

Terminal

Allows you to monitor the progress of code building and displays errors that have occurred, including syntactical errors in the code.

git call v2 terninal

Usage example

I need to encrypt the payload of requests using the HS256 algorithm to make an authorization JWT token. I prefer to code on python and know the library that solves my problem.

Using the Git Call node I can:

  • set Build command that load the library I need - pip install pyjwt;
  • in the Code field write the encoding function that returns JWT;
  • use that JWT further in API Call node.

This is a specific case of using the Git Call node. You can use it with other languages and other repositories or libraries, this node literally frees you up in terms of including ready-made code solutions in your business processes.

Export/Import and Copying of processes with Git Call nodes

Export of processes with Git Call node has not changed. However, due to the addition of new programming languages, specifics of their compilers and increased stability and security of Git Call, import and copying of processes with this node takes more time than usual.

If your processes use Git Call v2 node - be ready to wait 30 seconds or longer for their import or copying.

Working with Git Call nodes via Corezoid API

You can manage Git Call nodes using Corezoid API methods. A full description of the protocol and examples of requests in the article.

Was This Article Helpful?