From 5847aa8427ea1eaa0e5e1c51e5eea6751e08ab4f Mon Sep 17 00:00:00 2001 From: Net Wolf UK Date: Fri, 24 Mar 2023 09:26:09 +1300 Subject: [PATCH] Remove build agent plugin The build agent plugin is very trivial. It is really only there is simplify sending a service message to trigger the service message event. This can be achieved in other ways, and therefore removes the need for Build Agents to download the plugin and restart themselves. For large installations with many cloud agents, this connect/download/restart/reconnect process happens for every agent and some agents only do one build and then shutdown. --- pom.xml | 1 - tcwebhooks-agent/.gitignore | 6 - tcwebhooks-agent/pom.xml | 128 ------------------ .../WebHookServiceMessageBuildProcess.java | 44 ------ .../WebHookServiceMessageBuildRunner.java | 34 ----- .../build-agent-plugin-tcwebhooks.xml | 11 -- .../teamcity-plugin.xml | 6 - tcwebhooks-web-ui/pom.xml | 8 -- 8 files changed, 238 deletions(-) delete mode 100644 tcwebhooks-agent/.gitignore delete mode 100644 tcwebhooks-agent/pom.xml delete mode 100644 tcwebhooks-agent/src/main/java/webhook/teamcity/agent/WebHookServiceMessageBuildProcess.java delete mode 100644 tcwebhooks-agent/src/main/java/webhook/teamcity/agent/WebHookServiceMessageBuildRunner.java delete mode 100644 tcwebhooks-agent/src/main/resources/META-INF/build-agent-plugin-tcwebhooks.xml delete mode 100644 tcwebhooks-agent/src/main/teamcity-plugin-resources/teamcity-plugin.xml diff --git a/pom.xml b/pom.xml index e90d259d..50cb1ef6 100644 --- a/pom.xml +++ b/pom.xml @@ -89,7 +89,6 @@ tcwebhooks-core tcwebhooks-rest-api - tcwebhooks-agent tcwebhooks-web-ui diff --git a/tcwebhooks-agent/.gitignore b/tcwebhooks-agent/.gitignore deleted file mode 100644 index 2c57f5cc..00000000 --- a/tcwebhooks-agent/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -/target -/.classpath -/.project -/.settings -/.apt_generated_tests/ -/bin/ diff --git a/tcwebhooks-agent/pom.xml b/tcwebhooks-agent/pom.xml deleted file mode 100644 index 5dae5e27..00000000 --- a/tcwebhooks-agent/pom.xml +++ /dev/null @@ -1,128 +0,0 @@ - - 4.0.0 - - tcwebhooks - netwolfuk.teamcity.plugins.tcwebhooks - ${currentVersion} - .. - - tcwebhooks-agent - - - package - - - src/main/resources - false - - - src/main/teamcity-plugin-resources - true - - *.xml - *.properties - - - - src/main/teamcity-plugin-resources - false - - *.xml - *.properties - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.1 - - 1.8 - 1.8 - - - - maven-antrun-plugin - - - package - - - - - - - - - - - - - - - - - - - - - - - - - - - run - - - - - - - - - - org.apache.maven.plugins - maven-project-info-reports-plugin - 2.0.1 - - - - org.apache.maven.plugins - maven-javadoc-plugin - 2.1 - - - - org.codehaus.mojo - cobertura-maven-plugin - 2.7 - - - - - - - local-mvn-repo - file://${project.basedir}/local-mvn-repo - - - - - - - - org.jetbrains.teamcity - agent-api - ${teamcityVersion} - provided - - - - - diff --git a/tcwebhooks-agent/src/main/java/webhook/teamcity/agent/WebHookServiceMessageBuildProcess.java b/tcwebhooks-agent/src/main/java/webhook/teamcity/agent/WebHookServiceMessageBuildProcess.java deleted file mode 100644 index 50914c60..00000000 --- a/tcwebhooks-agent/src/main/java/webhook/teamcity/agent/WebHookServiceMessageBuildProcess.java +++ /dev/null @@ -1,44 +0,0 @@ -package webhook.teamcity.agent; - -import jetbrains.buildServer.RunBuildException; -import jetbrains.buildServer.agent.BuildFinishedStatus; -import jetbrains.buildServer.agent.BuildProcess; -import jetbrains.buildServer.agent.BuildProgressLogger; - -public class WebHookServiceMessageBuildProcess implements BuildProcess { - - private boolean isFinished = false; - private boolean isInterrupted = false; - private BuildProgressLogger myBuildLogger; - - public WebHookServiceMessageBuildProcess(BuildProgressLogger buildLogger) { - myBuildLogger = buildLogger; - } - - @Override - public void start() throws RunBuildException { - myBuildLogger.message("##teamcity[sendWebhook]"); - isFinished = true; - } - - @Override - public boolean isInterrupted() { - return isFinished && isInterrupted; - } - - @Override - public boolean isFinished() { - return isFinished; - } - - @Override - public void interrupt() { - isInterrupted = true; - } - - @Override - public BuildFinishedStatus waitFor() throws RunBuildException { - return BuildFinishedStatus.FINISHED_SUCCESS; - } - -} diff --git a/tcwebhooks-agent/src/main/java/webhook/teamcity/agent/WebHookServiceMessageBuildRunner.java b/tcwebhooks-agent/src/main/java/webhook/teamcity/agent/WebHookServiceMessageBuildRunner.java deleted file mode 100644 index 17c3d93f..00000000 --- a/tcwebhooks-agent/src/main/java/webhook/teamcity/agent/WebHookServiceMessageBuildRunner.java +++ /dev/null @@ -1,34 +0,0 @@ -package webhook.teamcity.agent; - -import jetbrains.buildServer.RunBuildException; -import jetbrains.buildServer.agent.AgentBuildRunner; -import jetbrains.buildServer.agent.AgentBuildRunnerInfo; -import jetbrains.buildServer.agent.AgentRunningBuild; -import jetbrains.buildServer.agent.BuildAgentConfiguration; -import jetbrains.buildServer.agent.BuildProcess; -import jetbrains.buildServer.agent.BuildRunnerContext; - -public class WebHookServiceMessageBuildRunner implements AgentBuildRunner { - - @Override - public BuildProcess createBuildProcess(AgentRunningBuild runningBuild, BuildRunnerContext context) throws RunBuildException { - return new WebHookServiceMessageBuildProcess(runningBuild.getBuildLogger()); - } - - @Override - public AgentBuildRunnerInfo getRunnerInfo() { - return new AgentBuildRunnerInfo() { - - @Override - public String getType() { - return "tcWebHooks"; - } - - @Override - public boolean canRun(BuildAgentConfiguration agentConfiguration) { - return true; - } - }; - } - -} diff --git a/tcwebhooks-agent/src/main/resources/META-INF/build-agent-plugin-tcwebhooks.xml b/tcwebhooks-agent/src/main/resources/META-INF/build-agent-plugin-tcwebhooks.xml deleted file mode 100644 index a0de775e..00000000 --- a/tcwebhooks-agent/src/main/resources/META-INF/build-agent-plugin-tcwebhooks.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - diff --git a/tcwebhooks-agent/src/main/teamcity-plugin-resources/teamcity-plugin.xml b/tcwebhooks-agent/src/main/teamcity-plugin-resources/teamcity-plugin.xml deleted file mode 100644 index 1e5855fa..00000000 --- a/tcwebhooks-agent/src/main/teamcity-plugin-resources/teamcity-plugin.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file diff --git a/tcwebhooks-web-ui/pom.xml b/tcwebhooks-web-ui/pom.xml index 7beb371d..1c7e52f7 100644 --- a/tcwebhooks-web-ui/pom.xml +++ b/tcwebhooks-web-ui/pom.xml @@ -119,7 +119,6 @@ - @@ -135,13 +134,6 @@ - - - - - - -