Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

If you do not already have SourceTree you can download it at https://www.sourcetreeapp.com/.

Once you install the SourceTree software log on to UConn’s central Git repository  https://bitbucket.uconn.edu/projects/kfs

Step-by-step guide

Getting Starting with Git and SourceTree

  1. After downloading SourceTree and launching the program, you will be prompted with two options.  Choose to option to connect to Bitbucket Server.
    1. Root is: https://bitbucket.uconn.edu
    2. Username is your NetID: IE: jtk17003
      1. **If issues or errors are encountered, you may have a bad installation.  Attempt a fresh install.  You may have to manually delete out the dbscripts folder on your local in order to get the Clone mentioned below to work.
  2. Click on the Kuali Financial System link then the dbscripts link

    Image Removed

    Image Removed

     

    Image Added

    There are two repositories allocated for scripts  dbscripts-test for non-production environments and dbscripts for production.   Click on the link for the appropriate environment.

    Image Added
    Which will bring to the next page...

  3. Click on the Clone link under the ACTIONS heading on the left side of the page this will display a dialog box with a “Clone In SourceTree” option.
    Image RemovedImage Removed.  This is a one time procedure that will create a local copy of the repository and link it to the main dbscripts repository.
    Image Added

    Click on the Clone the Clone In SourceTree button it will let you specify where your local repository will be located. When you decide click Clone.
     Image Removed This will clone the repository and open SourceTree on your workstation. **NOTE**, OneDrive does not seem to work with SourceTree.  Choose a Non-OneDrive folder.


    Click   The path for the test repository will be /my-directory/git-repository/dbscripts-test
     
    Image Added

  4. In SourceTree click on the Branch icon on the menu bar, you will create a new branch for every JIRA ticket is linked to a sql script.


    1. In the New Branch area enter the name of your branch (please include your net-id the JIRA ticket number in the name) and click Create Branch.  The branch name will appear under the Branches heading on the left.
      Image RemovedImage Added

    2. Double click on the branch name.  This is now your working branch you will create all your scripts here.  Please note that the branch will not be noticeable in the directory structure, Git keeps track where you are working and keeps your branch isolated from the master repository.


Committing you scripts.

Info

It is critical that you save the each script in the correct directory.  You should save scripts to run in the KFS schema in the kfs-scripts directory and likewise scripts for the Rice(KR) schema in the kr-scripts directory.  After testing you can commit your scripts to the Git repository as follows:

...

hiddentrue

...

  1. Open SourceTree

  2. Make sure your branch nameunder the BRANCHES heading is highlighted

 

Filter by label (Content by label)
showLabelsfalse
max5
spacesEFS
showSpacefalse
sortmodified
reversetrue
typepage
cqllabel = "kb-how-to-article" and type = "page" and space = "EFS"
labelskb-how-to-article

  1. Click on the Uncommitted changes line under the Description heading on the top of the page.  You should see the file you created listed under the Unstagedfiles heading. The line with the Image Added icon indicates new files ready to be staged. 


  2. Click the box next to the file and it will migrate the Staged files section.
    Image Added

  3. Click the Commit icon  (top left of the page)

Enter the Jira ticket number and brief description on the script.  Do not forget to click the Push changes… box under the description area then click on the Commit button on the lower right of the screen.  If you do not the changes will not be sent to the central Git server at the same time.  If you do forget you can click on the Push icon on the upper left which will send the changes.

The scripts are now ready to be reviewed and staged for execution by the uconnScriptRunnerJob batch job.

Post Commit

Script approval - creating a pull request

After you commit your script in needs to be reviewed and approved before it is placed in the main repository where the script runner job can find and execute it on the database

  1. Right click on your branch name under the BRANCHES heading and then choose Create Pull Request..  from the dropdown menu

    Image Added

    This will link to the UConn Stash site and open a Create Pull Request... page enter a brief description and the net-id of the approver and click the Create button.
    Image Added

Cleaning up

After you receive an email informing you that the pull request was approved you can delete your branch.

  1. Double click on the master branch under the BRANCHES heading on the left menu bar.

    Image Added

  2. Click the Branch icon on the top menu bar and then the Delete Branches icon

    Image Added

    Image Added
  3. Check the box next to your branch (in this case it is kps-xxx_update and click the Delete Branches button.
  4. If you wish you can also delete the scripts you just created.