Deploy to remotes computers


Im new on jenkins. And im facing this situation.

I already create a jenkins pipeline script to create a war file to deploy on Tomcat. I want to know if there is a way to build project on my controller who already creates a war and after war is build sent to my agent. Because i dont want to sent project to 3 agents and build everyting on then.

I have different enviroments, windows and linux and sent to agents will led me to configure all deployment perrequisites on every server (npm to build react, gradle to build war, etc).

My wish is to create and generate war file on controller and sent this war file to agents. This agent only will need to sent war file to tomcat on their side.

Any help apreciated, thanks.

I’ve never deployed a war file from Jenkins to Tomcat, but here are several links that Google search found:

Building on the controller is considered a security risk. Building the same artifact over and over is also a bad practice; you could end up with slightly different artifacts depending on environment.

You could set up an agent co-located on the controller server, running as a different user (isolating from controller data)
Build on that agent and then deploy to the targets. Could be in a single pipeline or a build job, then a deploy job that either called once/target or deploys at once to all 3 (matrix job style - eg:Welcome to the Matrix)