DevOps Automation

DevOps Automation

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only

TeamCity with UrbanCode and Jira

By IBM DevOps Expert posted Wed May 04, 2022 03:14 PM

  

Several weeks ago a client asked me about the integration capabilities of UrbanCode Deploy (now DevOps Deploy). Especially the integrations with JetBrains TeamCity and Atlassian Jira was asked.

So I started a small project to integrate them and make a short video.

Next, I needed TeamCity and Jira. I choose Dockerhub (Jira on Dockerhub and TeamCity on Dockerhub)  as it would be the easiest way to use these tools without preparing additional VMs for them.

In UrbanCode Deploy I installed the Jira plugin, as the TeamCity source plugin was available right after installation I did not need to install it.

Then I created a component using the TeamCity source settings.

The Build configuration ID can be found in your TeamCity Project overview.

Also, you would need a different user than admin (SECURITY!!) for accessing the newly build versions from TeamCity

Next, I created a Version property for this component to store the Jira Ticket/Issue IDs. With this information, I could then access them during deployment and change their states.

This property will be used then during deployment for changing the state of the associated tickets. The Jira plugin provides the “Edit Properties for Transition Issue”. Just enter a name for it, enter the property for the “Issue IDs” (use the Version property via ${p:version/TicketID}) and the target Transition name.

 

The new component versions and the associated Jira IDs are pushed from TeamCity to UrbanCode.

I did a two project setup. The first project builds the component and the dependent project pushes it to UrbanCode Deploy

In this dependent project, I added a build step (shell) that uses CURL to invoke UrbanCode Deploy’s REST interface.



First, we get the commit text from GIT, then need to push the new version to UrbanCode Deploy. Due processing time of UrbanCode I needed to wait a few seconds so that the new version is accessible then.

At last set the version property of the newly created version with the Ticket IDs


COMMITTEXT=`git show-branch --no-name HEAD`
curl -u PasswordIsAuthToken:62ac1c42-5948-4297-ae61-4fbce60d5fcd \
-k -d '{  "component": "TC-COMP" }'  \
-H "Content-Type: application/json"  \
-X PUT https://192.168.62.190:8443/cli/component/integrate
sleep 20
curl -u PasswordIsAuthToken:62ac1c42-5948-4297-ae61-4fbce60d5fcd \
-k -d '{  "component": "TC-COMP", "name": "TicketID", "value": "'"$COMMITTEXT"'", "version": "%build.number%" }' \
-H "Content-Type: application/json" \
-X PUT https://192.168.62.190:8443/cli/version/versionProperties


#UrbanCodeDeploy

0 comments
5 views

Permalink