How to Resolve "Incompatible Runner" Error in TeamCity Despite canRun Set to True in AgentBuildRunner

I’m working on a custom build runner plugin for TeamCity and keep hitting an "Incompatible Runner" error. This persists even though I’ve set canRun to return true in my AgentBuildRunner implementation. I’ll outline the issue, my setup, and what I’ve tried so far—hoping someone can spot what I’m missing!

Overview of the Issue

  • TeamCity Version: 2024.12
  • Plugin Structure:
    • Server module: sampleRunner-server
    • Agent module: sampleRunner-agent
    • Common module: sampleRunner-common
  • Problem: When I set up a build step with my custom runner, TeamCity marks it as "Incompatible runner: Sample Runner" on the agent, despite canRun returning true.

The runner should work on any agent, but it’s not being recognized as compatible. The server and agent logs don’t show obvious issues like class loading errors or missing dependencies, making this tough to troubleshoot.

Key Code Snippets

Here’s my setup with test aliases for clarity:

Server-Side: Registering the Run Type

public class SampleRunType extends RunType {
    private final PluginDescriptor pluginDescriptor;

    public SampleRunType(RunTypeRegistry registry, PluginDescriptor pluginDescriptor) {
        this.pluginDescriptor = pluginDescriptor;
        registry.registerRunType(this);
    }

    @NotNull
    @Override
    public String getType() {
        return "sampleRunner";
    }
    // Other required methods implemented
}

Server-Side Spring Config

<!-- build-server-plugin-sampleRunner.xml -->
<beans>
    <bean id="sampleRunType" class="com.example.teamcity.SampleRunType" />
</beans>

Agent-Side: Build Runner Implementation

public class SampleTaskRunner implements AgentBuildRunner {
    @NotNull
    @Override
    public BuildProcess createBuildProcess(@NotNull AgentRunningBuild build, @NotNull BuildRunnerContext context) {
        return new SampleTask(build, context);
    }

    @NotNull
    @Override
    public AgentBuildRunnerInfo getRunnerInfo() {
        return new AgentBuildRunnerInfo() {
            @NotNull
            @Override
            public String getType() {
                return "sampleRunner";
            }

            @Override
            public boolean canRun(@NotNull BuildAgentConfiguration agentConfiguration) {
                return true; // Should allow it on all agents
            }
        };
    }
}

Agent-Side Spring Config

<!-- build-agent-plugin-sampleRunner.xml -->
<beans>
    <bean id="sampleRunner" class="com.example.teamcity.tasks.SampleTaskRunner"/>
</beans>

Plugin Descriptor

<teamcity-plugin>
    <info>
        <name>sampleRunner</name>
        <display-name>Sample Runner Plugin</display-name>
        <version>1.0-SNAPSHOT</version>
    </info>
    <deployment use-separate-classloader="true" node-responsibilities-aware="true">
        <server>
            <jar path="sampleRunner-server-1.0-SNAPSHOT.jar"/>
        </server>
        <agent>
            <zip path="agent.zip"/>
        </agent>
    </deployment>
</teamcity-plugin>

What I’ve Tried

  1. Packaging Check: Confirmed agent.zip contains the agent JAR and teamcity-plugin.xml, with all classes and dependencies properly included.
  2. Log Review: No errors in teamcity-server.log or teamcity-agent.log about plugin loading.
  3. Simplified Runner: Stripped the runner to a basic log-and-exit task, but the error persists.
  4. Version Match: Verified server and agent are both on TeamCity 2024.12.
     

SampleTask class is making some api calls nothing more than that, Please help me figure out  where the issue is how can i resolve this problem.
 

1

Please sign in to leave a comment.