Integration between issue tracking system, CI server and VCS. Part 2 project setup

This is the second part of blogpost about integration between issue tracking system, CI server and VCS. Part 1 is about components setup. Part 3 is about resolving an issue.

1. Use case scenario: create a project

Use Case Name: Start a project

Actor: Developer

1.1. Create project and repo in Stash

Login to Stash and create a new project. createproject1

createproject2

Then create a repo in this new project. Let’s give it the same name as for the whole project.

createrepo1

The new repo address has the following format:

http: http://<loginame>@<stash-ip>:<stash-port>/scm/<project>/<repo>.git

Default <stash-tcp> is 7990. Note the last number!

ssh: ssh://git@<stash-ip>:<ssh-stash-tcp>/<project>/<repo>.git

Default <ssh-stash-tcp> is 7999. Note the last number!

In our particular case: http://mchudinov@10.216.107.17:7990/scm/math/math.git

ssh://git@10.216.107.17:7999/math/math.git

Note that we use git as a login name in ssh variant. Real login name is not needed because of authentication with SSH keys pair.

 

1.2. Import existing code to Stash

In local project folder do the following command:

git init
git add --all
git commit -m "Initial Commit"
git remote add origin ssh://git@10.216.107.17:7999/math/math.git
git push origin master

Or use any Git gui for this.

C:\math>git init
Initialized empty Git repository in C:/inetpub/wwwroot/php/math/.git/
C:\math>git add --all
C:\math>git commit -m "Initial Commit"
[master (root-commit) 9dcff89] Initial Commit
 8 files changed, 277 insertions(+)
....
C:\math>git remote add origin ssh://git@10.216.107.17:7999/math/math.git
C:\math>git push origin master
Counting objects: 11, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (11/11), done.
Writing objects: 100% (11/11), 3.23 KiB, done.
Total 11 (delta 1), reused 0 (delta 0)
To ssh://git@10.216.107.17:7999/math/math.git
* [new branch]      master -> master

 

1.3. Create project in JIRA

Now let’s go to JIRA. We can use an Atlassian-products-menu in the upper-right corner to switch between programs.

atlassianmenu

Note that JIRA user must be a member of administrator group in order to be able to create a new project.

createprojectjira1

 

 

Its is better to name the new project with the same name as in Stash just to keep it in order (there is no direct binding by project name).

createprojectjira3

 

Choose the type of the project the fits our needs best.

createprojectjira2

 

Let’s check that Stash is ready for cooperation with JIRA. Go to project administration page and check that Stash is linked as a development tool.

createprojectjira4

 

1.4 Create build in TeamCity

Create a new project in TeamCity. Note that user must be a member of a group with administrative privileges in order to create new projects and builds.

Go to Administration menu and choose Project. Press [+Create project] button.

createprojecttc1

 

Let’s name the new project with same name as in Stash.

createprojecttc2

Now we need a build configuration for the newly create project. Go to Administration->[Math project] edit->press Create build configuration button.

createprojecttc3

 

I prefer to name the build after branch it will checkout sources from. Then press button [VCS settings].

createbuild1

 

Leave VCS checkout mode “Automatically on server” if you use authentication with SSH-keys. Then press button [+ Create and attach a new VCS root].

Now create and attach VCS root. Set git as VCS type. Set correct address for git repo. It will be

ssh://git@10.216.107.17:7999/math/math.git in our case. Locate a private key in the TeamCity server. TeamCity should have it’s own key to access Stash. Test connection and save.

createbuild3

Now configure build tasks and a VCS build trigger.

createbuild4

And now we are ready to run the build and watch the results!