It's all about the answers!

Ask a question

Git hook equivalent in RTC SCM

Ankit Vashistha (125627) | asked Apr 08 '20, 12:18 a.m.

 We have Gitlab configured like following:

  1. If anyone pushes their code, first sever side git hook (pre-receive) will trigger SonarQube Quality checks, if any error in code it rejects that push.
  2. Also checks for file types, if some files like  .zip .o  or  .class  are present, the code gets rejected by the same server side hook.
  3. Same for file size.

Are the above 3 validations possible in IBM RTC SCM before delivering the code to the server? How? I know  .jazzignore , but I want specifically for server side rules.

We want to integrate RTC with sonarqube and bamboo. For every checkin automatically sonarqube test shall run and post successful test, auto build using bamboo should run.

One answer

permanent link
Geoffrey Clemm (30.1k33035) | answered Apr 09 '20, 12:14 a.m.

In RTC, the closest analogue for a git "push" to server is "deliver", not "check-in".    

So I would recommend doing the SonarQube check in a deliver pre-condition, not a checkin pre-condition.
Also, RTC pre-conditions hold open a database transaction, so you don't want to perform long-running operations in pre-conditions.
Instead, I would recommend have a "build" step that runs the SonarQube checks, and then sets a property on the file indicating whether it passed the SonarQube check.
Then your deliver pre-condition can just verify that this property is set on the file versions being delivered.

Ankit Vashistha commented May 19 '20, 5:12 a.m.
Your recommendation to have a build step rather is true as pre-condition hold open a database connection.
The thing which i am trying to perform is to have a sonar checks to be done before code gets deliver in stream.
Can i use a precondition of static checks on deliver stream and there in custom tool can i use sonarqube.

Geoffrey Clemm commented May 19 '20, 5:03 p.m.

You would run the SonarQube check as a "private build" on the workspace containing the changes you want to deliver (accept all incoming changes from the stream to the workspace, to ensure you have the most recent changes to the stream).  If that SonarQube check passes, set an appropriate property on the file, and your custom deliver pre-condition would require that this property be set in order for the deliver to succeed.   I am not sure what you mean by "can I use a precondition of static checks on deliver stream" or "there in custom tool can I use sonarcube". 

Your answer

Register or to post your answer.