# Lab: DataStage: Configure a Git server (BitBucket)

You can integrate your Git server with IBM DataStage. This integration allows you to publish jobs and related artifacts to different Git branches and load other versions of a job from Git onto the IBM DataStage Flow Designer canvas.

Using IBM DataStage Flow Designer with Git provides the following benefits:

* Helps with Continuous Integration Continuous Delivery (CICD) pipeline automation. Your assets are easily available in Git and you can move them from the development (DEV) branch to quality assurance (QA) to production.
* Helps with auditing requirements. You can simply tell who changed what.
* You can map a version of a job in the XMETA repository to a version in Git.
* You can work on multiple versions of a job by creating temporary branches.
* You can easily roll back to a prior version of a job.

The following Git repositories are supported:

* Bitbucket
* GitHub
* GitLab
* Microsoft Team Foundation Server

> For more info check out the [Managing source control with Git](https://www.ibm.com/support/knowledgecenter/SSZJPZ_11.7.0/com.ibm.swg.im.iis.ds.fd.doc/topics/c_manage_source_control_github.html) documentation.

In this lab we'll learn how to integrate DataStage with BitBucket Cloud, a free to register BitBucket platform available at <https://bitbucket.org/>.

This lab consists of the following steps:

1. [Configure DataStage with BitBucket](#1-configure-datastage-with-bitbucket)
2. [Export DataStage assets to BitBucket](#2-export-datastage-assets-to-bitbucket)

## Before you start: Registering for BitBucket

Navigate to <https://bitbucket.org/> and click on the "Get it free" button and create an account.

Create a new repo, we'll call it `datastage-jobs`. Ensure the option to create a `README.md` file is selected.

![new repo](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2F6ebcfd0e1c3b8a93ea2b382ceffcd2ded3799523.png?generation=1613580964602753\&alt=media)

Your new repo should look like this:

![generated repo](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2F0bfa0406cb8905a5b449d026cc4e6f365c6d276a.png?generation=1613580968711962\&alt=media)

Generate an "App Password" by going to your ["Personal Settings"](https://bitbucket.org/account/settings/app-passwords/). Remmeber to give the application password the read/write permission for repositories.

![app password](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2F9f8d362ee7468c75884117945838c39d3b2f960a.png?generation=1613580980612964\&alt=media)

## Before you start: Launching DataStage Flow Designer

Before we start the lab, let's switch to the `iis-client` VM and launch `Firefox`.

![Switch to iis-client](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2F4af2f82e080f3cf332a10c188968c608c54c7c11.png?generation=1613580975614829\&alt=media)

Click on `Classic Launchpad` in the Bookmarks tab. The first time you try this out, you might see a certificate error. To get past it, click on `Advanced...` and then click `Accept the Risk and Continue`.

![Classic Launchpad](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2F52d70195ca9f742e727c9f20597cbd9b76bdb19b.png?generation=1613580991556654\&alt=media)

Click on `DataStage Flow Designer`.

![Select DFD](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2F0a4b5660dde82fe06e25024dbae808fef757db84.png?generation=1613580971606620\&alt=media)

Login with the credentials `isadmin`/`inf0Xerver`.

![Log into DFD](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2Fb56ee99b5c14096d1dfebc1c436a509d9b3c558b.png?generation=1613580991013204\&alt=media)

This brings up the `DataStage Flow Designer`. Click `OK`.

![DFD is up](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2F1a5ace334747485c8194b2e16188ae23e0c4cb04.png?generation=1613580997047975\&alt=media)

## 1. Configure DataStage with BitBucket

From the IBM DataStage Flow Designer, click on the username bubble on the top right. Choose the `Setup` option. We'll be configuring the `Server` and `User` options.

![Setup git credentials](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2F62acc9f33e617703d88c61103fc006df3c12ba0f.png?generation=1613580984212323\&alt=media)

For the `Server` click on the `Git` tab and input the following:

* **Git repo**: Your new repo, i.e. `https://bitbucket.org:stevemart/datastage-jobs.git`
* **Clone repo path**: A new folder name, i.e. `bitbucket/stevemart/datastage-jobs`
* **Vendor**: BitBucket

![Conifugre git server](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2Fdee5951c2759fce3f2adff97bcbd2b009d7f6e85.png?generation=1613580984500055\&alt=media)

For the `User` configuration input the following:

* **Email address**: Your BitBucket email
* **Username**: Your BitBucket username
* **Personal access token**: Your BitBucket app password from the previous step

![Conifugre git user](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2Fdce5e00ef642112c3f122ccd31d76d1c54f844fc.png?generation=1613580981956843\&alt=media)

## 2. Export DataStage assets to BitBucket

Load up any existing job or create a new one. Once loaded, click on the `Export` button that looks like an upload arrow.

![Export](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2Fe915a6799834aa124067fc675e19ef15c55fc2e4.png?generation=1613580978599435\&alt=media)

The entire DataStage project will be saved and exported to your configured BitBucket. Enter a specific commit message.

![Commit](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2Fb7a4d4514687cb5122aa2c7e271cf3651a18b76b.png?generation=1613580963774424\&alt=media)

There will be a success message if everything was exported correctly.

![Success](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2F82014935031780be2ece27741da89930894945ed.png?generation=1613580961005008\&alt=media)

Navigate back to your BitBucket repository to see the exported files.

![Exported files](https://1138345240-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEzw3DrGZcdmHwc51yL%2Fsync%2F938e0da893ab554e456c506fe526999e62effd76.png?generation=1613580955584365\&alt=media)

**CONGRATULATIONS!!** You have completed this lab!
