Remote run from command line

Hello,

Can you please share the source code about how to perform "Remote Run" from command line?
Looks like it was implemented as per the discussion in the thread : http://youtrack.jetbrains.com/issue/TW-5248 and http://www.jetbrains.net/confluence/display/TW/Darjeeling+EAP+Release+Notes+%28build+10307%29.

I want to perform similar operation for one of our internal VCS (Source code control system). It would be greatly helpful if you could share it at the earliest.


Thanks,
Kumar

18 comments

Hi Kumar,

Remote run from the command line can be done with the plugin.

Please detail if you want to get more details and describe what specifically.

0

Hi Yegor,

Thanks a lot for the response!

Please refer to my another thread: http://devnet.jetbrains.com/thread/450192?tstart=0 . This thread contains the background and more details about the plugin which we are working on.

Regads,
Kumar

0

Hi Yegor,

I am getting the following error when I do a remote run using the command line utility for custom VCS version . Could you please give me some pointers about what to check to proceed further?

[Logging in] started
[Logging in] done
[Collecting changes] started
[Collecting changes] Collected 1 files for Remote Run
[Collecting changes] done
[Mapping local files to TeamCity] started
[Mapping local files to TeamCity] 1 of 1 file(s) have been mapped
[Mapping local files to TeamCity] done
[Preparing patch] started
[Preparing patch] 1 new/modified file(s)
[Preparing patch] done
[Sending patch to TeamCity Server] started
[Sending patch to TeamCity Server] sent 96 bytes
[Sending patch to TeamCity Server] done
[Scheduling personal build] started
[Scheduling personal build] run: error
Critical error has been encountered: Submitted changes cannot be applied to the build configuration.


Also, Can you please explain about the content of .teamcity-mappings.properties? An example of the properties file should be helpful?

Thanks,
Kumar
0

Hello,

   On the server side, you should implement VcsPersonalSupport interface in your VCS Support plugin on the server side.

   This interface is used to map incoming paths from your remote run files to paths relative to given VcsRootEntries.
   This interface is also used to indicate that particular path doesn't relate to VcsRootEntry (returned collection is empty).

   In general, Command line plugin converts local paths on file system to your VCS-specific paths using .teamcity-mappings.properties file, and
   VcsPersonalSupport interface converts your VCS-specific paths to paths relative to VCS Root entries (VcsRootEntry is VCSRoot + checkout rules for build configuration).

   After you've implemented VcsPersonalSupport interface, you should be able to create .teamcity-mappings.properties file on the command line runner plugin configuration page.

   The expamples of VCS-specific paths, processed by mapFullPath method, are:

   911b28b9-9212-435f-8f38-1f27297b0ea1|Test/External4/file.txt         for subversion, where '911b28b9-9212-435f-8f38-1f27297b0ea1' is unique repository ID
   perforce://perforce.labs.intellij.net:1666:////TeamServer/BuildServer  for Perforce, where  perforce://perforce.labs.intellij.net:1666:// is an indicator of the Perforce repository location.

   Hope, this helps,
   KIR

0

Hi Kirill,

Thanks for the response!

I have already implemented the VcsPersonalSupport interface in VCS support plugin. ie. the following method and also added a print statement at the begining of function to check whether it is reaching there. I don't see that statement getting printed in the logs.

//method
public Collection<String> mapFullPath(@NotNull final VcsRootEntry rootEntry, @NotNull final String fullPath) {

I am unable to create .teamcity-mappings.properties file from the command line runner plugin configuration page, it does not show the build configuration for the new VCS it only shows for the Subversion (SVN) related build configuration. After I have added some more print statements to identify the cause, looks like hasRootWithVcsClientMappingProvider(data) method in collectBuildTypesWithPersonalVcsSupport of CommandLineController returning false might be causing the problem.

The only reason why it can fail is "myVcsManager.getVcsService(new VcsSettings(entry, ""), MappingGeneratorService.class)" is returing null.

Any idea how to fix this?

Thanks,
Kumar

0

Hi Kumar,

   I'm sorry for the confusion.
   For the mapping generator to work, you should also provide an implementation either for VcsRootBasedMappingProvider interface, or IncludeRuleBasedMappingProvider interface.

   These interface are used to generate the mapping on the command line configuration page.

   Also, in your server-side plugin, you need the implementation of VcsSupportContext (better extend from ServerVcsSupport class).


   Hope, this helps,
   KIR

0

Hi Kirill,

Thanks for the very quick reply!

I will try it and let you know.

Regards,
Kishore

0

Hi Kirill,

I made the changes as you suggested (extended the required classes) but still I dont see build configuration on the command line configuration page for my custom VCS to generate the mapping file.

I am extending the following classes.

//My Vcs support class

public class AdeVcsSupport extends ServerVcsSupport implements VcsPersonalSupport, LabelingSupport, VcsFileContentProvider,
                                                                  CollectChangesByIncludeRules,
                                                                  BuildPatchByIncludeRules,
                                                                  TestConnectionSupport,
                                                                  BuildStartContextProcessor,
                                                                  VcsRootBasedMappingProvider
                                                                  {



any suggestions?

Thanks,
Kumar
0

Hello,

  Have you implemented method from VcsRootBasedMappingProvider interface to return non-empty collection?
  Have you registered the AdeVcsSupport in spring bean?

  Which format have you chosen for the Ade repository paths, returned by VcsRootBasedMappingProvider implementation?

  Regards,
  KIR

0

Do we need to register a new VcsService (ie. for the custom vcs) under the VcsManager. So that the following method call will not return null?

myVcsManager.getVcsService(new VcsSettings(entry, ""), MappingGeneratorService.class)


Regards,
Kishore

0

No, you shouldn't. For the MappingGeneratorService to work, the following code should work:

VcsClientMappingProvider provider = vcsSupportContext.getVcsExtension(VcsClientMappingProvider.class)

Hope this helps,
KIR

0

Hi KIR,

Please find the response to your questions:

1) Yes, I have implemented the method from VcsRootBasedMappingProvider to return non-empty collection.
Here is the code snippet for the same:

   // Method from VcsRootBasedMappingProvider

    public Collection<VcsClientMapping> getClientMapping(@NotNull final VcsRoot vcsRoot) throws VcsException {
        System.out.println("+++ Check point 3");                                                                                           // I also don't see this message being logged. So this method is not getting invoked
        return Collections.singleton(new VcsClientMapping(vcsRoot.getProperty(Constants.VIEW_PATH), "")); //Collection is non-empty
    }



2) Yes, I have registered the the AdeVcsSupport in spring bean. [build-server-plugin-ade.xml under the directory ade-server/src/META-INF]

<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">


<beans default-autowire="constructor">
  <bean id="ade" />



Thanks,
Kumar
0

Hello,

    Have you managed to get this code work? You should either make your VcsPersonalSupport class implement VcsRootBasedMappingProvider,
or you should override getVcsExtension method to return your implementation of the VcsRootBasedMappingProvider.

    You can take a look at the implementation of ServerVcsSupport for the example.

   Hope, this helps,
   KIR

0

Hi KIR,

We are still debugging this same issue. Can you please share the source code of any other VCS plugin for reference. Like SVN (Subversion) or any?


Regards,
Kumar

0

Hi KIR,

We are referring to the code present in http://svn.jetbrains.org/teamcity/plugins/clearcase-vcs/trunk/ as reference. It would be great if you could explain how command line remote run is implemented in clearcase tool? So that we can make similar changes to our custom VCS plugin.

Thanks in advance!

Regards,
Kumar

0

Hello,

   Sorry for delay with the answer.

   In the ClearCase plugin, the logic for personal builds is implemented in the class ClearCaseSupport, methods mapFullPath and getClientMapping.
   Also, this class has method getPersonalSupport() which returns this, because this class implements VcsPersonalSupport interface.

   Hope, this helps,
   KIR

0

Thanks a lot for your valuable support and pointers! I am able to build mapping file from UI and also trigger remote run from command line.

After overriding the getUrlSupport() method the issue got resolved.


Regards,
Kishore

0

Hello Kumar,

  These are great news :)

  Though I'm slightly confused why would you need implementing getUrlSupport method - it is used by our code which creates Build Configuration from Maven URL.
  It should have worked without implementing getUrlSupport method.

  Anyway, thanks for sharing your success :)

  All the best,
  KIR

0

Please sign in to leave a comment.