Attachment using Editable Email Extension in Jenkins - 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.

Related

JSON Error: Files or directories outside directory

I tried to submit an Edge extension. It is a simple extension that had three files: the manifest.json, background.js, and an icon.
When I sideload it in Edge, it works. When I tried to publish it, I got an error that says, Files or directories outside directory.
I have looked everywhere for documentation on what the folder directory should look like. Can someone point me to an example directory? Should there be more folders?
The solution was to create a zip file in another way. I found an online site, but if this was something important, I would find another computer.
Anyway, it seems that Big Sur adds something extra that MS doesn't like. Strange Google accepts it.

I need to open some files in a folder that contains "RPA" in their name. so how can I do that in automation anywhere?

I am creating a program that opens files in a folder that contains "RPA" in their name. so, how can I do that?
You will use Loop on File in Folder command, and if condition inside the loop to check if the file name includes RPA.
Loop on Files on Folder
If condition $Filename$ includes RPA
Do Something here eg. open program/file command
End If
End Loop
#Shivam,
To get more clarity on your problem statement, you mentioned once that the files are already in PDF.
Are you trying to copy content from PDF to Word? In that case, you could use PDF Integration commands, provided the PDFs are not hand-written or scans. If that is the case, the text extraction might become more unreliable.
A safe bet with Automation Anywhere is to just extract all the text, open a new Word document and paste the content and save file.
Saving all files as word might a little counter-intuitive. You can just use the If statement within your for loop to only process files with "RPA" in their name.
Hope this help. Let us know you go :-)
its pretty simple use includes in your if statement
workbench snapshot

Jenkins thinBackup - include additional folder

When using the thinBackup Jenkins plugin one can configure it to include additional files. It seems impossible to include whole additional folders though.
In our case (see screenshot below) it is adding the secret.* files properly but does fail to include the secrets folder (or in the case shown here the .key files in the secrets folder).
Are we configuring this wrong or is it just not possible to include arbitrary folders?
I played around with regex and if you want to backup all the files in secrets folder, try below regex.
It works fine
^(.*\.xml)|^(secrets|.*\.key|.*\.KEY|.*\.Secret|.*\.secret|.*\.mac|.*\.MAC|.*\.seed|.*\.crumbSalt|.*\.consoleAnnotator|.*\.serverCookie|.*\-switch|whitelisted\-callables\.d|.*\.conf|filepath\-filters\.d|.*\.conf)$
You actually need to use the vertical bar to represent a folder or subfolder. I believe the fix for your regex in the screenshot would be changing (secrets/.*.key) to:
(secrets|.*\.key)
Any further subfolders have a similar syntax, such as getting *.groovy from jenkins/scriptler/scripts/:
(scriptler|scripts|.*\.groovy)
Maybe you've already figured this out, but if not, I hope this helps.
Bill

How to make permanent url to file in svn?

Good day, colleagues,
can you advice me, how to make permanent links to files in SVN?
If I make a link, now I get something like:
http://172.29.15.15/svn/OFFICE_WORK/Trainings/123.xlsx
but if I move file to other directory, I get a error (file not found).
I know that in Sharepoint I can assign unique IDs (aditional option in admin panel) to files, and I'll get a permanent URL to file, that doesn't depend on it's location.
Is there an opportunity in SVN to make permanent link to file, that not depend on it's location?
Thank you in advance!
I'm not sure if I'm understanding the question correctly when you say "permanent link". But try adding an external property to your checked out directory. Right click on the directory you wish to add the 123.xslx file to, go to TortoiseSVN > Properties > New > Externals.
Then click New..., give the local path to the file and URL to the file which you posted above
Example:
Local Path: 123.xlsx
URL: http://172.29.15.15/svn/OFFICE_WORK/Trainings/123.xlsx
Hit OK. OK, again. Then do an SVN Update on the folder. Your 123.xlsx file should be included.
Not sure what you're referring to by not depending on location though. In subversion, in order to pull a file, you have to have the URL to gather it from. There isn't any ID feature unfortunately. It seems your repositories are based off an IP address of some sort... Is there any way you can use a common domain name for your path? That would probably solve your issue as well.

File Exist condition issue in Jenkins

I am working on product testing automation. I am using Jenkins to create a job that will first browse some file in a directory. But I got a problem with Conditional Step in File Exist condition. It is not working when I search *.job file, it only works with specific file name I put. Sorry I don't have enough reputation to post picture :)
Anyone can help me solve this issue. Thank so much for reading
I don't think File Exists supports more than one file, you could try the "File match condition". Definitions below:
File exists Run if the file exists.
The file is expanded using the Token Macro Plugin. If the file is
relative, then it is relative to the Base directory. If the file is
absolute, then it will be tested on the Node that contains the Base
directory (the master for $JENKINS_HOME and Artifacts dir).
Files match Run if one or more files match the selectors.
Separate multiple includes or excludes patterns with a comma. e.g.
Includes "target/site/**/*.html,target/site/images/" Excludes
"**/*.gif" If no includes pattern is configured, then the pattern
"**" will be used, which matches all files in the directory and all
sub directories. The includes and excludes are Ant Patterns.

Resources