Configuring Hudson to Build Deployment

I am trying to configure Hudson so that I can automatically deploy the assembly (.war file) to Tomcat. A recently deployed build will be used by someone to test the application.

I tried using the Deploy plugin to automatically deploy the .war file, and it works. However, the work that creates the .war file will start after every scm change (whenever the code is committed). Using the Deploy plugin, the .war file will be deployed to Tomcat every time an assembly is created. Since the code is often executed, this will mean that the web application will also be restarted frequently, and this will interrupt the testing process.

I appreciate the fact that Hudson conducts my unit tests and regularly builds the assembly, so I don’t want to change the triggers for this work.

I am looking for a way that I can manually decide for deployment from Hudson. I tried to create a separate task that will deploy .war from the first work, but that did not work. Does anyone have any experience with this?

+8
tomcat continuous-integration hudson continuous-deployment
source share
2 answers

How to get artifacts

See the “ Roll back or redeploy the previous build ” section to “Expand the plugin page . It describes the main idea. It uses Copy Artifact Plugin to copy artifacts from the build job to the current job (deployment job). From there you do the same, as in the assembly step.

How to start deployment

The build job cannot be started after the deployment starts, so the build is first performed, not the deployment. So there are several options:

  • manually starts the assembly. The user who starts the deployment must select the specific start of the build job.
  • scheduled deployment . This can be part of nightly tasks. Work starts at a certain interval (for example, every night or every weekend). Since it is automated, the deployment task should pick up the last successful build (then you do not need parameterized work). You have no way to skip the mileage number.
  • the deployment task gets each time the assembly succeeds (does not meet your requirement, but is listed to complete the list)
  • Some other (esoteric) trigger . It can be many different opinions, for example. remotely triggered by invoking the assembly URL. A call can be received from one of your ticketing systems, a test lab management system, or any other system that you like. You can also initiate the deployment by means of certain changes in your version control system, for example, changing the release number (for example, marked with a keyword in the commit message). This trigger can be implemented inside or outside of Hudson. There are other triggers. This includes, but is not limited to, changing the html page, changing the controlled part of the file system, chat message, email. The first three are implemented by the Hudson plugin. Take a look at the list of plugins to see if everything can be seen or In both cases, you need to make sure that the build task archives all the artifacts needed for deployment.
+8
source share

I have several work tasks for projects:

  • The main task, which only builds a project and runs tests. If he succeeds, he runs the following tasks:
  • Code metrics task (PMD, FindBugs, Cobertura, CheckStyle, also JavaDoc generation) and
  • A deployment task that creates a project using mvn package -DskipTests and deploys the tomcat war

I believe that the separation of these things has been simplified, only the first job is listening for SCM changes.

However, another way would be to allow the third job to also listen to SCM (but with a longer interval, perhaps an hour later).

+1
source share

Source: https://habr.com/ru/post/650752/


All Articles