Git Client

Services Workbench allows you to use handle git files from the script itself. This is useful for file complex manager or using it during scenario execution as repository system is not available during the scenario execution.

In order to create an Git Client from Services Workbench, first you need to create a client providing 4 required parameters, username, password, the remote repository URL and the local directory. Directories are recommended to have the “{ds}” to make them relative to the current working file.

The client will create the folder during the git client creation, and if the file is there but also an empty folder it is ok.

Keep in mid if a file exists or if the folder is empty, creating the git file creation will fail

Copy
gitClient = createGitClient($username,$password,$url,"{ds}/localpath"[,$branch])
writeCSV("{ds}/localpath/data.csv",$csv_data)
gitClient.add(".");//Adding the file data.csv and other files
gitClient.commit("Message");//Commits message
gitClient.push();//Push but could fail if the branch is not updated

Git Client Method

The current git client has only 4 basic methods

add(filePattern:String)

Adds the files matching the file pattern to the local git repository. Usually use . to add them all.

commit(Message:String)

Commits the current files with the desired message

push()

Pushes the changes, if any to the remote repository. This method does not do merge not rebase and will fail if the remote repository is changed.

pull

Pulls the changes, if any from the remote repository.