Source Control and code commits via API/glide?

MattHarris
Tera Contributor

I have just set up source control on my PDI so i have a backup of my applications in case i loose the instance.

 

I am currently going into Studio and clicking commit to push the days changes to to GitLab.

 

Are there any available commands I can run as server side code I can run which will perform the commit for me?

 

The intention would be to run it from the VSCode extension.

 

I am unable to find any command which would allow me to press that `Commit` button via code.

1 ACCEPTED SOLUTION

Kieran Anson
Kilo Patron

From Studio, you can watch the network transactions and see that the below scripted endpoint is hit to commit the changes sys_ws_operation.do?sys_id=43b2bd7237930200612747efbe41f14f. A series of safety checks are done but the core of it is

var progressId = sn_vcs.AppSourceControl.commitOutgoingChanges()
        .setSysApp(appId) // sys_app.sys_id
        .setCommitMessage(request.body.data.commitMessage || '') //Git comment
        .setCommitMode(request.body.data.commitMode || '') //default 'exclude_untracked'
        .setListOfFilesToBeCommited(request.body.data.changedRecords || []) //Array of objects (action, fileName, sysId, table, type, updateName
        .start();

This returns a transaction ID

View solution in original post

1 REPLY 1

Kieran Anson
Kilo Patron

From Studio, you can watch the network transactions and see that the below scripted endpoint is hit to commit the changes sys_ws_operation.do?sys_id=43b2bd7237930200612747efbe41f14f. A series of safety checks are done but the core of it is

var progressId = sn_vcs.AppSourceControl.commitOutgoingChanges()
        .setSysApp(appId) // sys_app.sys_id
        .setCommitMessage(request.body.data.commitMessage || '') //Git comment
        .setCommitMode(request.body.data.commitMode || '') //default 'exclude_untracked'
        .setListOfFilesToBeCommited(request.body.data.changedRecords || []) //Array of objects (action, fileName, sysId, table, type, updateName
        .start();

This returns a transaction ID