Documentation

No results
    gitHub

    Bitbucket Data Center repo setup

    Important: the APIs used by Bitbucket Data Center and Bitbucket Cloud differ, resulting in a different setup as well.  Consult this page if your repo is in Bitbucket Cloud.

     

    Several steps must take place first on the Bitbucket Data Center side.

    Create a Bitbucket Data Center Access Token

    To give the Model Hub access to fetch models from a Bitbucket Data Center repository, it is necessary to configure access using an access token.  

     

    There is three main types of access tokens for Bitbucket Data Center (used for scripting, CI/CD, and API access), scoped to different levels of access:

    • Access tokens for a Repository:  allows administrators to implement fine-grained access control for specific repositories..  This is ideal for tasks like managing one repository or providing a CI/CD tool access to a single code source.
    • Access tokens for a Project: project permissions in Bitbucket Data Center allow you to manage access to repositories within a project in an aggregated way

     

    For the Hackolade Model Hub, you need an Access Token for a Repository: 

    • navigate to the repository of your organization

    Bitbucket Data Center repo settings

     

    • in the side menu and select Repository settings, then choose Access tokens.
    • click to Create a token.
      Hub Bitbucket Data Ctr access tokens

       
    • Assign to the token the following scopes: Repositories > Read, and Webhooks > Read and write
      Hub Bitbucket Data Ctr create access token

       
    • Save the generated token securely. You will use this token later to configure the Git provider integration within Hub.

      Hub Bitbucket Data Ctr copy access token


       

    Hub Bitbucket Data Ctr access token created
     

     

     

     

    Create a Bitbucket Data Center Webhook

    Webhooks in Bitbucket Data Center provide a way to configure Bitbucket Data Center to make requests to an external service whenever certain events occur in Bitbucket Data Center. They allow automation of workflows by triggering actions in other tools or services immediately after those events happen, without the need for continuous polling.

     

    This is how the Hackolade Model Hub gets notified of the creation of a new model or change to an existing model in any folder of the default branch for your repository, or repositories.

     

    You may create one webhook per project/repo.  But then you MUST use the same webhook "Secret token" (not be confused with the access token) for each webhook of each project.  Or, if you have multiple repos in a group or subgroup, and they are all to be replicated with the Model Hub, then you may issue a single webhook for that group or subgroup.

     

    To create a webhook in Bitbucket Cloud so that it notifies the Model Hub when changes are pushed to the repository:

    • In Repository settings, navigate to the Webhooks page from the side menu.
      Hub Bitbucket Data Centerwebhooks
       

    • Click Add webhook and enter the following details:

      • Title: Give the webhook a descriptive name (e.g., Hackolade Model Hub sync).
      • URL: Enter the sync endpoint of your Model Hub domain, which is typically formatted as the Hub URL followed by the specific endpoint. Example: https://<your organization>.hackolade.com/gateway/public/sync
      • Status: Set the status to Active.
      • Secret: create and preserve in a safe location the secret to be used to validate the webhook request
      • Authentication; leave this choice to None
      • Events: Configure the trigger to be a Repository Push event (often the default option).

        Image

         
    • Save the webhook configuration.

     

    Hub Bitbucket Data Ctr webhook created
     

     

    Create the Model Hub configuration

    Once the previous steps are all completed, go to the the Git Providers tab of the admin panel, then click on the button + setup Git Provider, and select Bitbucket Cloud.

     

    Webhook URL: enter the sync endpoint of your Hackolade Model Hub, and already used above. This typically follows the format: /gateway/public/sync endpoint of your Model Hub domain (e.g., https://<your organization>.hackolade.com/gateway/public/sync)

     

    Use the Access token and Webhook secret token saved during the execution of the previous steps to configure the Model Hub.

     

    Model Hub Bitbuclet Data Ctr add config
     

     

     

    Click on the button to Save configuration.  Then in the Add Repository screen, type the name of your organization in your Bitbucket Cloud instance.  Then select the repository that you want to replicate to the Model Hub database:

     

    Model Hub Bitbuclet Cloud add repo config

     

     

    You may edit the configuration at a later time if desired.

     

    Model Hub Bitbuclet Cloud edit config

     

    Troubleshooting

    To check the status of the webhook, click on the Edit button, then scroll to the Recent events section at the bottom of the screen.

     

    Hub Bitbucket Cloud webhook event logs

     

    If a failure has occurred, it appears.  Click the Event View details button and send it to support@hackolade.com for troubleshooting.