Make file available for download during input-step in Jenkins - jenkins

During the the "input step", I need to make a binary file available for the user to download and validate.
Ideally as a clickable link directly in the input-step dialog if that is possible somehow?
"archive artifact" does not work, since the artifact only becomes visible after the job has finished.
A link directly to the file in workspace would be ideal, but there does not seem to exist a way for groovy to find out the URL to the workspace.
The html publisher might work. But the problem of linking to it from the input-step dialog remains.

you can try to copy your file to $JENKINS_HOME/userContent and then access it via https://YourJenkinsHost.com/jenkins/userContent/YourFileName

Related

Display a file path as hyperlink from archive after jenkins build

I have a pipeline job in Jenkins. Once it finishes , it archives some files. I need to display a particular file from the archived folder.
Example file is D:/1234/errorLog.txt
If job is failed , this path should be provided in the email. How can I achieve this ?
It should be able to access that folder from email, by clicking that link.
All files that are archived can be accessed via the Jenkins URL. So, for example if I had an archived errorLog.txt, I would be able to access it like this:
JENKINS_URL/job/JOB_NAME/BUILD_NUMBER/artifact/path/to/file/errorLog.txt
So if you were sending an email, the email would have to contain the formatted string with the Jenkins URL, Job name, and build number set.
You can also do this with folders. If you were to go to the artifacts root folder:
JENKINS_URL/job/JOB_NAME/BUILD_NUMBER/artifact
You would see the archived folders listed out:
So anyone clicking on the list would have the page open up in their browser.

How I add custom link in Issue-link-section

I am creating a JIRA(Version- 7.2.2) plug-in, Here I want to insert my custom link in Issue-link-section. For your better understanding please view the below image.
Click to View Image
In order to add you custom link on that dialog you need to edit the bundled plugin associated with that dialogue. Technically that dialogue is part of the jira-issue-link-web-plugin which you can find the JAR file as jira-issue-link-web-plugin.jar in your installation directory. If I'm not mistaken you need to edit the velocity file in that JAR file and add your links over there. There is no way to add it from the UI unless you want to edit the JAR file and upload it as a newer version in your JIRA. Please note that it's bundled plugin and changing it may cause some malfunction in your production then be careful and test it in staging first.
Yes shailendra,You can try below solution for your query-
<web-item key="example-create-link" section="create-issue-link-types" weight="100">
<label key="MyCustomLink"/>
<link linkId="link-issue">url</link>
</web-item>

How to attach more than two text file in email with editable email notificaton plugin in jenkins?

i have more than 2 text files generating after running a particular job in jenkins and i want to attach this two text files in email-triggered after success of the job.
Here we are using Editable email plugin, through which we can attach only one file no more that one, any please suggest.
Editable Email Notification has an Attachment section and it use Ant script.when you require an email trigger at the end of your build including files as an attachment then it will be helpful for you to know Ant script work mainly on relative addressing rather than absolute addressing. so content in attachment pattern should be some thing like this
**/foldername/*.txt
(anyextension)
Note:make sure the folder exists in your job workspace and all your text files are placed in that folder.
Or the other way if you have files in workspace , then you can use a comma separated list of file names to trigger as an attachment.
Please Use Trigger in email ext plugin and use success Trigger.
Hope this helps to some extent

Does Greasemonkey publish every script present in its script directory?

I learned about the greasemonkey recently. I have written scripts to skip every login page I encounter by submitting the value of password in plain text. My doubt is that does greasemonkey uploads every script file present in its script directory and publishes it on userscripts.org. I was not able to get any clear information on this subject in their privacy options or on greasespot.net.
No, Greasemonkey does not automatically upload your scripts anywhere. To upload to userscripts.org, you must manually log in and upload yourself.

Attachment using Editable Email Extension in Jenkins

I am using Editable Email plugin in Jenkins to attach a file with the email. The problem is that the plugin is unable to find the file to attach.
My file structure is like this -
ReportDirectory
workspace
ReportDirectory contains the report which I want to attach. I believe that the base directory for the plugin is the workspace. So I am giving the attachment location as
../ReportDirectory/DemoReport.html.
I have also tried
ReportDirectory/DemoReport.html
and many more options.
Am I doing something wrong?
I figured it out.
The Editable Email plugin uses the Ant File Syntax for locating the attachment. When I took at the documentation for Ant File Syntax ( http://ant.apache.org/manual/dirtasks.html ), it says that
In general, patterns are considered relative paths, relative to a task dependent base directory (the dir attribute in the case of ). Only files found below that base directory are considered. So while a pattern like ../foo.java is possible, it will not match anything when applied since the base directory's parent is never scanned for files.
Since the base directory in this case is the "workspace" and my directory "ReportDirectory" is not located in it so the Ant is not able to access it.
Two solutions exist:
Move the "Report Directory" somewhere in "workspace". I did not prefer this because I did not want to mess up the workspace.
Once the report has been created in "ReportDirectory", use your Ant\MSBuild script to copy it temporarily in the "workspace" and then the Email plugin shall be able to access it by something like **/Report.html or something.
#Amey - thanks for your efforts though :)
Another solution is create a symbolic link from $JENKINS_HOME/jobs/workspace/$workspace_name to the path with your $workspace_name. This way worked for me.
ReportDirectory/DemoReport.html
is the correct way to do it.
Please keep in mind that the path to the file and the file name is case sensitive so I assume your entering the correct name.
One more thing is to check is that the report is actually created and is located at the path mentioned by you.
Another thing you could try
ReportDirectory/*
Jenkins will use the directory available in its workspace.
You can send multiple attachments as below.
reportFolder/html/index.html, screenShotsFolder/screenShots/*.jpg
Simple answer:
Copy your file into the workspace(into your job directory), then under Attachment, just give the file name without any quotation or anything. This will automatically tell Jenkins to pick up your file. That's it!
Pls don't confuse yourself after seeing all the configurations.

Resources