Jump to content

Get cm output in trigger


JanReimer

Recommended Posts

Hi,

I'm trying to implement a before-checkin trigger that is supposed to check for branch attributes. I've done all the powershell scripting. There are some cm commands I need to perform (e.g. get branch object ID and get all attributes for that branch). Everything seems to work. However, when running the script in before-checkin context by the server the script doesn't seem to work.

So I stripped all the stuff down to the problem that I'm not able to catch any output from cm commands. As an example I wrote this before-checkin trigger (Powershell):
 

$result = cm lrep
Write-Host $result
exit 1

I installed the trigger using this command:

cm mktr before-checkin lrepAndFail "powershell c:\PSCMTrigger\lrepAndFail.ps1"

 

When performing the checkin operartion, the checkin fails (as expcected) but shows this message only:

Quote

---------------------------
Error
---------------------------
The trigger before-checkin [lrepAndFail] failed.
.

When running locally I see the list of repositories (only one) in the powershell so I'm expecting the message box to show this as well. I also wrote the $result into a local file which turned out to be empty when running in server trigger execution and with the expected result when running manually.

Then I tried to eliminate powershell as source of error and created a trigger using simple cmd shell:

cm ltr
exit 1

and also

cm ltr | echo
exit 1

I am not able to see the list of triggers in the resulting message box.

Hence, I am really wondering how anyone is able to implement any trigger that is a bit more complicated than checking appropriate comment syntax.
Keep in mind, that I actually want to get the branch object ID from cm command during my script. These scripts are just for testing and don't have any meaning in terms of a use case I want to implement.
I'm using Plastic SCM 7.0.16.2356 on Windows 10. Tests are performed on localhost installation (single user Enterprise Edition).

Best regards
Jan

Link to comment
Share on other sites

Hi Jan,

I've just created your same trigger and the repo list is appearing in the GUI panel when trying to perform the checkin. Is this the expected result, right?

Do you have a "cm" properly configured in your server machine so it can run the "cm" commands?

Regards,

Carlos.

pic1.png

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...