Jenkins Git Changelog plugin - jenkins

When I am trying to use git changelog in the post build action in Jenkins I get an error saying Cannot find on classpath (changelog.mustache) or filesystem (/changelog.mustache).
Changelog.txt is the filename I have given to be written into.
Could you please help?
Also, is there a way I can write the changelog into an email from this plugin?

You have to configure a template for changelog processing. The easiest way to achieve this is to check the checkbox "Configure template here" in the section "Create file". You can use the preconfigured template that gets visible when you enable that checkbox.
For details have a look at the plugin documentation at https://wiki.jenkins-ci.org/display/JENKINS/Git+Changelog+Plugin in section "File in Jenkins workspace".
If you don't enable any template definition then your mentioned error will appear.

Related

Jenkins change Build History timestamps

I have a Multibranch Pipeline in Jenkins.
My goal is to change the Timestamps of the Builds in the History.
I was able to change the DisplayName (#13 to 'test') as shown in the picture below, but not the timestamp. Is this possible, and if so, how?
After googling for some time I found one wonderful plugin.
https://plugins.jenkins.io/groovy-postbuild/
Groovy Post Build.
This plugin can help you to add custom text, plugin-predefined Icons In Build History side pane after build Timestamp. Like
And this plugin has some other icons also and we can give on hover to those icons.
It's really fun to implement cool stuff there. This plugin has very good documentation and well-defined Examples.
Please have a look, This will resolve your problem.
PS: you need to write some groovy script 😋
[update]
Install plugin:
Jenkins > configure > manage plugin > Avaialble > search for Groovy PostBuild > Install and restart Jenkins
How to use:
Start Configure your project. If the project is FreeStyle then go to post build tab in the configuration page. Like this:
A textArea will open now add your Script as described in Examples.
Now Apply and save. Run the build and tadaaaa.. your message is in build history pane.
I think this could help you to setup and run script

How to configure Fortify plugin using 'Jenkins Configuration As Code' Jenkins plugin (JCASC)?

I'm setting up a new Jenkins master server and configuring it using the Jenkins Configuration as code (JCASC) plugin.
https://github.com/jenkinsci/configuration-as-code-plugin/blob/master/README.md
I've configured most plugins with JCASC, based on documentation and examples inside the project, but I can't find the syntax for configuring plugin 'Fortify Jenkins Plugin' version 18.10.
I need to set these properties:
URL of the remote Fortify server, authentication token (generated on the fortify server) and which template to use.
Can anyone assist with an example or syntax for the yml file used by the JCASC plugin for Fortify plugin?
I don't know if fortify-plugin is compatible with JCasC, it might be or it might need some modifications. That said, if it is compatible, then the configuration export should work for it.
So, spin up a Jenkins instance, install the plugin, configure whatever you want in the Jenkins UI and then go to the CasC page and use the configuration export. That should give you a JCasC file containing your setup.
Alternatively, you can try the JCasC Schema experimental feature. It's a JSON schema generated by Jenkins that you can use in your YAML editor for autocompletion. More information here.
we have just released an update of the Fortify plugin with support for JCasC. Keep in mind, versions of the plugin prior to v21.1.36 were unable to support it, we had to make changes to make it happen.
You can find official documentation on how to use our configuration elements here. There's one correction to the documentation, though. Our top level configuration element is called fortifyPlugin instead of fortify mentioned in the documentation. It is going to be corrected in the next documentation update.
Here's a sample configuration for your quick reference:
unclassified:
fortifyPlugin:
url: "https://qa-plg-ssc3.prgqa.hpecorp.net:8443/ssc"
token: "3ab8c774-0850-483b-8be6-2907722a81d8"
proxyConfig:
proxyUrl: "web-proxy.us.softwaregrp.net:8080"
projectTemplate: "Prioritized High Risk Issue Template"
connectTimeout: "10"
readTimeout: "20"
writeTimeout: "10"
breakdownPageSize: "50"
ctrlToken: "5176d380-26ac-430f-95d7-0a2272cf3297"

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 .

Jenkins how to use AnchorChain plugin to add external URL to Jenkins pipeline

I want to link an external URL to Jenkins pipeline. This should be accessible while the build is running. AnchorChain had been suggested in several pages and so trying to use it but the documentation is less explanatory for a newbie. I installed the AnchorChain Plugin and added the following in the pipeline script.
sh "echo 'File1 http://localhost:8080/api' > anchorChain.tsv"
When I start the build, the console output shows
+ echo webAppUrlFile http://localhost:8181/api
Now I want to add this link to the sidebar of the build job similar to an HTML Publisher report link. What are the next steps?
Make sure you're using tabs as delimiters between:name url icon as outlined in this post: Jenkins_wiki
Note: The icon field is optional. If you don't specify one, you'll get one by default. I was unable to specify one using an http:// address (another problem for another day) so I just omit the field and get the default icon.
In order to get the side-bar link to show up in your Jenkins job, you'll:
Install the AnchorChain plugin. Once it's installed (and you've restarted Jenkins),
In your Job config (Build Section) in an execute shell, you'll add the output to the AnchorChain.tsv:
echo "Artifacts ${ARTIFACTS_URL}" > AnchorChain.tsv
In your Post Build Actions section, you'll add the Anchor Chain action
Add your file reference to the File name field:
Try out a build. Result after the build depicted in screenshot below.

change the build status to NOT_BUILT if a file exists in post build

I create a file in workspace for a specific type of branch during my compilation. If the file exists I want the change the built status to NOT_BUILT and skip the job.
How can I do it through post build groovy script.
The Groovy Postbuild plugin exposes a variable called manager which can be used to access Jenkins objects. See the plugin's wiki page for details.
To set the build result to NOT_BUILT, do this:
manager.build.result = hudson.model.Result.NOT_BUILT

Resources