Automation of documenting code base using Doxygen plug in Jenkins CI environment - jenkins

I use a shell script to create/run doxygen doxyfile to document my code base
which works absolutely fine(Schedule runs and recursive scan code base also
works fine).
Now my requirement is to do the same job using Jenkins CI.
I added doxygen plug which generates documentation output and stores the result in Jenkin workspace.
My question, is there any another ways to run script and generate doxyfile in
Jenkins environment and also
How to create url link to display doxygen HTML output.

Have you seen the Jenkins DocLink plugin? This plugin makes it easy to put a link on your project page to documentation generated in a build.

Related

Are there any api's available to automate the "Apply new configuration" action in Jenkins Configuration as Code plugin

How can I apply a new Jenkins configuration as code YAML file from a groovy script, similar to clicking the "Apply new configuration" button in the UI.
I didn't try yet, but this looks as a feasible approach to me:
In the Jenkins home directory (/var/lib/jenkins on my Ubuntu installation) there is a file io.jenkins.plugins.casc.CasCGlobalConfig.xml. Edit that in order to provide a path/URL to your YAML file. On my system that file has the content like below, and I assume that just replacing the value of the <configurationPath> element with your yaml path should be sufficient.
<io.jenkins.plugins.casc.CasCGlobalConfig plugin="configuration-as-code#1569.vb_72405b_80249">
<configurationPath>/PATH/TO/MY/jenkins.casc.yaml</configurationPath>
</io.jenkins.plugins.casc.CasCGlobalConfig>
This configuration seems to be automatically applied each time when Jenkins is restarted.
In order to apply the configuration immediately, there seems to be jenkins-cli api for that. See the http://YOUR_JENKINS/manage/cli page and look for the reload-jcasc-configuration command, which suggests: java -jar jenkins-cli.jar -s http://YOUR_JENKINS/ -webSocket reload-jcasc-configuration
You ask for a "groovy script". With that I can't help, but I guess that modifying a file or running the jenkins-cli should be perfectly doable in a groovy script.

Jenkins javadoc plugin doesn't generate documentation

I have installed Jenkins, create a project and configure it.
I run into a problem, Jenkins do everithing great except documentation generating.
Could anyone point me where I have done mistake, and how fix it?
Thank you.
------------------------ New information ----------
Console output:
I have renamed doc to javadoc directory, but it isn't help.
Here is screenshot of javadoc directory contents in console, it is clear that Jenkins plugin didn't generate documentation, but why?
It sounds like you are expecting the Jenkins plugin to produce the documentation. The Jenkins plugin merely copies files from the job's workspace folder to the build's archive area and provides a link to it. If your build steps don't produce Javadoc, then Jenkins won't be able to archive and provide a link to it.
Does your pom file include the maven-javadoc-plugin?
Are your build steps invoking a goal that includes Javadoc generation?
For example, "mvn jar" would compile Java and build the jar but not build the javadocs. Clearly you have executed a goal that executes the tests and provides a code coverage report, but that does not trigger the Javadoc goals either. You would need to make sure your build steps include a javadoc goal - i.e., mvn javadoc:javadoc. The standard goals can be found here: https://maven.apache.org/plugins/maven-javadoc-plugin/plugin-info.html .

Howto set up classpath for System Groovy Script in Jenkins

Documentation for the Groovy Plugin of Jenkins states that
The system groovy script, OTOH, runs inside the Jenkins master's JVM.
Thus it will have access to all the internal objects of Jenkins, so
you can use this to alter the state of Jenkins. It is similar to the
Jenkins Script Console functionality.
Yet I find that I have a groovy script that I can successfully run in Jenkins Script Console but which does NOT run if entered as a "System Groovy Script" on a build configuration. There are compiler errors. Clearly, the Jenkins Script Console is running with a different classpath than the script in my build. But I can't find information on what the default classpath is when running a script for a build or what the classpath is when running from the Script Console, so I might duplicate that for my script.
Also, the plugin offers a classpath entry field for running the script as a file but that option does not exist for entering the script as text.
I can't get my script to work either way.
What am I missing?
I think the answer is that the Script Console auto-imports the whole Jenkins library. That is not the case with the System Groovy Script. So what worked for me was to run the script, and for every compiler error about an unknown class, add an import statement for that class. I learned what packages they were from by looking at Javadocs.
Automating this would be a nice improvement to the plugin.
May be use the grab dependency management to resolve the library to add

Multiple jMeter scripts for Jenkins?

I'm interested is it possible using Jenkins+Performance plugin to run more than one .jmx (jMeter) files.
I'm using SVN repository where I keep my jMeter scripts. But problem is I can add only one jmx file to repo. I want add more than one, but Jenkins runs only first one.
I think you can use Ant to do this in Jenkins.
Note the "testplans" element in the following build.xml snippet:
<jmeter>
jmeterhome="c:\jakarta-jmeter-1.8.1"
resultlog="${basedir}/loadtests/JMeterResults.jtl">
<testplans dir="${basedir}/loadtests" includes="*.jmx"/>
</jmeter>
More info here: http://www.programmerplanet.org/projects/jmeter-ant-task/

Build LaTeX PDF on Jenkins/Hudson

The team I work for manages a large collection of technical documentation which is written in LaTeX. Currently all the documentation we have is manually built by the editors and then checked into a version control system.
Is there a possibility to build the LaTeX files on jenkins/hudson?
If you can build your LaTeX files from the command line, Jenkins can build it for you.
Just create a job with a "Execute shell" build step.
You've tagged this question with [ant], so if you're building your documentation using an Ant script, you can alternatively add an "Invoke Ant" build step which calls the appropriate target.
Depending on which build system you're using you can also use plugins e.g. for Maven or Gradle. You can have a look at https://github.com/reallyinsane/mathan-latex-maven-plugin where you can find a maven and a gradle plugin. You can use them with none or less configuration.

Resources