Version off by one?

Hi,

A little background: I'm trying to add labeling support to my Rational Team Concert VCS plugin.

I've implemented the LabelingSupport interface and the label method gets called as expected, but the value of label looks like its off by one...

I was expecting that if the version returned by VcsSupportCore.getCurrentVersion is buildserver-8 and I trigger a build then the value passed to the label method would be buildserver-8.

Instead label is called with buildserver-7...

If I trigger a custom build and select "[10 Apr 13:31] (com.systematic.tools.rtc: buildserver-8) simon soendergaard: bas" as  "Last change to include:", label are still called with the value buildserver-7

In general it looks like its always one lower that what I expect.

So it the is behavour intentional and if not what could be triggering it?

Other details:
fromVersion parameter in BuildPatchByCheckoutRules.buildPatch() is also off by one.
toVersion parameter in UpdateByCheckoutRules2.updateSources() is also off by one.
Tested with TeamCity 6.5.6 and 7.0.2

Thanks,
/Simon

0
12 comments

Hi Simon,

it should work as you expected. What was the revision on the changes tab of the build you labeled?

0
Avatar
Permanently deleted user

The revision was buildserver-8


I've just reproduced it again and took some screenshoots in the process.

ME: check in new change.

TEAMCITY: serversideplugin.getCurrentVersion()
SERVERSIDEPLUGIN returns: buildserver-9

TEAMCITY UI:
pending change.jpg
ME: Press Run...

TEAMCITY: serversideplugin.getCurrentVersion()

SERVERSIDEPLUGIN returns: buildserver-9

TEAMCITY: agentplugin.updateSource():
updateSources.jpg

TEAMCITY: serversideplugin.label():
label.jpg
TEAMCITY UI:
changesTab.jpg

Here is a dump of the content of the Build Parameters tab

User Defined Parameters

no parameters defined

Actual Parameters on Agent

Configuration Parameters

Name Value used by the build
build.number 22
build.vcs.number buildserver-9
build.vcs.number.1 buildserver-9
build.vcs.number.rtctest buildserver-9
DotNetFramework2.0.50727_x64_Path C:\Windows\Microsoft.NET\Framework64\v2.0.50727
DotNetFramework2.0.50727_x86_Path C:\Windows\Microsoft.NET\Framework\v2.0.50727
DotNetFramework2.0_x64 2.0.50727
DotNetFramework2.0_x64_Path C:\Windows\Microsoft.NET\Framework64\v2.0.50727
DotNetFramework2.0_x86 2.0.50727
DotNetFramework2.0_x86_Path C:\Windows\Microsoft.NET\Framework\v2.0.50727
DotNetFramework3.0.30729.5420_x64_Path C:\Windows\Microsoft.NET\Framework64\v3.0
DotNetFramework3.0.30729.5420_x86_Path C:\Windows\Microsoft.NET\Framework\v3.0
DotNetFramework3.0_x64 3.0.30729.5420
DotNetFramework3.0_x64_Path C:\Windows\Microsoft.NET\Framework64\v3.0
DotNetFramework3.0_x86 3.0.30729.5420
DotNetFramework3.0_x86_Path C:\Windows\Microsoft.NET\Framework\v3.0
DotNetFramework3.5.30729.5420_x64_Path C:\Windows\Microsoft.NET\Framework64\v3.5
DotNetFramework3.5.30729.5420_x86_Path C:\Windows\Microsoft.NET\Framework\v3.5
DotNetFramework3.5_x64 3.5.30729.5420
DotNetFramework3.5_x64_Path C:\Windows\Microsoft.NET\Framework64\v3.5
DotNetFramework3.5_x86 3.5.30729.5420
DotNetFramework3.5_x86_Path C:\Windows\Microsoft.NET\Framework\v3.5
DotNetFramework4.0.30319_x64_Path C:\Windows\Microsoft.NET\Framework64\v4.0.30319
DotNetFramework4.0.30319_x86_Path C:\Windows\Microsoft.NET\Framework\v4.0.30319
DotNetFramework4.0_x64 4.0.30319
DotNetFramework4.0_x64_Path C:\Windows\Microsoft.NET\Framework64\v4.0.30319
DotNetFramework4.0_x86 4.0.30319
DotNetFramework4.0_x86_Path C:\Windows\Microsoft.NET\Framework\v4.0.30319
DotNetFrameworkSDK3.5_x64 7.0.30319
DotNetFrameworkSDK3.5_x64_Path C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\x64
DotNetFrameworkSDK3.5_x86 7.0.30319
DotNetFrameworkSDK3.5_x86_Path C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin
DotNetFrameworkSDK4.0_x64 7.0.30319
DotNetFrameworkSDK4.0_x64_Path C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\x64
DotNetFrameworkSDK4.0_x86 7.0.30319
DotNetFrameworkSDK4.0_x86_Path C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools
maven.project.artifactId rs-helloworld
maven.project.groupId org.jboss.as.quickstarts
maven.project.name JBoss AS Quickstarts: rs-helloworld
maven.project.version 7.1.0.Beta1b
powershell_x64 2.0
powershell_x64_Path C:\Windows\System32\WindowsPowerShell\v1.0
powershell_x86 2.0
powershell_x86_Path C:\Windows\SysWOW64\WindowsPowerShell\v1.0
teamcity.agent.home.dir C:\Tools\TeamCity-6.5.6\buildAgent
teamcity.agent.jvm.specification 1.6
teamcity.agent.jvm.version 1.6.0_21
teamcity.agent.launcher.version 18130
teamcity.agent.name pc-3263
teamcity.agent.ownPort 9090
teamcity.agent.tools.dir C:\Tools\TeamCity-6.5.6\buildAgent\tools
teamcity.agent.work.dir C:\Tools\TeamCity-6.5.6\buildAgent\work
teamcity.build.checkoutDir C:\Tools\TeamCity-6.5.6\buildAgent\work\f8fa6a0d084ce036
teamcity.build.default.checkoutDir f8fa6a0d084ce036
teamcity.build.id 22
teamcity.build.workingDir C:\Tools\TeamCity-6.5.6\buildAgent\work\f8fa6a0d084ce036
teamcity.dotCover.home C:\Tools\TeamCity-6.5.6\buildAgent\tools\dotCover
teamcity.serverUrl http://localhost:8720
vcsroot.password REMOVED
vcsroot.repositoryConnection https://jazz.net/sandbox02-ccm/
vcsroot.rtctest.password REMOVED
vcsroot.rtctest.repositoryConnection https://jazz.net/sandbox02-ccm/
vcsroot.rtctest.usecomponentnames true
vcsroot.rtctest.username john7doe
vcsroot.rtctest.workspace xx
vcsroot.usecomponentnames true
vcsroot.username john7doe
vcsroot.workspace xx
VS2010 10.0.40219.1
VS2010_Path C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE
WindowsSDKv7.0A 7.0.30319
WindowsSDKv7.0A_Path C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A

System properties

Name Value used by the build
system.agent.home.dir C:\Tools\TeamCity-6.5.6\buildAgent
system.agent.name pc-3263
system.agent.work.dir C:\Tools\TeamCity-6.5.6\buildAgent\work
system.build.number 22
system.build.vcs.number buildserver-9
system.build.vcs.number.1 buildserver-9
system.build.vcs.number.rtctest buildserver-9
system.file.encoding Cp1252
system.file.separator \
system.java.io.tmpdir C:\Tools\TeamCity-6.5.6\buildAgent\temp\buildTmp
system.MSTest.10.0 C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\MSTest.exe
system.os.arch x86
system.os.name Windows 7
system.os.version 6.1
system.path.separator ;
system.teamcity.agent.cpuBenchmark 522
system.teamcity.agent.dotnet.agent_url http://localhost:9090/RPC2
system.teamcity.agent.dotnet.build_id 22
system.teamcity.build.changedFiles.file C:\Tools\TeamCity-6.5.6\buildAgent\temp\buildTmp\changedFiles4405317980596332183.txt
system.teamcity.build.checkoutDir C:\Tools\TeamCity-6.5.6\buildAgent\work\f8fa6a0d084ce036
system.teamcity.build.properties.file C:\Tools\TeamCity-6.5.6\buildAgent\temp\buildTmp\teamcity.build3662327500353990852.properties
system.teamcity.build.tempDir C:\Tools\TeamCity-6.5.6\buildAgent\temp\buildTmp
system.teamcity.buildConfName berry
system.teamcity.buildType.id bt2
system.teamcity.configuration.properties.file C:\Tools\TeamCity-6.5.6\buildAgent\temp\buildTmp\teamcity.config6914343052324064705.properties
system.teamcity.dotnet.nunitaddin C:\Tools\TeamCity-6.5.6\buildAgent\plugins\dotnetPlugin\bin\JetBrains.TeamCity.NUnitAddin-NUnit
system.teamcity.dotnet.nunitlauncher C:\Tools\TeamCity-6.5.6\buildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.NUnitLauncher.exe
system.teamcity.dotnet.nunitlauncher.msbuild.task C:\Tools\TeamCity-6.5.6\buildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.MSBuildLoggers.dll
system.teamcity.dotnet.nunitlauncher1.1 C:\Tools\TeamCity-6.5.6\buildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.NUnitLauncher1.1.exe
system.teamcity.dotnet.nunitlauncher2.0 C:\Tools\TeamCity-6.5.6\buildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.NUnitLauncher2.0.exe
system.teamcity.dotnet.nunitlauncher2.0.vsts C:\Tools\TeamCity-6.5.6\buildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.NUnitLauncher2.0.VSTS.exe
system.teamcity.dotnet.platform C:\Tools\TeamCity-6.5.6\buildAgent\plugins\dotnetPlugin\bin\JetBrains.TeamCity.PlatformProcessRunner.1.1.exe
system.teamcity.projectName test
system.teamcity.runner.properties.file C:\Tools\TeamCity-6.5.6\buildAgent\temp\buildTmp\teamcity.runner6133346360653680031.properties
system.teamcity.tests.recentlyFailedTests.file C:\Tools\TeamCity-6.5.6\buildAgent\temp\buildTmp\testsToRunFirst4367312586380498855.txt
system.teamcity.version 6.5.6 (build 18130)
system.user.country DK
system.user.home C:\Users\sns
system.user.language da
system.user.name sns
system.user.timezone Europe/Paris
system.user.variant <empty>

Environment variables

Name Value used by the build
env.-Xdebug -Xrunjdwp:transport dt_socket,server=y,suspend=n,address=5005
env.=C: C:\Tools\TeamCity-6.5.6\buildAgent\bin
env.=ExitCode 00000000
env.ALLUSERSPROFILE C:\ProgramData
env.APPDATA C:\Users\sns\AppData\Roaming
env.BUILD_NUMBER 22
env.BUILD_VCS_NUMBER buildserver-9
env.BUILD_VCS_NUMBER_rtctest buildserver-9
env.CATALINA_BASE C:\Tools\TeamCity-6.5.6\bin\..
env.CATALINA_HOME C:\Tools\TeamCity-6.5.6\bin\..
env.CATALINA_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 -server -Xmx512m -XX:MaxPermSize=150m -Dlog4j.configuration=file:../conf/teamcity-server-log4j.xml -Dteamcity_logs=../logs/
env.CLASSPATH C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Tools\jdk1.7.0_03\bin;%M2_HOME%\bin:c:\tools\JUnit4.8.1/junit-4.8.1.jar
env.CommonProgramFiles C:\Program Files (x86)\Common Files
env.CommonProgramFiles(x86) C:\Program Files (x86)\Common Files
env.CommonProgramW6432 C:\Program Files\Common Files
env.COMPUTERNAME PC-3263
env.ComSpec C:\WINDOWS\system32\cmd.exe
env.FP_NO_HOST_CHECK NO
env.HOMEDRIVE C:
env.HOMEPATH \Users\sns
env.JAVA_EXE C:\Tools\TeamCity-6.5.6\bin\..\jre\bin\java.exe
env.JAVA_HOME C:\Tools\jdk1.7.0_03
env.JDK_16 C:\Tools\TeamCity-6.5.6\bin\..\jre
env.JDK_17 C:\Tools\jdk1.7.0_03
env.JRE_HOME C:\Tools\TeamCity-6.5.6\bin\..\jre
env.JUNIT_CLASSPATH c:\tools\JUnit4.8.1/junit-4.8.1.jar
env.JUNIT_HOME c:\tools\JUnit4.8.1
env.JUNIT_LIB c:\tools\JUnit4.8.1
env.LOCALAPPDATA C:\Users\sns\AppData\Local
env.LOGONSERVER \\DC01AAR
env.M2_HOME c:\Tools\apache-maven-3.0.3
env.MAVEN_OPTS -Xmx512M -XX:MaxPermSize=128M
env.NUMBER_OF_PROCESSORS 4
env.OS Windows_NT
env.Path C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Tools\jdk1.7.0_03\bin;c:\Tools\apache-maven-3.0.3\bin;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Git\cmd;C:\Program Files (x86)\Calibre2\;C:\Users\sns\AppData\Roaming\npm;C:\Program Files (x86)\nodejs\;C:\ProgramData\Propeople\Drush\;C:\Program Files (x86)\Propeople\Drush\GnuWin32\bin;C:\Program Files (x86)\Propeople\Drush\Php;C:\Program Files (x86)\Propeople\Drush\cwRsync\bin
env.PATHEXT .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
env.PROCESSOR_ARCHITECTURE x86
env.PROCESSOR_ARCHITEW6432 AMD64
env.PROCESSOR_IDENTIFIER Intel64 Family 6 Model 42 Stepping 7, GenuineIntel
env.PROCESSOR_LEVEL 6
env.PROCESSOR_REVISION 2a07
env.ProgramData C:\ProgramData
env.ProgramFiles C:\Program Files (x86)
env.ProgramFiles(x86) C:\Program Files (x86)
env.ProgramW6432 C:\Program Files
env.PROMPT $P$G
env.PSModulePath C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\
env.PUBLIC C:\Users\Public
env.SESSIONNAME Console
env.SystemDrive C:
env.SystemRoot C:\WINDOWS
env.TEAMCITY_AGENT_CONFIG_FILE ..\conf\buildAgent.properties
env.TEAMCITY_AGENT_LOG_DIR ../logs/
env.TEAMCITY_AGENT_MEM_OPTS_ACTUAL -Xmx384m
env.TEAMCITY_AGENT_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5006
env.TEAMCITY_AGENT_OPTS_ACTUAL -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5006 -ea -Xmx384m -Dlog4j.configuration=file:../conf/teamcity-agent-log4j.xml -Dteamcity_logs=../logs/
env.TEAMCITY_BUILD_PROPERTIES_FILE C:\Tools\TeamCity-6.5.6\buildAgent\temp\buildTmp\teamcity.build3662327500353990852.properties
env.TEAMCITY_BUILDCONF_NAME berry
env.TEAMCITY_JRE C:\Tools\jdk1.7.0_03
env.TEAMCITY_LAUNCHER_CLASSPATH ..\launcher\lib\launcher.jar
env.TEAMCITY_LAUNCHER_OPTS_ACTUAL -ea
env.TEAMCITY_PROJECT_NAME test
env.TEAMCITY_SERVER_MEM_OPTS_ACTUAL -Xmx512m -XX:MaxPermSize=150m
env.TEAMCITY_SERVER_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005
env.TEAMCITY_VERSION 6.5.6 (build 18130)
env.TEMP C:\Tools\TeamCity-6.5.6\buildAgent\temp\buildTmp
env.TMP C:\Tools\TeamCity-6.5.6\buildAgent\temp\buildTmp
env.TMPDIR C:\Tools\TeamCity-6.5.6\buildAgent\temp\buildTmp
env.UATDATA C:\Windows\SysWOW64\CCM\UATData\D9F8C395-CAB8-491d-B8AC-179A1FE1BE77
env.USERDNSDOMAIN SYSTEMATICGROUP.LOCAL
env.USERDOMAIN SYSTEMATICGROUP
env.USERNAME sns
env.USERPROFILE C:\Users\sns
env.VS100COMNTOOLS C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Tools\
env.windir C:\WINDOWS
env.windows_tracing_flags 3
env.windows_tracing_logfile C:\BVTBin\Tests\installpackage\csilogfile.log



Br,
/Simon

0

Simon,

this is quite strange.. could you please enable debug-all loging preset in TeamCity 7.0.2 at 'Administration > Diagnostics', reproduce it again and provide teamcity-server.log and teamcity-vcs.log?

0
Avatar
Permanently deleted user

Here are the logs.

I commited a change and triggered a change in currentVersion from buildserver-10 to buildserver-11. (verified via debugger)

updateSource and label was called with buildserver-10 (verified via debugger)



Attachment(s):
logs.zip
0

I found a following line in teamcity-vcs.log:

[2012-04-19 14:46:15,394]   INFO [TeamCity Agent ] -      jetbrains.buildServer.VCS - Setting build revisions on agent=pc-3263 {id=1, host=127.0.0.1:9091, agentTypeId=1, pool=Default}, buildPromotion=BuildPromotion{myId=28, myPersonal=false, myBuildTypeId='bt2', myModificationId=6, myRevisions=[BuildRevision[myVcsRootEntry=VcsRootEntry[myVcsRoot=xx@https://jazz.net/sandbox02-ccm/ {instance id=2, parent id=1}, myCheckoutRules==>
], myRevision=RepositoryVersion[myVersion='buildserver-10', myDisplayVersion='buildserver-11']]], myAssociatedBuildId=24}, revisions={xx@https://jazz.net/sandbox02-ccm/ {instance id=2, parent id=1}=buildserver-10}

it seems like plugin reports correct displayVersion, but version is off by one.

0
Avatar
Permanently deleted user

Dmitry,

Not sure if you think that the off by one error is in the plugin code or in the teamcity code base?

This is my implementation of getVersionDisplayName:

public String getVersionDisplayName(@NotNull String version, @NotNull VcsRoot root) throws VcsException {
        return version;
    }



I don't see how the plugin can cause an off by one error between the version reported by getCurrentVersion() and what is returned by getVersionDisplayName().

Br,
/Simon
0

Please check your code in the collectChanges() method in the server part of plugin, make sure you use right revisions in the ModificationData constructor. I think this behaviour can be caused by the wrong revisions given to ModificationData.

0
Avatar
Permanently deleted user

Dmitry,

You were spot on! I was in fact returning the wrong revision for version and were using the correct one for calculating the displayVersion....

Thank you for the help!

Br,
/Simon.

0

Great! :)
BTW, do you have any plans to open-source the plugin?

0
Avatar
Permanently deleted user

I would love to open-source the plugin. But I dont make the plans... I just write the code :-) With that said I will ask and try to make it happen.

Br,
/Simon

0

I see, anyway do not hesitate to ask any questions regarding plugin development.

0

Hi Simon,

I have a related question on your RTC plugin: Could you please write to teamcity-feedback@jetbrains.com or to yegor.yarko@ in the same domain to discuss it?

0

Please sign in to leave a comment.