Git Sync feature

Git Sync allows you to version control your apps on DronaHQ Studio by connecting them with a Git hosting provider such as GitHub, GitLab, Bitbucket, and more, making it easier to track changes, make rollbacks or collaborate using git branches. Also, we can connect to any app in the same or other account enabling users to seamlessly move between different environments.
NOTE: For Git sync to work the user needs Git hosting service which supports SSH protocols and currently it is available on self-hosted and not available on the cloud.

Prerequisite

To connect your apps on DronaHQ Studio with Git, you must have a GitHub account, or any other version control accounts such as GitLab, Bitbucket, etc., and must have basic knowledge of git operations.

Setting up Git Repository

  1. Open up a git service account and create a repository.

  2. From the repository, copy the SSH URL. This URL will help to connect the app on the studio to the git repository.

  3. log in to DronaHQ Studio and create an app. Open the app.

  4. Go to Publish > Git Operation.

    git sync

  5. On the Configure window, paste the SSH URL and click on Generate key to generate an SSH key.

  6. The SSH key, which is basically an authentication scheme, will be generated on the window. Copy the SSH key.

  7. Add the SSH key to the repository, you can view the steps to add the SSH key in the Adding SSH Keys to Git Service accounts column and after that go to the app on the studio, click on Test & Save Connection.

The connection is successful and ready to use other features.

Adding SSH Keys to Git service accounts

Adding SSH key in GitHub

  1. To add this SSH key to the GitHub account. Go to GitHub> Settings> SSH and GPG Keys> New SSH key.

  2. Provide the necessary details, like Title, and paste the SSH key copied from the app on Studio. Click on Add SSH key. After this, it will ask for confirmation and a password.

NOTE: The default branch for connection is Master for GitHub.

Adding SSH key in Gitlab

  1. To add this SSH key to the Gitlab account. Go to GitLab> User Settings> SSH Keys.

  2. Provide the necessary details, like Title, and Expiry date, and paste the SSH key copied from the app on Studio. Click on Add key.

Adding SSH key in Bitbucket

  1. To add this SSH key to the GitHub account. Go to Bitbucket> Settings> SSH Keys (under security)> Add key. You have to add the key at the account level instead of the repository level.

  2. Provide the necessary details, like the Label, and paste the SSH key copied from the app on Studio. Click on Add key.

Using Git in Action

The working is similar to using git, on Studio after connecting to the git repository, one can commit the changes and push them to the remote branch of the repository. You can push the changes and also pull the changes from the repository. You get two more tabs, one is Push where the user can commit and push the change to the connected repository and another is Pull where the user can pull and verify changes from the repository (user can pull changes to the same app or different apps).

Push to the repository

In this window, users can make changes and commit to the branch of the repository. It will ask for the branch to which you want to commit along with a commit message.
Your app will be saved in the DHQ_Microapp.json file in your repository’s root directory, If the repository does not contain the following file, then it’ll be auto-created or overwritten on subsequent updates in the repository. Please do not make any changes to that file.

This is useful when you are developing your app further and want it to sync with the repository with which your app is linked.

Git Tag - Create a tag with the commit

Git Tagging is used to tag specific points in a repository’s history as being important. This acts as a specific snapshot for important commits. Typically, people use this functionality to mark release points (v1.0, v2.0 and so on).

You can provide a tag for your commit with some tag descriptions, which will be useful to refer to in later development.

After this hit Commit & Push.

NOTE: Once you commit and push changes, the progressions are additionally distributed for the app viewers. Please note that the deployed version of one branch doesn’t influence the other. For instance, in the event that you are dealing with the main branch m1 and you deploy the changes from m1 branch, it will not affect the changes of the master branch

Pull from the repository

If your local branch is not in sync with the remote branch of the git repository, you pull the latest changes by clicking on the pull button at the bottom left corner.
Select the branch whose app changes you want to overwrite in your current app.

NOTE: Your current app changes, if not committed to git before this step gets lost.

Git Tag - Pull from tag

While pulling from a branch you can also select a specific git tag. This will help you to take upon your project from the commit of the tag itself without affecting your developement. Simple click on Pull from Tag, and click checkout respective to the git tag your want to continue with.

Important :
While we pull the files from the repository, we have to make sure that the same connectors and APIs with the same name are needed to be present in the account. It works the same as the functionality while importing files, you can refer here to know more.