Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

RTC/Git integration: who's done it/how well does it work?

Hi all. I've read the "Integrating other SCM Systems with Rational Team Concert 2.0" document from 2009, which gives a lot of detail but is a little lacking as to the higher-level pros and cons, and searched these forums looking for people who've actually implemented this integration but haven't found much.

Has anyone out there actually implemented the RTC/Git bridge described in the above document? How is it working for you? Do you have any advice? Are you willing to give a general overview of how your system works? With a DVCS there are lots of decisions to make (it seems to me); do you connect RTC with only the "master" git repository? All of them? Etc. Is there any existing community around this environment that I can contact?

What features of RTC does one lose by choosing the Git bridge instead of the builtin SCM? The above doc just says "it is possible to provide a similar type of integration between RTC work items and other SCM systems by using comments and the "Related Artifacts" links provided by the Work Items component. The level of integration will not be as high as with RTC SCM but it is useful none the less"; I'm wondering exactly what "not as high" means: what features are preserved, and which are not.

Finally in some of my readings I've seen discussion of a "connector", while the above doc describes a Git "bridge". Are "connector" and "bridge" different names for the same thing? If not what is the advantage of a connector over a bridge (or vice versa), and if a connector gives tighter integration then is there one available for Git and/or would it be difficult to create one?

Thanks for any guidance/pointers/guidelines anyone can provide!
Cheers!

2 votes



22 answers

Permanent link

Yeah sorry, i didnt see the comment there..I see you created a soft link..so I downloaded the zip for hooks provided by IBM and unzipped them on my local and edited the scripts mentioned in Readme.txt and placed them on server in /hooks folder for my repo. yours is a nice way to link to multiple repos.

Next thing..I'll check my python-3.3.5 installation again..i downloaded a .tgz tarball and untar it but i think all i have is source code and not executable

0 votes

Comments

Also my system has python 2.7. Just because rtc-git integration requires python 3.3.5, do i have to make it as default for everything?

because the git integration provides some pre-compiled (pyc) python files, the interpreter version must match almost exactly.
2.7 will not work, 3.0 will not work, 3.2 will not work. (I tried!)..

you will get invalid magic key errors, indicating mismatch between pre-compiled and interpreter.

I ended up installing ActivePython 3.3.4.1 (download, unzip, run install.sh)


Hey Sam.. thanks for the guidance so far but I have a doubt regarding Python.

I have Python 2.7 and 3.3.4 installed and default is set to 2.7. I dont want to change that but how do i make sure that integration python scripts use 3.3.4 an not 2.7?

I have both as well, but only set the explicit path in the post-receive hook file

pythonPath=/opt/ActivePython-3.3/bin/python3.3


Permanent link
So the latest version of ActivePython is is 3.3.4.1, would that work? or its the same thing

0 votes

Comments

yes, I  corrected my comment, that is the same I installed


Permanent link

Ok so I installed ActivePython-3.3.4.1 by running ./install.sh and its installed in opt/ActivePython-3.3/bin/python, but to run python I see two files python3 and python3.3, which one do i execute or they are same?

"Wish I could put my snap in here"

0 votes

Comments

I used python3.3 and the script executes now.. fails connecting to RTC cause I haven't finished the config yet., but at least doesn't crash for bad interpreter version.


Permanent link

So couple of things I did today to fix my python mess:

1) Installed ActivePython-3.3.4.1 (default install location: /opt/ActivePython-3.3/bin)

2) Edited my Python scripts( post-receive, pre-receive, ref-update and ref-updated.py) by adding a shebang at the beginning of my script (#!/opt/ActivePython-3.3/bin/python3.3) though python 2.7 is installed but I think this shebang will help execute what version of Python I want.

So one of IBM requirement is to mention HOOKS_PATH in the scripts Example: Location where Git Python hook scripts are copied

example hooksPath="C:/PythonScripts/rtcgithooks"

So to do this we need to create a rtcgithooks folder and copy all hook scripts there?

0 votes

Comments

my post-receive hook script from ibm says

$pythonPath $hooksPath/AssociateWorkitem.py .....

my expanded script would say

/opt/ActivePython-3.3/bin/python3.3 /opt/rtc-git/AssociateWorkitem.py ...

so the two paths are not needed to be together..

I finally got my web git  interface working git-web on tomcat.  and was able to registr the repo. this generates a  key that is needed in the hook script.  so the link approach won't work.  as each repo has a different key..

anyhow. bug workitem_number in the commit comment then puts a link to the git change set in the workitem





Permanent link

So in my pre-receive script I have this after all editing:

#!/opt/ActivePython-3.3/bin/python3.3

remote="$1"
url="$2"
userId="$REMOTE_USER"
z40=0000000000000000000000000000000000000000
IFS=' '
jazzRepoUrl=https://ptcpassbuild1:9443/jazz/
gitRepoKey=a2c8741789234b599a145aa2827c7e04
pythonPath=/opt/ActivePython-3.3/bin/python3.3
hooksPath=/opt/ActivePython-3.3/share/python3.3/scripts/rtcgithooks

while read oldRev newRev refName; do
  echo oldRev=$oldRev newRev=$newRev refName=$refName
  echo "GIT/RTC Sucks together"
  $pythonPath $hooksPath/ValidatePush.py $jazzRepoUrl $gitRepoKey $userId $oldRev $newRev $refName
  if [ $? -ne 0 ];
  then
    exit 1
  fi
done

exit 0

and I try to execute this script manually it throws syntax error:invalid Syntax on below url..

Dont know why??but will try troubleshooting

jazzRepoUrl=https://ptcpassbuild1:9443/jazz/

0 votes


Permanent link
But overall I have registered Git repository but still the integration doesnt work....

0 votes

Comments

and in the git commit message you have to put some specific text to trigger the integration

bug rtc_workitem_number message

like

bug 7 test with rtc

you should see this on workitem 7

and click on that link will show in a browser




Permanent link

My GIT commit is like this:

git commit -s -m "fix defect 419901" and then I push it and then I got to links in RTC but nothing comes up.

Is this message correct?

0 votes

Comments

according to http://www-01.ibm.com/support/knowledgecenter/api/content/SSYMRC_5.0.0/com.ibm.team.connector.cq.doc/topics/t_git_assoc_wi.html

yes..

just to make sure.. the post-receive hook script is either in
/git/repo/hooks
or
linked to from there..

it MUST be in the git repo hooks folder for GIT to call it.
the IBM provided hook code calls out to other services in the $hooksPath folder.
but git knows nothing about that


Permanent link

I have my scripts in below loactions:

1) For Git repo: /media/storage/gerrit2/review_site/git/testproject2.git/hooks

{hookslib.pyc, post-receive.py, pre-receive.py, rtcprocess.pyc and commit-msg}

2) For Gerrit : /media/storage/gerrit2/review_site/hooks

{ref-update.py and ref-updated.py}

3) For hooks path: /opt/ActivePython-3.3/share/python3.3/scripts/rtcgithooks

{AssociateWorkItem.py, hookslib.pyc, post-receive.py, pre-receive.py, ref-update.py, ref-updated.py, rtcprocess.pyc and ValidatePush.py}

For this integration I have modified post-receive, pre-receive , ref-update and ref-updated scripts.

Please let me know if any script needs to be placed in any other folder/directory?

0 votes


Permanent link
1) For Git repo: /media/storage/gerrit2/review_site/git/testproject2.git/hooks {hookslib.pyc, post-receive.py,
pre-receive.py, rtcprocess.pyc and commit-msg}

only post-receive needs to be in the hooks folder. 

post-receive is the thing git calls. and ONLY that file on push.  it must be executable too
chmod +x post-receive

the others are in the location where the ibm files are
/opt/ActivePython-3.3/share/python3.3/scripts/rtcgithooks

0 votes


Permanent link

Yeah I'll do that.. Its weird I only changed the Url and path in scripts and now I tried running post-receive.py scripts manually and I get a syntax error:

file "./post-receive.py", line 35

  while read local_ref local_sha remote_ref remote_sha; do

SyntaxError: invalid syntax.

Did you try running urs?

0 votes

Comments

I don't have a post-receive.py

only a post-receive, and pre-receive
the py files I have are AssociateWorkitem.py and ValidatePush.py
and two pyc files.

also two gerrit windows batch files.

the filename put into the git repo hooks folder should be 'post-receive'
no extension...  its a linux shell script.

1–15 items
page 2of 1 pagesof 2 pagesof 3 pages

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,964

Question asked: Oct 17 '11, 5:30 p.m.

Question was seen: 18,444 times

Last updated: Aug 19 '14, 9:06 p.m.

Confirmation Cancel Confirm