Is there a way to get Jenkins to share a shared source directory / check location for full and incremental builds?

I use Jenkins CI as the build server in the project I'm working on, I also use Klocwork as a static analysis tool to determine deviations from our coding standards.

Jenkins currently has two assemblies (performed in separate directories), a full nightly build that wipes the workspace and performs a new check and a complete rebuild of everything. In addition to nightly builds, I also have incremental builds for 15 minutes. Both builds use the Klocwork analysis tool.

Klockwork works by displaying a list of potential problems that can then be fixed or chosen to be ignored if they are not applicable to the project when problems are ignored. Klocwork uses assembly file paths to remember where there were problems that were ignored. This means that when in Klocwork I once ignored a warning in a full assembly and an incremental build starts, the warning returns again, because the build path is different.

The most reasonable solution that I see in this is that Jenkins does all his work on a nightly basis, but for incremental builds do the update at the full build location and then do incremental builds in the same way that the IDE on the PC works.

The problem is that Jenkins starts the full assembly and incremental assembly as two separate jobs, due to which they can be checked in different places, and I can not find a way to share the two jobs in a common directory. Also, I canโ€™t find a way to have one task that performs a full night check and rebuild, as well as an incremental build with an update when registering at the same time.

Does anyone know how to get Jenkins to use a common source directory for multiple jobs?

Thank you very much,

Pete.

+4
source share
2 answers

Here is what I did.

  • One task is used to verify the source code.

  • In other job configuration settings, I set an environment variable that points to the workspace directory tree that contains the first source code of the job (command line access for the Jenkins server is useful here to find out where it is, but not necessary). Then, in my Jenkins configuration script in normal jobs, I 'cd' to this place and use the environment variable as the path to all the files so that these other jobs use the first given validation code.

  • Locks are used, so regular tasks will not be performed simultaneously with the statement code.

  • Since some result files (due to running tests) were generated and created in the source tree due to the specifics of some of these tasks, in setting up a post-action script, I copied / moved the desired results back to the task workspace, which should to have them so that I can process these results in the right assignment.

Worked for me.

+3
source

You can easily make two assemblies have the same assembly area,
simply extracting the files in both job assemblies to a shared folder.

I highly recommend NOT to do this, as you can quickly get to the situation where nightly assembly clears the assembly area while incremental assembly still works
(or that incremental builds are sources of statements while the nightly one still works).

Suggest you connect Klockwork to only one of the construction tasks (night, maybe)
therefore, to avoid duplication of warnings.

0
source

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


All Articles