Continuous Integration – Defining Tasks

  • Post author:
  • Post category:C I
  • Post comments:0 Comments

Now that we have our base code in Git and a link to the Continuous Integration server, it’s finally time to see the first step of Continuous Integration in action. This is done by defining tasks in the Continuous Integration server such as triggers, which makes the entire Continuous Integration Process as seamless as possible. Letā€™s make a change to our code in Visual Studio.

Step 1 āˆ’ Go to the Demo.aspx page in Visual Studio and make a change to the title of the page.

Step 2 āˆ’ If we query our Git repository via the git status command, you will in fact see that the Demo.aspx file has been modified.

Now we need to ensure that every change in our code should trigger a build in our continuous integration server. For this, we need to do the following changes.

Step 3 āˆ’ Go to your project dashboard and click the triggers section and click Add new trigger.

Step 4Ā āˆ’ In the next screen that comes up, chooseĀ VCS trigger, which will be used to create a trigger so that when check-in is made to the repository, a build will be triggered.

Step 5 āˆ’ Click Show Advanced Options and ensure the options shown in the following screenshot are selected.

Step 6 āˆ’ Click Save. You will now see the trigger successfully registered as shown in the following screenshot.

Step 7 āˆ’ Now itā€™s time to check in our code into the Git repository and see what happens. So letā€™s go to our command prompt and issue the git add command to stage our changed files.

Step 8 āˆ’ Now issue the git commit command, and it will push the changes into the Git repository.

Step 9 āˆ’ If you now go to your Projects Overview screen, you will now see a new build would have been triggered and run.

If you see theĀ Changelog Tab, you will see theĀ git commentĀ which triggered the build.

Letā€™s try it one more time. Letā€™s make another change to the Demo.aspx file. Letā€™s carry out a git add command and a git commit command with the following commit message.

You will now see a build is automatically triggered in the Project dashboard in TeamCity.

The build will show a success message.

You will now see the message of ā€˜Second commitā€™ which was used when the change was committed to the git repository.

We have now successfully completed the first part of the Continuous Integration process.

Leave a Reply