Jelly

Jenkins: Using validateButton on a class without Descriptor

六眼飞鱼酱① 提交于 2020-01-14 05:10:13
问题 I have a hudson.model.ManagementLink (which creates a page which can be accessed via Manage Jenkins . I have some form fields which I'd like to validate using the f:validateButton . If this were to be done on say the config.jelly page of a Publisher (which has a descriptor) a simple doXXX() method would work in the descriptor. If I add a similar doXXX() method directly to hudson.model.ManagementLink it is in fact accessible directly via the URL myPage/myMethod however the f:validateButton

How to add Job Description into Jenkins email notification content

拟墨画扇 提交于 2019-12-24 03:37:25
问题 Using the Configure System > Extended E-mail Notification configuration in Jenkins I would like to add the description of my job (present on http://my-jenkins.org/job/myjob page) into the Default Content of build failure emails. Is there any $PROJECT_DESCRIPTION variable that I can use for that ? Or is it possible to do that using a Jelly/Groovy script ? Thanks ! 回答1: As told by Zloj , Jenkins don't have such variable but you can customize your own. Jenkins have plugin to set Environment

Jenkins email ext jelly script include file contents

心不动则不痛 提交于 2019-12-23 20:33:15
问题 Can I display the contents of another file in my jelly script output? 回答1: If the file is included in the workspace of the job, declare your variable such as: <j:set var="fileContent" value="${build.getWorkspace().child("results.html")}"/> And call it this way: ${fileContent} 回答2: Yes, you can use the ${FILE, path} token to include the contents of a file (path is relative to your workspace directory). This info is taken from the Content Token Reference in the email-ext part of your job

Can two different jenkins builders exist in the same hpi and share the same global configuration?

浪子不回头ぞ 提交于 2019-12-20 05:43:36
问题 I need to create two different Jenkins Builder classes. Each does different things and each requires its own .jelly, however, both require the same global configuration (global.jelly) which specifies a host and some user credentials. Instances of both builder types, during their perform(), will connect to the host (specified in the global configuration) using the credentials (also specified in the global configuration). The problem is that in Jenkins you place the resources of each builder in

Sending Cppcheck result/report on email from Jenkins using email-ext plugin

[亡魂溺海] 提交于 2019-12-13 17:22:21
问题 I'm trying to send cppcheck report on an email using email-ext plugin from a Jenkins build. So far, only way seems to be by creating a custom template -- jelly or groovy. From this post -- "Can I configure jenkins to send an email with a static analysis report summary?" -- it looks like I should be able to instantiate CppcheckBuildAction and use its methods but for some reason, it doesn't seem to instantiate (ie. the object is null). Here's the code I've put in the jelly template to check

Access custom environment variables in jelly template

独自空忆成欢 提交于 2019-12-12 12:15:27
问题 With Jenkins pipeline you are able to set any environment variable through Global Variable called - env . Jelly template in it's turn gives you ability to access Jenkins API including hudson.model.AbstractBuild and hudson.model.AbstractProject objects. Here are the snippets that I use: Jenkinsfile: node { env.MYVAR = 'My variable' emailext body: ${JELLY_SCRIPT, template="myTemplate"}, subject: 'MySubject', to: 'me' } Jelly template (myTemplate): <?jelly escape-by-default='true'?> <!DOCTYPE

Jenkins: validateButton in config.jelly for a class without Descriptor

落花浮王杯 提交于 2019-12-12 03:24:17
问题 I have the Plugin class without Descriptor : @Extension public class Plugin extends hudson.Plugin { // ... public FormValidation doValidateForm(String s) { return FormValidation.ok("Hello world! Your 's': " + s); } } And I have a config.jelly for this class: <?jelly escape-by-default='true'?> <j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form"> <!-- ... --> <f:entry title="Test"> <f:textbox name="test" value="123" field="test"/> </f:entry> <f:validateButton title="Test" progress="Testing..."

How does Jenkins discover the config.jelly for a post-build plugin?

↘锁芯ラ 提交于 2019-12-10 11:08:15
问题 I'm creating a post-build plugin for some customized reports in my company. I started with the Jenkins "hello world" example provided here: https://wiki.jenkins-ci.org/display/JENKINS/Plugin+tutorial This worked great. I was able to load the plugin and use it in my Jenkins instance without any problem. To get things going for my project, I was able to move the HelloWorldBuilder to another folder than the default one the Jenkins HPI setup created, build, and upload this plugin with no problem.

Using JavaScript within jelly script

雨燕双飞 提交于 2019-12-07 11:57:10
问题 I'm trying to use scripts written in JavaScript in Jenkins. I think that the easiet way would be to call them in .jelly scripts. For example: I have file myCustom.js : alert("Hello World!"); function myFunction() { var x = "", i; for (i=0; i<5; i++) { x = x + "The number is " + i + "<br>"; } document.getElementById("demo").innerHTML = x; } Next I have: global.jelly (from tutorial plugin): <j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns

How does Jenkins discover the config.jelly for a post-build plugin?

半城伤御伤魂 提交于 2019-12-06 04:53:58
I'm creating a post-build plugin for some customized reports in my company. I started with the Jenkins "hello world" example provided here: https://wiki.jenkins-ci.org/display/JENKINS/Plugin+tutorial This worked great. I was able to load the plugin and use it in my Jenkins instance without any problem. To get things going for my project, I was able to move the HelloWorldBuilder to another folder than the default one the Jenkins HPI setup created, build, and upload this plugin with no problem. I was also able to change this to derive from the hudson.tasks.Recorder and changed the @Extension to