Set up Code Search for the TeamForge–Git integration

To use TeamForge Code Search functionality with Git, manually grant the TeamForge Code Search user scmviewer permissions to access all Git repositories.

In TeamForge 6.2 (and later versions), Code Search functionality is available through integration with Black Duck Code Sight.
Note: If you have integrated Code Search functionality already while installing an older version of the TeamForge–Git integration, you can skip the following instructions because the installer would have migrated your settings.
  1. Make sure that a Unix system user with the name scmviewer exists. If not, create this user by running the following command:
    • useradd scmviewer
  2. Before you can set up Code Search for the Git integration, import the Code Search public key into TeamForge.
    1. On the Code Search box, check whether the key is present at /root/.ssh/id_rsa.pub. If not, generate it by running the ssh-keygen command.
    2. Copy it to a temporary location (/tmp) on the TeamForge application server.
    3. Run the set_auth_key.py script for the scmviewer user on the TeamForge application server.
      Note: This script requires TeamForge site administrator credentials.
      • cd /opt/collabnet/teamforge/runtime/scripts/codesearch/
      • ./set_auth_key.py --authkey-file=/tmp/id_rsa.pub
  3. Sync the scmviewer user to Gerrit by running the following command in a shell on the host where you installed the Git integration.
    • curl http://localhost:9081/api/gerrit/users/scmviewer/sshkeys

Once the scmviewer user is present in Gerrit, you must grant this user read permissions for all Gerrit projects. Log into Gerrit’s Web interface as a Gerrit super user and so the following:

  1. On the People tab, click Create New Group and create an internal Gerrit group.
  2. Add the scmviewer user to the group.
  3. On the Projects tab, click All-Projects.
  4. On the Access tab, click Edit. Here's an example:
    Gerrit: Read access rights
    You will see Reference display ref/*.
  5. For Group Name in the Read section, enter the name of the internal group you created.
  6. Select ALLOW for the users you want to grant read access.
  7. Click Save Changes.
  8. Log out from Gerrit.
After the initial re-indexing, you should be able to use Code Search with Git.