TFS4JIRA Self-Hosted - How to update Old to new filters for all profiles present on the instance

This script should be run with TFS4JIRA Self 9.7 or higher.

This is a Python script that uses TFS4JIRA Self-Hosted API in order to rewrite old types of filters to new JQL and WIQL filtering introduced with TFS4JIRA Self-Hosted 9.6.

PREREQUISITES:

  1. TFS4JIRA Self-Hosted 9.7 or higher

  2. The latest version of Python: https://www.python.org/downloads/

  3. Python IDE: PyCharm: https://www.jetbrains.com/pycharm/download/ (we will run the script in this editor)

  4. The script:


INITIAL SETUP IN SCRIPT

  1. # Set the API endpoint URL and passwords

    1. tfs4jira_url = "<http://<server’s URL or IP>/tfs-jira-synchronizer" This is your TFS4JIRA synchroniser URL.

    2. jira_password = "" Password or Personal Access Token in case of cloud instance

    3. tfs_password = "" Password or Personal Access Token in case of cloud instance

  2. # Set the Bearer Token

    1. bearer_token = "" In order to obtain this token, please start TFS4JIRA and click “manage profiles with API” link just below the blue ‘create profile’ button. This link will take you to Swagger. Click ‘APIToken Page’ link to display the token

  3. # OPTIONAL | When entered, configuration upload will only run for the specified profile

    1. single_guid = "" ID of TFS4JIRa profile in GUID format (example: 0823900f-49ee-46fe-a62f-547b5d99d285). The script will only process profile matching provided ID, rest profiles will be skipped at the final upload stage.


WHAT WILL IT DO?

  1. The script will get the list of all the profiles in the TFS4JIRA instance.

  2. Having a list of guides, the script will do the following for each of them:

    1. download the current configuration with the new filter translation

    2. update the downloaded configuration with Jira and ADO user passwords

    3. if needed, new filters will be enabled

    4. display in console updated configuration in JSON

    5. upload updated configuration (when single_guid is provided, this step is skipped)

  3. All steps are logged in PyCharm console

  4. Script will display error messages at any step, informing what went wrong