GIT Call
  • 21 Sep 2022
  • 4 Minutes to read
  • Contributors
  • Dark
    Light
  • PDF

GIT Call

  • Dark
    Light
  • PDF

Git Call 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. We optimized code startup and idle shutdown, added the feature of building code from a branch or a tag. In this version, we also introduced the support of private repositories cloning via the SSH protocol (tested on Github, Gitlab and Bitbucket; also works with other Git-servers with SSH protocol).

Node settings

Basic node settings:

  • Language - select the programming language to be used in the node (JS, GoLang, Python, PHP, Java);
  • Code - executable code;
  • Get SSH key - generates an SSH key and saves it to clipboard. The generated key can be added to the user profile on a service (for example, Github) for accessing repositories;
Note
Each language requires a different wrapper, examples are available by following the link.
  • Repo - URL path to the repository, which code 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.
Java code building
To build a Java code with a custom class, you need to use the GradleWrapper and specify the code request in the Command field. Please, see the example for more details.

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. See the article for the details.
  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 to private repositories

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

  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.

Code Editing and Deploying

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 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.


What's Next