Skip to main content

1. Connect repository

From the Home page, select Deployments in the left-hand navigation menu to access the Deployments interface. Click the Setup connection button to begin syncing with your code repository.
Mage Pro deployments button
Once you are in the connect repository UI take the following steps: Step 1: Set your directory as the user code path you intend to use for your project.
  • In Mage Pro the default directory will be /home/src/default_repo.
  • If you changed the USER_CODE_PATH environment variable in the Mage Cloud Management Portal, your directory will need to reflect that change.
Step 2 (optional): Set your target directory for your deployment if it will be different from your top level directory.
  • If you have a nested GitHub project, you may want to set the target directory to /home/src
Mage Pro deployments button

1.1 Syncing to Github

Step 1: Click the “Connect” button to the right of the GitHub connection
  • This will take you to the GitHub sign-in authentication
Step 2: Sign in with your Github login credentials
  • After authenticating you will return to the Mage-Pro deployment app
  • You should now see that you are connected to Github
Step 3: Select the your Github organization from the dropdown list.
  • If there are no organizations listed, add an organization to the text field below and click the Set organization button
Step 4: Select the repo you want to commit code to by clicking the repository drop down box
  • You should see all your Github repos here if you authenticated correctly
Step 5: Select your branch (usually main or master) to commit your code to by clicking the dropdown box and selecting the branch name Step 6: Click the “Deployments” button to see a list of commits from your Git hosting vendor, and deploy from the most recent or any specific commit.
Mage Pro install app button
If you need to connect deployments to a private Github repo, provide an organization then click the Install Mage Pro app on Github button.

1.2 Syncing to BitBucket

Mage Pro now supports integration with BitBucket repositories for version control, collaboration, and deployments.

Connect workspace

Go to the Deployments application and use Mage Pro’s “Connect repository” feature to link your BitBucket account through secure authentication. From the Home page, select Deployments in the left-hand navigation menu to access the Deployments interface. Click the Setup connection button to begin syncing with your BitBucket repository. Connect to BitBucket using Oauth tokens: Once you are in the connect repository UI take the following steps: Step 1: Set your directory as the user code path you intend to use for your project.
  • In Mage Pro the default directory will be /home/src/default_repo.
  • If you changed the USER_CODE_PATH environment variable in the Mage Cloud Management Portal, your directory will need to reflect that change.
Connect repository
Step 2: Click the “Connect” button to the right of the BitBucket connection
  • This will take you to the BitBucket sign-in authentication
Step 3: Sign in with your BitBucket login credentials
  • After authenticating you will return to the Mage-Pro deployment app
  • You should now see that you are connected to BitBucket
Connect Button
Step 4: Select your BitBucket workspace from the dropdown list.
  • If there are no organizations listed, add an organization to the text field below and click the “Set organization” button
Step 5: Select the repository from the dropdown menu.
  • You should see a list of all the repositories that were created in the workspace.
Step 6: Finally, select the production branch from the dropdown list
  • The production branch is the primary branch that your production code will mirror.
Bitbucket workspace

Conclusion

Integrating Mage Pro with BitBucket and GitHub through OAuth credentials enables seamless version control for data pipelines. Teams can use both the visual Mage Pro interface and standard Git commands across both platforms, ensuring robust collaboration and deployment workflows for production data systems.

3. Version control application and Git terminal commands

Once connected to a GitHub account, you can efficiently manage your codebase by pushing and pulling files directly from the terminal. Utilize standard Git commands to perform various version control operations, such as: git checkout -b <branch-name> (Creates and switches to a new branch named <branch-name>, enabling isolated development for features or fixes.) git status Displays the current state of the working directory and staging area, highlighting modified, staged, and untracked files. git add . (Stages all changes in the current directory and its subdirectories, preparing them for the next commit.) git commit -m "<commit-message>" (Records the staged changes in the repository with a descriptive message <commit-message>, creating a new commit in the current branch.) git push origin <branch-name> (Uploads the commits from the local <branch-name> to the corresponding remote branch on GitHub, making the changes available to collaborators.)
Mage Pro install app button

3.1 Troubleshooting version control application git commands:

When trying to connect to github, you may run into a few roadblocks along the way
  1. Make sure you are in the correct folder
    1. home/src/<Your user code path>
  2. you may need to globally configure your email and username to your gituhub.
    1. git config --global user.email "[your_email@example.com](mailto:your_email@example.com)"
    2. git config --global [user.name](http://user.name/) "Your Username"

4. Merge pull request

Once you push code to your git branch, head to Github and merge the pull request. Once the pull request is merged your deployment will be available in the deployments application interface.

5. Deploying code

Mage simplifies the deployment of code to production pipelines. Follow these steps to deploy your pipeline’s CI/CD Git branches. Currently, Mage Pro offers developers a flexible way to deploy code to different Git branches through its terminal.
  1. Once you have merged the pull request in Github navigate back to the deployments tab and click deployments highlighted in green in the top
  2. Click the Deploy button to deploy the current version you just merged
    • To revert to a previous version, simply click the “Rollback” button to deploy the desired version.
Mage Pro deployments page

Sync to GitLab

This part of the guide walks you through the process of connecting your Mage Pro environment to GitLab. Once connected, your team will be able to push and pull code from GitLab repositories, collaborate on pipeline development, and maintain version history of your data workflows.

Update environment variables

First, You will need to set the following environment variables in your Mage environment:
  1. GITLAB_CLIENT_ID: the application ID you retrieved in the previous step
  2. GITLAB_CLIENT_SECRET: the secret you retrieved in the previous step
  3. GITLAB_HOST (optional): hostname for your GitLab instance.
GitLab Environment Variables

Authenticate with GitLab

Next developers will have to authenticate the Mage Pro application with GitLab. To do this they should:
  1. Navigate to the import existing feature by clicking on the dropdown menu located in the top right of the application.
  2. Click the “Import existing” button
  3. Scroll down and then click the Authenticate with GitLab button. This will take you to the GitLab authentication page where you will sign into your account.
Authenticate Mage Pro with GitLab
  1. Sign into your GitLab account and then make sure the Mage Pro application is installed on the account.
GitLab Sign in
  1. Ensure the Mage Pro application is installed onto your Gitlab account
Currently the deployments application is only available for GitHub, GitLab, and Bitbucket users.

Push and pull code

Finally developers can use the version control application to push and pull code from Gitlab. You can see the documentation above for use of the version control application.
I