This Question is Answered

32 Replies Last post: Apr 3, 2012 4:20 PM by Abraham Odamteng  
Abraham Odamteng Newbie 58 posts since
Apr 16, 2010
Currently Being Moderated

Mar 19, 2012 7:07 PM

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?

Michael Kuzmin JetBrains 1,557 posts since
Jul 30, 2005
Currently Being Moderated
Mar 21, 2012 4:45 PM in response to: Abraham Odamteng
Re: Plugin Deployment Problem

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

Michael Kuzmin JetBrains 1,557 posts since
Jul 30, 2005
Currently Being Moderated
Mar 21, 2012 8:14 PM in response to: Abraham Odamteng
Re: Plugin Deployment Problem

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?

Eugene Petrenko JetBrains 2,377 posts since
Oct 4, 2004
Currently Being Moderated
Mar 22, 2012 3:17 PM in response to: Abraham Odamteng
Re: Plugin Deployment Problem

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

Eugene Petrenko JetBrains 2,377 posts since
Oct 4, 2004
Currently Being Moderated
Mar 22, 2012 10:30 PM in response to: Abraham Odamteng
Re: Plugin Deployment Problem

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.

Eugene Petrenko JetBrains 2,377 posts since
Oct 4, 2004
Currently Being Moderated
Mar 27, 2012 3:41 PM in response to: Abraham Odamteng
Re: Plugin Deployment Problem

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

and than run  "agent.bat start"

Eugene Petrenko JetBrains 2,377 posts since
Oct 4, 2004
Currently Being Moderated
Mar 27, 2012 6:11 PM in response to: Eugene Petrenko
Re: Plugin Deployment Problem

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.

Eugene Petrenko JetBrains 2,377 posts since
Oct 4, 2004
Currently Being Moderated
Mar 27, 2012 6:47 PM in response to: Abraham Odamteng
Re: Plugin Deployment Problem

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

Eugene Petrenko JetBrains 2,377 posts since
Oct 4, 2004
Currently Being Moderated
Mar 27, 2012 7:15 PM in response to: Abraham Odamteng
Re: Plugin Deployment Problem

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 class="jetbrains.buildServer.buildTriggers.vcs.accurev.AccuRevAgentSideVcsSupport" />

</beans>

For each spring bean you should add a <bean class="FQCLASSNAME" /> 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);

Eugene Petrenko JetBrains 2,377 posts since
Oct 4, 2004
Currently Being Moderated
Mar 28, 2012 7:56 PM in response to: Abraham Odamteng
Re: Plugin Deployment Problem

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.

Eugene Petrenko JetBrains 2,377 posts since
Oct 4, 2004
Currently Being Moderated
Mar 29, 2012 5:34 PM in response to: Abraham Odamteng
Re: Plugin Deployment Problem

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.

Eugene Petrenko JetBrains 2,377 posts since
Oct 4, 2004
Currently Being Moderated
Mar 30, 2012 12:46 PM in response to: Abraham Odamteng
Re: Plugin Deployment Problem

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

Eugene Petrenko JetBrains 2,377 posts since
Oct 4, 2004
Currently Being Moderated
Apr 2, 2012 9:39 PM in response to: Abraham Odamteng
Re: Plugin Deployment Problem

Hello,

 

Please see http://confluence.jetbrains.net/display/TW/AccuRev

The sources link is at the buttom.

Eugene Petrenko JetBrains 2,377 posts since
Oct 4, 2004
Currently Being Moderated
Apr 3, 2012 2:06 PM in response to: Abraham Odamteng
Re: Plugin Deployment Problem
Eugene Petrenko JetBrains 2,377 posts since
Oct 4, 2004
Currently Being Moderated
Apr 3, 2012 2:13 PM in response to: Abraham Odamteng
Re: Plugin Deployment Problem

Please try from console:

svn.exe checkout http://svn.jetbrains.org/teamcity/plugins/accurev-vcs/trunk/

Another trick is to put http://svn.jetbrains.org/teamcity/plugins/accurev-vcs/trunk/ as SVN checkout URL into latest TourtoiseSVN.

Subversion supports several protocols, at least svn:// or http:// or https://

More Like This

  • Retrieving data ...