We have a script which retrieves us the version history:
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.search.SearchProvider import com.atlassian.jira.jql.parser.JqlQueryParser import com.atlassian.jira.web.bean.PagerFilter import com.atlassian.jira.user.util.DefaultUserManager import com.atlassian.crowd.embedded.api.User import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.Issue import com.atlassian.jira.ComponentManager import java.text.SimpleDateFormat import java.util.Date def jqlQueryParser = ComponentAccessor.getComponent(JqlQueryParser) def searchProvider = ComponentAccessor.getComponent(SearchProvider) def issueManager = ComponentAccessor.getIssueManager() def userManager = ComponentAccessor.getUserManager(); // Adjust HERE the buildnumber to a certain version, where you want to retrieve all closed devs def buildNumber = 7 def user = ComponentAccessor.getJiraAuthenticationContext().loggedInUser def query = jqlQueryParser.parseQuery('project = DIV AND issuetype = Development AND status = Closed AND fixVersion = 2.8 AND "Build Number" ~ ' + buildNumber.toString()) def results = searchProvider.search(query, user, PagerFilter.getUnlimitedFilter()) def closedDevs = ""; def closedDevList = []; def featureList = []; def bugList = []; results.getIssues().each {issue -> Issue parentIssue = issue.parentObject; def issueName = parentIssue.getIssueType().name.toUpperCase(); def issueSummary = issue.getSummary(); if (issueSummary.substring(0, 8) == "[DEV] - ") issueSummary = issueSummary.substring(8, issueSummary.length()); closedDevs += "* {{$issueName}} " + issueSummary + " {{JIRA|$issue.key}}<br>"; def text = "* {{$issueName}} " + issueSummary + " {{JIRA|$issue.key}}"; if (issueName == "FEATURE") featureList << text; else bugList << text; } def metadata = "=== Version 2.8.0 - Build $buildNumber ===<br>"; metadata += "<br>"; metadata += "Release: " + new Date().format('YYYY-MM-dd') + "<br><br>"; featureList.each { metadata += "${it}<br>"; } bugList.each { metadata += "${it}<br>"; } return metadata;
What we want to do now is, executing this script from the cmd line (windows batch) and retrieve the data. It must not be directly cmd line, but I need somehow the returned data in a text file.
Convert it into a "REST Endpoint" (mostly copy and paste I think), then you can poke JIRA any time you need it to pull back the output.
I was able to setup an endpoint.
However, I need an additional argument to setup the build number
e.g:
http://jira/rest/scriptrunner/latest/custom/retrieveReleaseNotes/49
I need to read out the number 49 and want to use it in my script.
How can I do this?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry, missed the email earlier.
Yes, have a look through https://scriptrunner.adaptavist.com/latest/bitbucket/rest-endpoints.html
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
My reply was not accepted because of an inappropriate language or spam....
Thats why I have to paste the reply here:
https://paste.ee/p/m5oNU#ZueE5Ghy3m1WycxuIck5Lir09QzuuTwW
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The paste doesn't work, sorry.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Probably, but I don't know what it's got to do with the question.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What do you mean what its got to do with the quqestion?
I cannot parse the argument:
I get following error:
message "Cannot cast object 'com.atlassian.plugin.servlet.PluginHttpRequestWrapper@631bb09c' with class 'com.sun.proxy.$Proxy2885' to class 'groovy.lang.Closure'"
stack-trace "org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'com.atlassian.plugin.servlet.PluginHttpRequestWrapper@631bb09c' with class 'com.sun.proxy.$Proxy2885' to class 'groovy.lang.Closure'\n\tat com.onresolve.scriptrunner.runner.rest.common.CustomEndpointDelegate.methodMissing(CustomEndpointDelegate.groovy:20)\n\tat Script559$_run_closure1.doCall(Script559.groovy:30)\n\tat com.onresolve.scriptrunner.runner.rest.common.UserCustomScriptEndpoint.doEndpoint(UserCustomScriptEndpoint.groovy:308)\n\tat com.onresolve.scriptrunner.runner.rest.common.UserCustomScriptEndpoint.getUserEndpoint(UserCustomScriptEndpoint.groovy:193)\n"
status-code "INTERNAL_SERVER_ERROR"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please help me, I cannot fix it without your help
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.