Jenkins pipeline jiraLinkIssues - jenkins

I try to integrate jenkins and Jira throught pipeline script. I try to create connection between two jira issues
1)my script (tasks INL-6613 and INL-6614 have already created) :
jiraLinkIssues type: 'предыдущая', inwardKey: 'INL-6613', outwardKey: 'INL-6614', site: 'TEST_JIRA'
just like into this documentation (https://jenkinsci.github.io/jira-steps-plugin/steps/issuelink/jira_link_issues/)
2)Also I configured site: 'TEST_JIRA' and it working 100%
3)I can't create link such as into documentation because I haven't use ordinary types :
4)But I have this problem :
{"errorMessages":["Не найдено ни одного типа связи запроса с именем 'предыдущая'."],"errors":{}}
({"errorMessages":["Not found any type of link query named 'предыдущая'."], "errors":{}})
Help me please fix it

Have you tried?
URL encode, change "предыдушая" on "%D0%BF%D1%80%D0%B5%D0%B4%D1%8B%D0%B4%D1%83%D1%88%D0%B0%D1%8F"
use latin symbols instead of cyrillic

I decided this problem with using " jiraGetIssueLinkTypes " -pipeline command, so I have seen that 'предыдущая' was just rename of 'link' type.

Related

Jenkins – How to add label to Jira issue from Jenkins pipeline

I developed automated tests in Java. The XML test report is generated with junit 5 and xray-junit-extension. This XML is currently being integrated in Jira/Xray, but unfortunately the labels are not being added to the issue.
I believe that the labels could be integrated in two different ways, 1) through this XML test report, or, alternatively, 2) through the Jenkins pipeline itself.
My XML contains the following property :
Click here to see the screenshot
Similarly to what is written in the Xray documentation :
Click in order to see the screenshot of the documentation
https://docs.getxray.app/display/XRAY/Taking+advantage+of+JU...
The only difference is that in the Xray documentation there is a wrap around the tags property. In my XML I do not have that wrap.
Do you happen to have any idea on why the label is not being added in Jira/Xray?
The second approach would be using the XrayImportBuilder to add a label, using importInfo
step([$class: 'XrayImportBuilder',
endpointName: '/junit',
importFilePath: '/reports/.xml',
projectKey: 'P34AMA',
importToSameExecution: 'false',
//testExecKey: 'TSTLKS-753',
serverInstance: '3146a388-d399-4e55-ae28-8c65404d6f9d',
credentialId:'55287529-194d-4e91-9964-7d740d8d2f61',
importInfo: "{ "fields": {"labels": ["label"]}",
//importInfo = '{"fields": {"labels": ["EOD"]} }'
])
Problem using XrayImportBuilder in Jenkins
But when adding importInfo to my pipeline it ends with an issue :
Click here to see the Jenkins logs
Clcik here to see the Jenkins Import Step
Is anyone aware of any other way to add a label to jira automatically without using the hudson.plugins.jira.JiraIssueUpdater ?
Thank you very much for your help!

Jenkins Xray Integration - Jira Issue Type with wrong character

In my Jennkins pipeline I have a Jira/Xray integration step :
step([$class: 'XrayImportBuilder',
endpointName: '/xunit',
fixVersion: '1.0',
importFilePath: '/MyFirstUnitTests/TestResults.xml',
importToSameExecution: 'true',
testExecKey: 'TSTLKS-753',
serverInstance: '9146a388-e399-4e55-be28-8c65404d6f9d',
credentialId:'75287529-134d-4s91-9964-7h740d8d2i63'])
Currently I'm having the following error :
ERROR: Unable to confirm Result of the upload..... Upload Failed!
Status:400 Response:{"error":"Issue with key
\u0027TSTLKS-753\u0027 does not exist or is not of type Test
Execution."}
But my issue (TSTLKS-753) is of type "Test Execution":
It appears that the string "\u0027" is being added both as a prefix
and as a suffix on my issue when building the pipeline.
I've searched for this string and it appears to be a Quotation Mark:
I tried out replacing it by double quotes. But I end up with the same error. Also tried to remove them.
In any case, if someone already got this error please let me know. Thank you very much
Can you confirm that the user that you have configured in Jenkins for the Xray instance has access to that Jira project where you have your Test Execution issue?
Can you try to import it without specifying testExecKey field, with importToSameExecution: 'false', and specifying the projectKey field using something like projectKey: 'TSTLKS' ?
If this last option returns an error (e.g. "project does not exist") then it's for sure a permission issue, so you'll either need to use a different Jira user/pass or fix the permissions on Jira side.

Jenkins Log Parser

I was using https://plugins.jenkins.io/log-parser/ plugin with freestyle Jenkins Jobs. But since moving to Jenkins Pipeline, I have not been able to integrate the log parser into the Declaratinve Pipeline syntax.
How can this be done? I also didn't find info in their docs. Also, what would be a good log parsing rule and where to specify it? In the Jenkinsfile also? Could you give an example? Thanks.
I don't user log-parser, but a quick glance at the issues suggests it is not presently compatible;
JENKINS-27208: Make Log Parser Plugin compatible with Workflow
JENKINS-32866: Log Parser Plugin does not parse Pipeline console outputs
Update:
This old response by Jesse Glick (Cloudbees; Jenkins sponsor) to similar question suggests it does in fact work now and suggests how to generate syntax, but OP complains DSL and documentation is weak.
gdemengin wrote pipeline-logparser to work around another issue JENKINS-54304
Build Failure Analyzer may also be of use to you.
YMMV
You can try something like the following:
stage('check') {
steps {
echo 'checking logs from previous stages...'
logParser failBuildOnError: true, parsingRulesPath: '/path/to/rules', useProjectRule: false, projectRulePath: ''
}
}
The pipeline syntax section in Jenkins allows you to get snippets for your Jenkinsfile

No such property: ToInputStream for class: Script4

I have a situation where I want to import my graph data to database.I am having janusgraph(latest version) running with cassandra(version 3) and elasticsearch(version 6.6.0) using Docker.I have been suggested to use gryo format.So I have tried this command
graph.io(IoCore.gryo()).reader().create().readGraph(ToInputStream.from("my_graph.kryo"), graph);
but ended up with an error
No such property: ToInputStream for class: Script4
The documentation I am following is here.Please take a look and put me in a right procedure. Thanks in advance!
ToInputStream is not a function of Gremlin or JanusGraph. I believe that it is only a function of IBM Compose so unless you are running JanusGraph on that specific platform, this command will not work.
Versions of JanusGraph that utilize TinkerPop 3.4.x will support the io() step and this is the preferred manner in which to load gryo (as well as graphson and graphml) files.
Graph graph = ... // setup JanusGraph instance
GraphTraversalSource g = traversal().withGraph(graph); // might use withRemote() here instead depending on how you are connecting I suppose
g.io("graph.kryo").read().iterate()
Note that if you are connecting remotely - it seems you are sending scripts to the Docker instance given your error - then be sure that that "graph.kryo" file path is accessible to Docker. That's what's nice about ToInputStream from Compose as it allows you to access remote sources.

jenkins nightwatch email report

Has anyone created a simple email report that Jenkins sends out when nightwatch builds fail? or event converted junit reports to email reports?
I would like the following information in a concise report:
Failures
List of code changes
Who was the last people to commit
I don't have a public version, but let me try to offer some assistance how you can combine nodemailer with nightwatch-html-reporter.
I have a working nightwatch located at https://github.com/shane-reaume/nightwatch-bones
You should be able to see where the nightwatch-html-reporter code lives in the globals.js as...
var reporter = new HtmlReporter({
openBrowser: true,
reportsDirectory: __dirname + '/reports/',
themeName: 'default',
reportFilename: os.split(' ').join('-') + '-report.html'
});
Here you are creating an html file. With that you can extract the html for your nodemailer (see https://community.nodemailer.com/).
It seems to be relatively easy if you follow the directions on each, but let me know if you have trouble and I can try to throw something together.
i suggest you to go with the email-extension plugin.
follow the documentation https://wiki.jenkins.io/display/JENKINS/Email-ext+plugin
you can mail the reports as attachements to respective emails sepperating by commas

Resources