TeamForge Webhooks-based Event Broker supports TeamForge—Jenkins integration. A new Jenkins integration plugin v2.0.6 is used to integrate TeamForge with Jenkins using TeamForge Webhooks-based Event Broker.
Before You Begin

It is assumed that you have installed the TeamForge Webhooks-based Event Broker on the TeamForge Application Server. For more information, see Install the TeamForge Webhooks-based Event Broker.

Configure Jenkins Integration Plugin to Notify the Webhooks-based Event Broker

The new Jenkins integration plugin v2.0.6, released with TeamForge 18.3, which if configured can notify either the native TeamForge Webhooks-based Event Broker or EventQ about the build data.

CollabNet Plugin Features

  • Notify EventQ when builds complete. The CollabNet Plugin must be installed once on each Jenkins server you wish to connect to TeamForge/EventQ.
  • Notify TeamForge Webhooks-based Event Broker when builds complete.
  • Authenticate users from TeamForge. If set up as the “Build & Test” application, it can even use Single Sign-On.
  • Authorization from TeamForge, including the ability to set permissions in Jenkins based on roles in your TeamForge project.
  • Upload the build log or workspace artifacts to the TeamForge Documents.
  • Upload workspace artifacts to the TeamForge File Release System, as a post-build publishing task or as a build promotion task.
  • Open/update/close TeamForge Tracker artifacts based on the Jenkins build status.
  • Upload workspace artifacts to the Lab Management Project Build Library. (Requires CollabNet Lab Management).

    Click here to know more about the requirements for installing the latest CollabNet plugin.

It is highly recommended that you configure Jenkins to notify the TeamForge Webhooks-based Event Broker for TeamForge-Jenkins integration.

Use the following instructions to have the Jenkins integration plugin notify the native Webhooks-based Event Broker.

  1. If you are integrating TeamForge and Jenkins for the first time:
    1. Log on to the Jenkins Server as a previliged Jenkins user, navigate to Manage Jenkins > Manage Plugins > Available.
    2. Select the latest CollabNet Plugin and install the plugin.
    3. Restart your Jenkins server.
    4. Go to step 4.
  2. Existing TeamForge-Jenkins integrations that use CollabNet Plugin v2.0.4 (or earlier):
    1. Log on to the Jenkins Server as a privileged Jenkins user, navigate to Manage Jenkins > Manage Plugins > Updates.
    2. Select the latest CollabNet Plugin and install the plugin.
    3. Migrate Jenkins Data from EventQ’s MongoDB database to TeamForge database and proceed to step 4.
  3. Existing TeamForge-Jenkins integrations that use EventQ Jenkins Adapter v2.0 (or earlier) plugin:
    1. Log on to the Jenkins Server as a privileged Jenkins user, navigate to Manage Jenkins > Manage Plugins > Installed.
    2. Select the EventQ Jenkins Adapter v2.0 and click Uninstall.
    3. Select the Available tab.
    4. Select the latest CollabNet Plugin and install the plugin.
    5. Download the migrate_jenkins_plugin.sh script and save it to <JENKINS_HOME_DIRECTORY>/jobs/.
    6. Change ownership of the migrate_jenkins_plugin.sh file.
      chmod 755 migrate_jenkins_plugin.sh
      
    7. Run the migrate_jenkins_plugin.sh script.
      ./migrate_jenkins_plugin.sh
      
    8. Migrate Jenkins Data from EventQ’s MongoDB database to TeamForge database and proceed to step 4.
  4. Configure an Individual Jenkins Job to notify the TeamForge Webhooks-based Event Broker.

    1. Create a build source and have the configuration details handy for the following steps.
    2. As a privileged Jenkins user, locate the job you wish to report build data to TeamForge Webhooks-based Event Broker and navigate to its configuration page.
    3. Add a post-build action to Notify TeamForge/EventQ when a build completes.
    4. Select the Notify TeamForge check box.
    5. Enter the TeamForge WebHook URL to which the build data will be sent, Username, and Password in the respective fields.

    6. By default, the Optional TeamForge Association View check box is selected. If required, you can override the global configuration by entering the TeamForge URL and user credentials.
    7. Save the job configuration.

    8. Run a build to test the new configuration and verify configuration. Information and errors will be reported to your Jenkins log and to the build console.

Migrate the Existing Jenkins Data from EventQ to TeamForge

If you have configured the new Jenkins integration plugin v2.0.6 to notify the TeamForge-based Webhooks Event Broker, you need to migrate the Jenkins data from EventQ’s MongoDB database to TeamForge database, after upgrading to 19.3.

To migrate the Jenkins data from EventQ’s MongoDB to TeamForge database:

This migration process is two-fold:

  1. Extract the existing Jenkins data from EventQ’s MongoDB database and generate an SQL file based on the database option chosen.
  2. Execute the generated SQL file on the TeamForge database (Postgres/Oracle).

Extract Jenkins Data from EventQ MongoDB

  1. Download the Jenkins plugin jenkins-1.0.jar.

  2. Run this command to execute the migration script.

    java -jar jenkins-1.0.jar -migrate
    
  3. Enter the MongoDB hostname as localhost or just press ENTER for localhost to be taken as default host name.
  4. Enter the MongoDB port number or just press ENTER for 27017 to be taken as default port number.

  5. Enter the MongoDB database name for EventQ.

  6. Enter the MongoDB username and password.

  7. For Does TeamForge use Oracle Database [y/n]:, press y if you use Oracle. Press n if you use PostgreSQL.

    The migration script is executed and generates the jenkins_data_migration.sql file.

Execute the SQL File on PostgreSQL/Oracle Database

  • To execute the SQL file on PostgreSQL Database:

    1. Log on to your TeamForge Server.

    2. Run this command to import the migrated data.

      sudo /opt/collabnet/teamforge/runtime/scripts/psql-wrapper <filepath of `jenkins_data_migration.sql`> 
      

      OR

      cat <filepath of `jenkins_data_migration.sql`> | sudo /opt/collabnet/teamforge/runtime/scripts/psql-wrapper 
      
  • To execute the SQL file on Oracle Database:

    1. Log on to your Oracle database.

    2. Run this command to import the migrated data.

      @<filepath of `jenkins-data-migration.sql`>