Bitbucket Version Control for Zeppelin Notebooks

To configure the version control for Notebooks using Bitbucket, you must perform the following tasks:

  1. Configure Version Control Settings

  2. Configure Bitbucket

  3. Link Notebooks to Bitbucket

After configuring the Bitbucket Repository, you can perform the following tasks to manage the notebook versions:

Configuring Bitbucket

You can configure Bitbucket for notebooks at per user setting level from the My Accounts or Notebooks UI.

  • To configure Bitbucket for notebooks at your account level, see Configuring Bitbucket.

  • To configure Bitbucket from notebooks, perform the following steps:

    1. Navigate to Notebooks and click a notebook.

    2. Click Manage notebook versions that is on the top-right of the notebook. The Versions panel expands as shown in the following figure.

      ../../../../../_images/ConfigGitHubinNote.png
    3. Click Configure now.

    4. In the dialog box, add the Bitbucket credentials and click Save. You can either use your Bitbucket credentials or Bitbucket App password.

    Bitbucket is now configured for your account.

Linking Notebooks to bitbucket

After configuring Bitbucket, you can link the Bitbucket repository from notebooks.

  1. Navigate to the Bitbucket profile and copy the URL from the browser’s address-bar.

  2. Click Manage notebook versions icon that is on the top-right of the notebook. The Versions panel expands as shown in the following figure.

    ../../../../../_images/ConfigGitLabinNote.png
  3. Click the Link Now option.

  4. In the Link Notebook to Bitbucket dialog box, perform the following actions:

    1. Add the Bitbucket repository URL in the Repository Web URL text field. Ensure that the Bitbucket profile has read permissions for the repository to checkout a commit and write permissions for the repository to push a commit.

    2. Select a branch from the Branch drop-down list.

    3. Add an object path file in the Object Path text field.

      A sample is as shown in the following figure.

      ../../../../../_images/LinkbbVersion1.png
    4. Click Save.

Pushing Commits to Bitbucket

After you link notebooks with a Bitbucket repository, you can start using the notebook to push commits to Bitbucket directly from a notebook associated with a running cluster.

Before you push the commits, ensure that the following requirements are met:

  • The Bitbucket profile must have write permissions for the repository to push commits.

  • The associated cluster must be running.

Steps

  1. Click Manage notebook versions that is on the top-right of the notebook. It expands and provides the version details.

  2. Click the Push icon to commit. A dialog opens to push commits. The following figure shows the version details and the Push to Bitbucket dialog.

    ../../../../../_images/Pushtobb11.png
  3. Add a commit message and click Save to push the commit to the Bitbucket repository. You can use the option force commit to force push over the old commit (irrespective of any conflict).

Note

Qubole does not store commits or revisions of notebooks. However, commits or revisions of notebooks can be fetched from users’ Bitbucket account whenever required.

Restoring a Commit from Bitbucket

  1. Click Manage notebook versions that is on the top-right of the notebook. It expands and provides the version details.

  2. Select a version from the list and click Restore to checkout that version as shown the following figure.

    ../../../../../_images/restorebb1.png
  3. Click OK to checkout that version in the confirmation dialog box.

Note

Qubole does not store commits or revisions of notebooks. However, commits or revisions of notebooks can be fetched from users’ Bitbucket account whenever required.

Creating a Pull Request from Notebooks

  1. Open the required notebook.

  2. Click on the Gear icon on the top right corner of the notebook, and select Configure Bitbucket Link. The Link Notebook to Bitbucket dialog is displayed.

  3. Click on the Create PR hyperlink.

  4. Proceed with the steps in BitBucket to create the PR.

    For more information, see BitBucket Documentation.

Resolving Conflicts While Using Bitbucket

There may be conflicts while pushing/checking out commits in the Bitbucket versions.

Note

You can use the option force commit to force push over the old commit (irrespective of any conflict).

Perform the following steps to resolve conflicts in commits:

  1. Clone the notebook.

  2. Link the cloned notebook to the same Bitbucket repo branch and path as the original notebook.

  3. Checkout the latest version of the cloned notebook.

  4. Manually port changes from the original notebook to the cloned notebook.

  5. You can commit the cloned notebook after porting changes.