Plugin Deployment Problem
I have repackaged the accurev plugin to meet the requirements stated at:
http://confluence.jetbrains.net/display/TCD65/Plugins+Packaging
The server picks up the plugin.
However the agent now claims to not be able to find the plugin.
I have looked through the logs and can't find any reason for the error.
Any Ideas?
Please sign in to leave a comment.
Hi Abraham
There may be a delay up to 10 minutes - the agent pulls these tasks from the server periodically.
What do you see in teamcity-agent.log?
Michael
I have attached the file "C:\TeamCity\buildAgent\logs\teamcity-agent.log"
Attachment(s):
teamcity-agent.log.zip
From the log I see that accurev plugin is loaded successfully.
What do you mean by "agent now claims to not be able to find the plugin", are there any error messages in web UI?
I have attached a screenshot.
Attachment(s):
MissingAccurevPlugin.png
Hello,
I checked agent registration and found that Accurev plugin does not reported to be available
(via jetbrains.buildServer.agent.vcs.AgentVcsSupportCore#canRun)
AvailableVcs=[perforce, mercurial, jetbrains.git, svn, cvs],
Please check agent-side plugin is packed right. Please attach the plugin to analyze.
You may take a look at some descriptions on how to pack agent plugins
http://blog.jonnyzzz.name/2011/09/how-to-pack-agent-plugin-for-teamcity.html
I have attached the zip file.
Thanks
Attachment(s):
accurev.zip
Hello,
I checked the plugin. The package is ok. Please check plugin classes are loaded and registered as required.
You may add more logging to check it or try to enable agent debug logs as first step.
I know how to turn on extra loggin on the server side.
How do I do it for agents?
Also what is the point of turning on extra logging if the plugin is not loaded.
I doubt that the agent will keep repeating the reason why the accurev plugin was not loaded.
If I turn on extra logging then restart the agent the extra logging flag is reset so I can never get extra loggin at start up.
When you say that the plugin is ok, what do you mean?
Have you actually managed to install it in your system.
I meant the plugin is packed right. I have not tried to load it.
The next steps could be
- start agent under debugger with suspend=y
- put braskpoints into static constructor
- attach debugger
- make sure the code is running
If not, check META-INF/buidl-agent-plugin-*.xml file contains
valid spring beans .xml bean specification and those bean constructors are called.
To make agent start under debug set the following environment variables:
set TEAMCITY_AGENT_OPTS=-Dteamcity.agent.cpuBenchmark.enabled=false
set TEAMCITY_LAUNCHER_OPTS=-Dagent.debug.port=5432 -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5885 -Ddebug=true
I also noticed, you have 2 same enties named META-INF/build-agent-plugin-accurev.xml in accurev-agent.jar
You sould extend your extension from jetbrains.buildServer.agent.vcs.AgentVcsSupport.
The interface you implemented in the sources of plugin are not enough to make build agent to detect Accurev plugin support.
Please do not forget to return true from jetbrains.buildServer.vcs.VcsSupportConfig#isAgentSideCheckoutAvailable() method from the server side.
There were an issue in the documentation, I'll fix it.
Can you send me a link to this documentation?
Thanks
1:---------------------------
I am unable to attach a remote debugger, it says that the connection is refused.
Please note that the server and the agent are on the same machine.
The server is started at windows login.
I tried to start the agent as you suggested but, I don't know where to put the "suspend=y"
2: --------------------------
Where should the "META-INF/build-agent-plugin-accurev.xml" go in the accurev.zip
3:--------------------------
isAgentSideCheckoutAvailable() already returns 0. what other things do I need to do?
I only improced Javadocs.
The issue was you implemented not all necessary classes.
What you need to do is to add a spring bean that extends jetbrains.buildServer.agent.vcs.AgentVcsSupport.
The javadoc in the class/base interfaces are right.
Please try to implement the class and let me know if you find some issues.
Agent should listen to 5432 port on localhost
1:-------------------------
At the moment I have a class with the signature:
public class AccuRevVcsSupport extends VcsSupport implements AgentSideCheckoutAbility, LabelingSupport, CurrentVersionIsExpensiveVcsSupport
Are you saying that this is wrong and that I need to replace it with a class which has a signature of:
public class AccuRevVcsSupport extends AgentVcsSupport
2:--------------------------
Sadly I don't know much about spring, so your instruction was really confusing.
3:----------------------------
I am now able to connect to the agent. The actual port number was 5885
Listening for transport dt_socket at address: 5885
Starting TeamCity Build Agent Launcher...
Agent home directory is C:\TeamCity\buildAgent
Deleting C:\TeamCity\buildAgent\update
Deleting C:\TeamCity\buildAgent\backup
Tue Mar 27 15:09:24 BST 2012 ==> Start launch
Current JRE version is 1.6
1,
There are 2 VCS APIs on TeamCity. One API is for server side, the second one is for agent side.
I mean you need to have an implementation of AgentVcsSupport class in accure-agent.jar file.
(out of scope) For server-side VCS support we recommend to extend jetbrains.buildServer.vcs.ServerVcsSupport class
So, you shoud not change server-side of VCS support. you need to create one more class for agent-side support.
2.
In your plugin I see you declated one bean for spring. We use spring (mainly for dependency injection) both on server and agent.
For TeamCity plugin on agent you need to have META-INF/build-agent-plugin-accurev.xml file in jar (please check why you have 2 entries in the .jar for it)
with content:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans default-autowire="constructor">
<bean />
</beans>
For each spring bean you should add a <bean /> into <beans/> element.
Spring will introspect all constuctor parameters and find necessary instances in the context to instanciate the class.
3.
There are 2 processes for agent. One is called Launcher, the second is called Agent. All logic is done in the agent process. Launcher process is created to start agent process and perform upgrade.
As you specify -Dagent.debug.port=XXX for laucher process, it generates: -Xdebug -Xnoagent-Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=XXX commandline
arguments for starting agent process.
To ease debugging you may use log4j logger:
private static final Logger LOG = Logger.getLogger(AgentRunParameters.class);
1:--------------------------------
I find developing these plug-in very difficult.
I don't know:
what classes I HAVE to implement.
what classes I SHOULD implement as a nicety.
Is there a tutorial/manual for developing VCS plug-in for Accurev
2:----------------------------------
I believe that my version of the Accurev plug-in is out of date.
Is there a central repository for the Accurev plug-in (I think there is one, I just don't remember where it is).
If there is one where is it located.
3:----------------------------------
I am currently trying to fix the META-IN problem.
Thanks
To start with, you need to create a spring bean class that extends from jetbrains.buildServer.agent.vcs.AgentVcsSupport.
In the class implement:
- getName() = returns VCS plugin name (should be the same as for Server-side plugin
- getUpdatePolicy() = in the source code I saw you implemented this interface. Here you need just to return an instance of it.
That should be enough to make it work.
You mentioned about original Accurev plugins sources. I'd recommend you to fork latest version of sources and probably publish patches/fork.
If agent-side checkout ability depends on Agent Os, Hardware, software or what ever,
please consider to override canRun method as well. This method is called by the build agent to check if VCS plugin is able to work
on the machine. You may return 'false' to make build agent know that agent-side checkout is not available on the current agent.
Thanks for your help.
Everyting now seems to work.
The only thing left is this META-INF problem.
There are 2 files because one is for the agent and the other is for the server.
See attached files.
Attachment(s):
build-server-plugin-accurev.xml
build-agent-plugin-accurev.xml
Hello,
TeamCity agent will only take build-agent-plugin-*.xml files from META-INF. So this will be no problem.
I took your accurev-agent.jar and listed all filed form it:
7-Zip [64] 4.57 Copyright (c) 1999-2007 Igor Pavlov 2007-12-06
Listing archive: accurev-agent.jar
Date Time Attr Size Compressed Name
------------------- ----- ------------ ------------ ------------------------
2012-03-22 17:40:20 D.... 0 0 META-INF
2012-03-22 17:40:18 ..... 99 88 META-INF\MANIFEST.MF
2012-03-15 19:02:28 D.... 0 0 jetbrains
2012-03-15 19:02:28 D.... 0 0 jetbrains\buildServer
2012-03-15 19:02:28 D.... 0 0 jetbrains\buildServer\buildTriggers
2012-03-15 19:02:28 D.... 0 0 jetbrains\buildServer\buildTriggers\vcs
2012-03-15 19:02:28 D.... 0 0 jetbrains\buildServer\buildTriggers\vcs\accurev
2012-03-15 19:02:28 ..... 310 237 META-INF\build-agent-plugin-accurev.xml
2012-03-15 19:02:28 ..... 4820 2106 jetbrains\buildServer\buildTriggers\vcs\accurev\AccuRevAgentSideVcsSupport.class
2011-12-05 16:39:12 ..... 310 237 META-INF\build-agent-plugin-accurev.xml
2011-12-14 17:46:44 ..... 5208 1797 jetbrains\buildServer\buildTriggers\vcs\accurev\AccuRevAgentSideVcsSupport.java
------------------- ----- ------------ ------------ ------------------------
10747 4465 5 files, 6 folders
Note, here I have 2 files called META-INF\build-agent-plugin-accurev.xml. Build agent will unpack both files. This may lead agent's Spring to initialize your class twice.
Most likely, the issue was caused because you included sources along with classes.
I am trying to eliminate all plugin related errors.
Please see attached file.
Attachment(s):
stdout_20120329.log.zip
I am trying to eliminate all plugin related errors.
Please see attached file.
I can see what you meant.
The plugin is being loaded twice.
[2012-03-29 15:05:12,988] WARN [_Server_StartUp] - jetbrains.buildServer.VCS - Unable to register VCS support. VCS support for name "accurev" already registered.
Hello,
We have 2 types of teamcity-plugin.xml files.
One is for build agent (that you have), another one is for server.
The server plugin is a .zip file with
- teamcity-plugin.xml in the root
- agent folder containing agent plugin .zip files
- server folder containing server-side plugin .jar files.
As example, you may download one plugin from the list http://confluence.jetbrains.net/display/TW/TeamCity+Plugins
(for example http://confluence.jetbrains.net/display/TW/PowerShell)
To know more about plugin packing please take a look at
http://confluence.jetbrains.net/display/TCD7/Plugins+Packaging
Ok thanks.
I only have one more question.
Where is the central repo for the Accurev plug-in source code.
I can see that the plug-in is deployed from: http://teamcity.jetbrains.com/viewType.html?buildTypeId=bt138&tab=buildTypeStatusDiv
But how do I get access?
Hello,
Please see http://confluence.jetbrains.net/display/TW/AccuRev
The sources link is at the buttom.
The page states that: " snapshot of the sources is also available in the accurev-src.zip download package."
But this is not true. the sources are no longer in the download package.
Is there a way I can link to the svn repo directly?
In fact I am pretty sure that I already have a user account, though it has been a long time, since I logged on.
This is SVN sources link:
http://svn.jetbrains.org/teamcity/plugins/accurev-vcs/trunk/
That path is a http address not an svn address.
I cannot use tortoise svn to access that path.
I would have to manually download every file (Which would be very tedious.)