Skip to main content

Version: 23.10

TeamCity CI Example

TeamCity is a popular CI tool for automating tasks related to building, testing and deploying software.

Journey SDK Dependency

In order to build the Home Loan application, it needs to declare a dependency to Journey SDK libraries. There are several approaches you can choose from.

  • Option 1 (Recommended) Unzip the SDK on your file system and use Ant's -lib option to point to the folder with the libraries; for example, ant -lib "SDK_HOME/lib". In TeamCity you can add the SDK_HOME variable to your build configuration.

    alt-text

  • Option 2 Add SDK libraries to the project structure, and then use Ant's -lib option to point to the folder containing the libraries.

  • Option 3 Add the SDK libraries in the Ant lib folder.

  • Option 4 Add all the libraries on the CLASSPATH environment variable.

The following example assumes you have selected the recommended approach (Option 1) and, therefore, the SDK is unpacked somewhere on your file system.

Home Loan Example

Project builds are handled via jobs in TeamCity. Follow these steps to setup a TeamCity CI job for the Home Loan application.

info

In this example, we refer to the SDK_HOME environment variable using the Windows syntax $SDK_HOME.

On a Unix-based system, use %SDK_HOME% instead.

  1. Click Administration, then click Create project.

    alt-text

  2. Configure how to retrieve the source code; that is, checkout the Application Package (Forms, Functions, Tests). For example, if you're using Git, enter the URL to the Git repository. If the repository is not public, you may also need to configure the credentials. Finally, click Proceed.

    alt-text

  3. Enter a project name and build configuration name, then click Proceed.

    alt-text

  4. TeamCity suggests a build step if a build file is detected. Select the 'Ant' build step and click Use selected.

    alt-text

  5. If you need to modify the auto-detected 'Ant' build step, click Edit.

    alt-text

    TeamCity also provides options to add more build steps and to repeat the auto-detect step.

  6. Add 'app-test' to the target in order to execute any local unit tests and build the Application Package.

    alt-text

  7. If you want to deploy to a Journey Manager (JM) server, add 'app-deploy' to the target and set the JM server endpoint properties.

    alt-text

  8. Add and configure build triggers, such as Branch Remote Run Trigger, as necessary.

    alt-text

  9. Enter details of the artifacts that you want to keep when the job is complete; for example, the application package zip file.

    alt-text

  10. Click Run to start the job.

    alt-text

    You can view the build log when the job is complete. A sample build log is shown below.

Sample Build Log

Here is a sample of the logged output from a successful build, test and deployment of the application package.

[12:52:46]The build is removed from the queue to be prepared for the start
[12:52:46]Collecting changes in 1 VCS root (1s)
[12:52:47]Starting the build on the agent ...
[12:52:49]Clearing temporary directory: C:\TeamCity\buildAgent\temp\buildTmp
[12:52:49]Publishing internal artifacts
[12:52:49]Using vcs information from agent file: ceb8084f070a40fc.xml
[12:52:49]Checkout directory: C:\TeamCity\buildAgent\work\ceb8084f070a40fc
[12:52:49]Updating sources: auto checkout (on server)
[12:52:49]Step 1/1: Application Package Test And Deploy (Ant) (19s)
[12:52:49][Step 1/1] Starting: C:\eclipse-git\workspace\jdk\jdk1.8.0_152\bin\java.exe -Dagent.home.dir=C:\TeamCity\buildAgent -Dagent.name= -Dagent.ownPort=9090 -Dagent.work.dir=C:\TeamCity\buildAgent\work -Dant.home=C:\utils\apache-ant-1.10.1 -Dbuild.number=6 -Dbuild.vcs.number=fc9cfa105c5adb303ddef7d98008d47c5cda4843 -Dbuild.vcs.number.1=fc9cfa105c5adb303ddef7d98008d47c5cda4843 -Dbuild.vcs.number.HomeLoanCi_105c5adb303ddef7d98008d47c5cda4843 -Djava.io.tmpdir=C:\TeamCity\buildAgent\temp\buildTmp -Dteamcity.agent.cpuBenchmark=520 -Dteamcity.agent.dotnet.agent_url=http://localhost:9090/RPC2 -Dteamcity.agent.dotnet.build_id=6 -Dteamcity.auth.password=******* -Dteamcity.auth.userId=TeamCityBuildId=6 -Dteamcity.build.changedFiles.file=C:\TeamCity\buildAgent\temp\buildTmp\changedFiles7786677019235352563.txt -Dteamcity.build.checkoutDir=C:\TeamCity\buildAgent\work\ceb8084f070a40fc -Dteamcity.build.id=6 -Dteamcity.build.properties.file=C:\TeamCity\buildAgent\temp\buildTmp\teamcity.build9136414440133715773.properties -Dteamcity.build.tempDir=C:\TeamCity\buildAgent\temp\buildTmp -Dteamcity.build.workingDir=C:\TeamCity\buildAgent\work\ceb8084f070a40fc "-Dteamcity.buildConfName=Home Loan CI Build Configuration" -Dteamcity.buildType.id=HomeLoanCi_HomeLoanCiBuildConfiguration -Dteamcity.configuration.properties.file=C:\TeamCity\buildAgent\temp\buildTmp\teamcity.config6300135047770067440.properties -Dteamcity.dotnet.nunitaddin=C:\TeamCity\buildAgent\plugins\dotnetPlugin\bin\JetBrains.TeamCity.NUnitAddin-NUnit -Dteamcity.dotnet.nunitlauncher=C:\TeamCity\buildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.NUnitLauncher.exe -Dteamcity.dotnet.nunitlauncher.msbuild.task=C:\TeamCity\buildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.MSBuildLoggers.dll -Dteamcity.dotnet.nunitlauncher1.1=C:\TeamCity\buildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.NUnitLauncher1.1.exe -Dteamcity.dotnet.nunitlauncher2.0=C:\TeamCity\buildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.NUnitLauncher2.0.exe -Dteamcity.dotnet.nunitlauncher2.0.vsts=C:\TeamCity\buildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.NUnitLauncher2.0.VSTS.exe -Dteamcity.dotnet.platform=C:\TeamCity\buildAgent\plugins\dotnetPlugin\bin\JetBrains.TeamCity.PlatformProcessRunner.1.1.exe "-Dteamcity.projectName=Home Loan CI" -Dteamcity.runner.properties.file=C:\TeamCity\buildAgent\temp\buildTmp\teamcity.runner4710201647628613228.properties -Dteamcity.runtime.props.file=C:\TeamCity\buildAgent\temp\agentTmp\ant1977622259571025473runtime -Dteamcity.tests.recentlyFailedTests.file=C:\TeamCity\buildAgent\temp\buildTmp\testsToRunFirst4003191390246121507.txt "-Dteamcity.version=2017.2.1 (build 50732)" -classpath C:\utils\apache-ant-1.10.1\lib\ant-launcher.jar org.apache.tools.ant.launch.Launcher -Dmanager.url=https://my.company.com/manager/ -Dmanager.username=username -Dmanager.password=TopSecret -Dmanager.clientCode=maguire -lib C:/TeamCity/buildAgent/plugins/antPlugin/ant-runtime.jar;C:/TeamCity/buildAgent/lib/runtime-util.jar;C:/TeamCity/buildAgent/lib/serviceMessages.jar -listener jetbrains.buildServer.agent.ant.TeamCityAntBuildListener -buildfile C:\TeamCity\buildAgent\work\ceb8084f070a40fc\build.xml -lib C:\transact-sdk-18.5.0\lib app-deploy
[12:52:49][Step 1/1] in directory: C:\TeamCity\buildAgent\work\ceb8084f070a40fc
[12:52:51][Step 1/1] svc-imports
[12:52:51][Step 1/1] svc-typecheck (2s)
[12:52:54][Step 1/1] clean
[12:52:54][Step 1/1] svc-package
[12:52:54][Step 1/1] svc-test (4s)
[12:52:58][Step 1/1] app-package
[12:52:58][Step 1/1] app-deploy (9s)
[12:52:58][app-deploy] app-deploy (9s)
[12:52:58][app-deploy] Http client: created.
[12:52:59][app-deploy] Request: POST https://my.company.com/manager/secure/rest/application-package/v1/maguire HTTP/1.1
[12:53:08][app-deploy] Response: HTTP/1.1 200 OK
[12:53:08]
[app-deploy] Response: {
"archiveName": "app-home-loan-v0.1.0.zip",
"importMessage": "Application package named 'Home Loan' for organization 'maguire' was imported.",
"importStatus": "Completed",
"importTime": "2018-01-12T12:53+1100"
}
[12:53:08][Step 1/1] Process exited with code 0
[12:53:08]Publishing internal artifacts
[12:53:08]Build finished