Repository Resource

Rulex Platform embeds a complete version control system for all its primary resources. This version control system is based on Git and allows the user to version their data/model and start collaborative work.

To use a Git system, you first need to construct a repository connection to be able to store versioned information. Once the remote repository has been created and connected, the user is able to push / pull / revert / clone / merge etc…

See also

Complete reference about versioning of primary resources is available at this page.

This connection can be defined each time the initial versioning operation (add / clone / merge) is performed (in this case it’s a Custom connection) or as a Rulex Platform Resource, a Repository type (in this case it’s a Saved connection), to use later on when you need to start any versioning operation.

Once a versioned primary resource is created and added to the Explorer panel, the versioning connection is stored contextually in the resource itself. A Saved connection set as a Repository Resource can be interrogated in any subsequent versioning operation. At any time it is possible to change the repository connection through the versioned Primary Resource Context Menu.

In case the connection is stored in a Repository Resource, and the user can link to this resource a set of permissions (as explained in the permission panel) to limit/control the access other users have on the inserted connection.

To refer a Repository Resource in any panel a repository connection is required, the user must own the view permission on the resource itself, while modify permission is necessary to see its internal definition.

Tip

By creating a Repository Resource with view permissions for all but modify permissions for only administrator, you are exposing a connection without the need to communicate username and password used in the authentication procedure.

Repository connection configuration

Currently, Rulex Platform supports any Git repository distribution. Some examples are:

  • Azure DevOps repository

  • GitHub repository

  • BitBuckets repository

Configuration parameters are equal for all the distributions. Information needed is presented in next subsection.


General Git Repository

This connection allows Rulex Platform to connect to a Git repository reachable from the hosting machine or from the cloud/server.

Name

Description

API param key

Default

Url

The url location of the Git repository.

repository

Username

The username used to authenticate towards the Git repository. (It can be your access token)

username

Password

The password used to authenticate towards the Git repository.

password

Mail

The mail used in commit message to complete Git required author information.

mail


Using a Repository

To create a Repository Resource, you need to open the Explorer panel (for more information refer to this page) and follow this:

Procedure

  1. Click the Explore Resources icon to open the Explorer panel.

  2. Deactivate the primary resource filter by clicking on the Primary filter on the upper right side of the Explorer panel to add general resources.

  3. Hover over the Plus button.

  4. Select Add New Repository and a dedicated window will appear on the screen.

  5. Configure the various connection parameters following this guide. A test connection will be performed; if unsuccessful, the error returned is shown below with the possibility to continue anyway.

  6. Insert a unique name for the new resource.

  7. Click Create: the new Repository resource will now be added to the list.

Once the Repository resource is defined it can be referred as a Saved source in any subsequent versioning operation.

The most important Repository Saved connection operations are listed here

Of course in any of these operations, it is possible to directly define the connection, by inserting a Custom connection with the parameters of section above.


Repository GOLD Reference

Repository connections and base GIT operations are mediated in GOLD through the Version class:

class versioning.versioning.BaseVersioning(dirtyfunc=None, ms=None)
add(branchname=None, filename=None, **source)

Function to start the versioning of a flow/view/form

Parameters:
  • commitname (text) – the author name, defaults to None

  • branchname (text) – the name of the branch, defaults to None

  • filename (text) – the name of the file, defaults to None

Returns:

a dictionary with the name of the new branch and the name of the file

Type:

dict

createTag(tagname, tagmessage)

Function to create a tag in a flow/view/form version history

Parameters:
  • tagname (text) – the tag name

  • tagmessage (text) – the tag message

fork(name, id=None, tagname=None, fields=None, env_id=None, user=None)

Function to create a new branched flow/view/form from an original flow/view/form

Parameters:
  • name (text) – the name of the new branched flow/view/form

  • id (text) – the identifier to be used for the new branched flow/view/form, None to generate it internally, defaults to None

  • tagname (text) – the optional tag to fork from, defaults to None

  • fields (dict) – the dictionary to not fork part of the flow/view/form description, None to fork the whole flow/view/form, defaults to None

  • env_id (text) – the optional identifier of the environment of the new branched flow/view/form, None for the same one of the original flow/view/form, defaults to None

  • branchname (text) – the optional identifier for the new branchname of the forked flow, defaults to None

  • filename (text) – the optional identifier for the filename of the forked flow, defaults to None

Returns:

a dictionary containing the id of the new branched flow/view/form and a list containing the hashes of the newly created branches

Return type:

dict

log(revision=None, limit=10, showdiff=False, showlogsize=False)

Function to show the version history of a flow/view/form

Parameters:
  • revision (text) – the starting commit, None for the latest, defaults to None

  • limit (integer) – the number of history row to be shown, defaults to 10

  • showdiff (binary) – if True the number of addition, deletion is shown next to each log entry, defaults to False

  • showlogsize (binary) – if True the number of file modified is shown next to each log entry, defaults to False

merge(branchname, filename=None, tagname=None, mergepolicy=None)

Function to merge a remote branch into the current flow/view/form

Parameters:
  • branchname (text) – the branch name we want to merge

  • filename (text) – the specific file in branchname we want to merge

  • tagname (text) – the eventual tag we want to consider as starting point, None for the latest, defaults to None

  • mergepolicy (text) – the type of mergepolicy to use, defaults to None

pull(mergepolicy=None, progrelative=False)

Function to pull a versioned flow/view/form

Parameters:

mergepolicy (text) – the merge policy to be used in case, one of ours or theirs, defaults to None

push(message, mergepolicy=None, progrelative=False)

Function to pull a versioned view/flow/form

Parameters:
  • message (text) – the commit message to use

  • mergepolicy (text) – the merge policy to be used in case, one of ours or theirs, defaults to None

removeFromRepo()

Function to remove a flow/view/form from the version control system without removing the remote branch

revert(commitsha, iscommit=False)

Function to revert a flow/view/form

Parameters:
  • commitsha (text) – the SHA1 of the commit you want to revert or the reference name

  • iscommit (binary) – if True the commitsha parameter is a SHA1 of a commit, otherwise it is supposed to be a reference name, defaults to False

setDirtyStatus(dirty=True)

Function to set dirty status on the primary resource

Parameters:

dirty (binary) – the status to set, defaults to True

updateRepository(**source)

Function to change the repository the flow is connected to

Parameters:
  • type (text) – the type of repository, None for git, defaults to None

  • url (text) – the url of repository, defaults to None

  • username (text) – the username of repository, defaults to None

:param password. the password of repository, defaults to None :type password: text

Parameters:
  • local (text) – the local path of the repository, defaults to None

  • mail (text) – the mail used for the commit, defaults to None

  • commitname (text) – the author name, defaults to None

updateVersionStatus(status='ready')

Function to update the version status of the flow

Parameters:

status (text) – the status of the flow