Package hudson.plugins.jira
Class JiraSite
- All Implemented Interfaces:
Describable<JiraSite>
You must get instance of this only by using the static
get(hudson.model.Job<?, ?>)
or getSitesFromFolders(ItemGroup)
methods
The constructors are only used by Jenkins
Represents an external Jira installation and configuration needed to access this Jira.
When adding new fields do not miss to look at readResolve method!!- Author:
- Kohsuke Kawaguchi
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static class
-
Field Summary
FieldsModifier and TypeFieldDescriptionURL of Jira for normal access, likehttp://jira.codehaus.org/
.The id of the credentials to use.static final Pattern
Regexp pattern that identifies Jira issue token.static final Integer
static final int
static final int
static final int
Default rest api client calls timeout, in seconds See issue JENKINS-31113boolean
Disable annotating the changelogsGroup visibility to constrain the visibility of the added comment.static final Integer
boolean
to record scm changes in jira issueRole visibility to constrain the visibility of the added comment.boolean
True if this Jira is configured to allow Confluence-style Wiki comment.int
connection timeout used when calling jira rest api, in secondsboolean
updated jira issue for all statusfinal URL
URL of Jira for Jenkins access, likehttp://jira.codehaus.org/
.boolean
Jira requires Bearer Authentication for loginboolean
Jira requires HTTP Authentication for login -
Constructor Summary
ConstructorsConstructorDescriptionJiraSite
(URL url, URL alternativeUrl, com.cloudbees.plugins.credentials.common.StandardUsernamePasswordCredentials credentials, boolean supportsWikiStyleComment, boolean recordScmChanges, String userPattern, boolean updateJiraIssueForAllStatus, String groupVisibility, String roleVisibility, boolean useHTTPAuth) Deprecated.JiraSite
(URL url, URL alternativeUrl, com.cloudbees.plugins.credentials.common.StandardUsernamePasswordCredentials credentials, boolean supportsWikiStyleComment, boolean recordScmChanges, String userPattern, boolean updateJiraIssueForAllStatus, String groupVisibility, String roleVisibility, boolean useHTTPAuth, int timeout, int readTimeout, int threadExecutorNumber) Deprecated.JiraSite
(URL url, URL alternativeUrl, com.cloudbees.plugins.credentials.common.StandardUsernamePasswordCredentials credentials, boolean supportsWikiStyleComment, boolean recordScmChanges, String userPattern, boolean updateJiraIssueForAllStatus, String groupVisibility, String roleVisibility, boolean useHTTPAuth, int timeout, int readTimeout, int threadExecutorNumber, boolean useBearerAuth) Deprecated.JiraSite
(URL url, URL alternativeUrl, String credentialsId, boolean supportsWikiStyleComment, boolean recordScmChanges, String userPattern, boolean updateJiraIssueForAllStatus, String groupVisibility, String roleVisibility, boolean useHTTPAuth) Deprecated.JiraSite
(URL url, URL alternativeUrl, String credentialsId, boolean supportsWikiStyleComment, boolean recordScmChanges, String userPattern, boolean updateJiraIssueForAllStatus, String groupVisibility, String roleVisibility, boolean useHTTPAuth, int timeout, int readTimeout, int threadExecutorNumber) Deprecated.JiraSite
(URL url, URL alternativeUrl, String userName, String password, boolean supportsWikiStyleComment, boolean recordScmChanges, String userPattern, boolean updateJiraIssueForAllStatus, String groupVisibility, String roleVisibility, boolean useHTTPAuth) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addFixVersionToIssue
(String projectKey, String versionName, String query) Adds new fix version to issues matching the jql.void
destroy()
boolean
existsIssue
(String id) Deprecated.static JiraSite
Gets the effectiveJiraSite
associated with the given project and creates automatically jiraSession for each jiraSite foundComputes the alternative link URL to the given issue.boolean
protected com.atlassian.httpclient.api.factory.HttpClientOptions
Returns the remote issue with the given id ornull
if it wasn't found.getJiraSites
(Item item) Creates automatically jiraSession for each jiraSite foundint
getName()
getProjectKeys
(Item item) Gets the list of project IDs in this Jira.int
getReleaseNotesForFixVersion
(String projectKey, String versionName, String filter) Generates release notes for a given version.Deprecated.should not be usedgetSession
(Item item) Gets a remote access session to this Jira site (job-aware) Creates one if none exists already.getSitesFromFolders
(ItemGroup itemGroup) Creates automatically jiraSession for each jiraSite foundint
int
getUrl()
Computes the URL to the given issue.Computes the URL to the given issue.Gets the user-defined issue pattern if any.getVersions
(String projectKey) Deprecated.boolean
boolean
boolean
boolean
boolean
boolean
protected static com.github.benmanes.caffeine.cache.Cache<String,
Optional<com.atlassian.jira.rest.client.api.domain.Issue>> static ItemGroup
void
migrateIssuesToFixVersion
(String projectKey, String versionName, String query) Migrates issues matching the jql query provided to a new fix version.boolean
progressMatchingIssues
(String jqlSearch, String workflowActionName, String comment, PrintStream console) Progresses all issues matching the JQL search, using the given workflow action.protected Object
void
replaceFixVersion
(String projectKey, String fromVersion, String toVersion, String query) Migrates issues matching the jql query provided to a new fix version.void
setAlternativeUrl
(String alternativeUrl) void
setAppendChangeTimestamp
(boolean appendChangeTimestamp) void
setCredentialsId
(String credentialsId) void
setDateTimePattern
(String dateTimePattern) void
setDisableChangelogAnnotations
(boolean disableChangelogAnnotations) void
setGroupVisibility
(String groupVisibility) void
setMaxIssuesFromJqlSearch
(int maxIssuesFromJqlSearch) void
setReadTimeout
(int readTimeout) Sets read timeout (in seconds).void
setRecordScmChanges
(boolean recordScmChanges) void
setRoleVisibility
(String roleVisibility) void
setSupportsWikiStyleComment
(boolean supportsWikiStyleComment) void
setThreadExecutorNumber
(int threadExecutorNumber) void
setTimeout
(int timeoutSec) Sets connect timeout (in seconds).void
setUpdateJiraIssueForAllStatus
(boolean updateJiraIssueForAllStatus) void
setUseBearerAuth
(boolean useBearerAuth) void
setUseHTTPAuth
(boolean useHTTPAuth) void
setUserPattern
(String userPattern) Methods inherited from class hudson.model.AbstractDescribableImpl
getDescriptor
-
Field Details
-
DEFAULT_ISSUE_PATTERN
Regexp pattern that identifies Jira issue token. If this pattern changes help pages (help-issue-pattern_xy.html) must be updated First char must be a letter, then at least one letter, digit or underscore. See issue JENKINS-729, JENKINS-4092 -
DEFAULT_TIMEOUT
public static final int DEFAULT_TIMEOUTDefault rest api client calls timeout, in seconds See issue JENKINS-31113- See Also:
-
DEFAULT_READ_TIMEOUT
public static final int DEFAULT_READ_TIMEOUT- See Also:
-
DEFAULT_THREAD_EXECUTOR_NUMBER
public static final int DEFAULT_THREAD_EXECUTOR_NUMBER- See Also:
-
DEFAULT_ISSUES_FROM_JQL
-
MAX_ALLOWED_ISSUES_FROM_JQL
-
url
URL of Jira for Jenkins access, likehttp://jira.codehaus.org/
. Mandatory. Normalized to end with '/' -
alternativeUrl
URL of Jira for normal access, likehttp://jira.codehaus.org/
. Mandatory. Normalized to end with '/' -
useHTTPAuth
public boolean useHTTPAuthJira requires HTTP Authentication for login -
credentialsId
The id of the credentials to use. Optional. -
useBearerAuth
public boolean useBearerAuthJira requires Bearer Authentication for login -
groupVisibility
Group visibility to constrain the visibility of the added comment. Optional. -
roleVisibility
Role visibility to constrain the visibility of the added comment. Optional. -
supportsWikiStyleComment
public boolean supportsWikiStyleCommentTrue if this Jira is configured to allow Confluence-style Wiki comment. -
recordScmChanges
public boolean recordScmChangesto record scm changes in jira issue- Since:
- 1.21
-
disableChangelogAnnotations
public boolean disableChangelogAnnotationsDisable annotating the changelogs- Since:
- todo
-
updateJiraIssueForAllStatus
public boolean updateJiraIssueForAllStatusupdated jira issue for all status- Since:
- 1.22
-
timeout
public int timeoutconnection timeout used when calling jira rest api, in seconds
-
-
Constructor Details
-
JiraSite
@Deprecated public JiraSite(URL url, @CheckForNull URL alternativeUrl, @CheckForNull String credentialsId, boolean supportsWikiStyleComment, boolean recordScmChanges, @CheckForNull String userPattern, boolean updateJiraIssueForAllStatus, @CheckForNull String groupVisibility, @CheckForNull String roleVisibility, boolean useHTTPAuth) Deprecated. -
JiraSite
@Deprecated public JiraSite(URL url, @CheckForNull URL alternativeUrl, String userName, String password, boolean supportsWikiStyleComment, boolean recordScmChanges, @CheckForNull String userPattern, boolean updateJiraIssueForAllStatus, @CheckForNull String groupVisibility, @CheckForNull String roleVisibility, boolean useHTTPAuth) throws Descriptor.FormException Deprecated.- Throws:
Descriptor.FormException
-
JiraSite
@Deprecated public JiraSite(URL url, URL alternativeUrl, com.cloudbees.plugins.credentials.common.StandardUsernamePasswordCredentials credentials, boolean supportsWikiStyleComment, boolean recordScmChanges, String userPattern, boolean updateJiraIssueForAllStatus, String groupVisibility, String roleVisibility, boolean useHTTPAuth) throws Descriptor.FormException Deprecated.- Throws:
Descriptor.FormException
-
JiraSite
@Deprecated public JiraSite(URL url, URL alternativeUrl, String credentialsId, boolean supportsWikiStyleComment, boolean recordScmChanges, String userPattern, boolean updateJiraIssueForAllStatus, String groupVisibility, String roleVisibility, boolean useHTTPAuth, int timeout, int readTimeout, int threadExecutorNumber) Deprecated. -
JiraSite
-
JiraSite
@Deprecated public JiraSite(URL url, URL alternativeUrl, com.cloudbees.plugins.credentials.common.StandardUsernamePasswordCredentials credentials, boolean supportsWikiStyleComment, boolean recordScmChanges, String userPattern, boolean updateJiraIssueForAllStatus, String groupVisibility, String roleVisibility, boolean useHTTPAuth, int timeout, int readTimeout, int threadExecutorNumber) Deprecated. -
JiraSite
@Deprecated public JiraSite(URL url, URL alternativeUrl, com.cloudbees.plugins.credentials.common.StandardUsernamePasswordCredentials credentials, boolean supportsWikiStyleComment, boolean recordScmChanges, String userPattern, boolean updateJiraIssueForAllStatus, String groupVisibility, String roleVisibility, boolean useHTTPAuth, int timeout, int readTimeout, int threadExecutorNumber, boolean useBearerAuth) Deprecated.
-
-
Method Details
-
setDisableChangelogAnnotations
@DataBoundSetter public void setDisableChangelogAnnotations(boolean disableChangelogAnnotations) -
getDisableChangelogAnnotations
public boolean getDisableChangelogAnnotations() -
setTimeout
@DataBoundSetter public void setTimeout(int timeoutSec) Sets connect timeout (in seconds). If not specified, a default timeout will be used.- Parameters:
timeoutSec
- Timeout in seconds
-
getTimeout
public int getTimeout() -
setReadTimeout
@DataBoundSetter public void setReadTimeout(int readTimeout) Sets read timeout (in seconds). If not specified, a default timeout will be used.- Parameters:
readTimeout
- Timeout in seconds
-
getReadTimeout
public int getReadTimeout() -
getCredentialsId
-
setCredentialsId
-
setDateTimePattern
-
setThreadExecutorNumber
@DataBoundSetter public void setThreadExecutorNumber(int threadExecutorNumber) -
getThreadExecutorNumber
public int getThreadExecutorNumber() -
setAppendChangeTimestamp
@DataBoundSetter public void setAppendChangeTimestamp(boolean appendChangeTimestamp) -
getDateTimePattern
-
isAppendChangeTimestamp
public boolean isAppendChangeTimestamp() -
getAlternativeUrl
-
isUseHTTPAuth
public boolean isUseHTTPAuth() -
isUseBearerAuth
public boolean isUseBearerAuth() -
getGroupVisibility
-
getRoleVisibility
-
isSupportsWikiStyleComment
public boolean isSupportsWikiStyleComment() -
isRecordScmChanges
public boolean isRecordScmChanges() -
isUpdateJiraIssueForAllStatus
public boolean isUpdateJiraIssueForAllStatus() -
setAlternativeUrl
-
setUseHTTPAuth
@DataBoundSetter public void setUseHTTPAuth(boolean useHTTPAuth) -
setUseBearerAuth
@DataBoundSetter public void setUseBearerAuth(boolean useBearerAuth) -
setGroupVisibility
-
setRoleVisibility
-
setSupportsWikiStyleComment
@DataBoundSetter public void setSupportsWikiStyleComment(boolean supportsWikiStyleComment) -
setRecordScmChanges
@DataBoundSetter public void setRecordScmChanges(boolean recordScmChanges) -
setUserPattern
-
setUpdateJiraIssueForAllStatus
@DataBoundSetter public void setUpdateJiraIssueForAllStatus(boolean updateJiraIssueForAllStatus) -
setMaxIssuesFromJqlSearch
@DataBoundSetter public void setMaxIssuesFromJqlSearch(int maxIssuesFromJqlSearch) -
getMaxIssuesFromJqlSearch
public int getMaxIssuesFromJqlSearch() -
readResolve
- Throws:
Descriptor.FormException
-
makeIssueCache
-
getName
-
getSession
Deprecated.should not be used -
getSession
Gets a remote access session to this Jira site (job-aware) Creates one if none exists already.- Returns:
- null if remote access is not supported.
-
getHttpClientOptions
protected com.atlassian.httpclient.api.factory.HttpClientOptions getHttpClientOptions() -
destroy
@PreDestroy public void destroy() -
getUrl
- Returns:
- the server URL
-
getUrl
Computes the URL to the given issue.- Throws:
IOException
-
getUrl
Computes the URL to the given issue.- Throws:
MalformedURLException
-
getAlternativeUrl
Computes the alternative link URL to the given issue.- Throws:
MalformedURLException
-
getUserPattern
Gets the user-defined issue pattern if any.- Returns:
- the pattern or null
-
getIssuePattern
-
getProjectKeys
Gets the list of project IDs in this Jira. This information could be bit old, or it can be null. -
getIssue
Returns the remote issue with the given id ornull
if it wasn't found.- Throws:
IOException
-
existsIssue
Deprecated. -
getVersions
Deprecated.Returns all versions for the given project key.- Parameters:
projectKey
- Project Key- Returns:
- A set of JiraVersions
-
getReleaseNotesForFixVersion
public String getReleaseNotesForFixVersion(String projectKey, String versionName, String filter) throws TimeoutException Generates release notes for a given version.- Parameters:
projectKey
- the project keyversionName
- the versionfilter
- Additional JQL Filter. Example: status in (Resolved,Closed)- Returns:
- release notes
- Throws:
TimeoutException
- if too long
-
replaceFixVersion
public void replaceFixVersion(String projectKey, String fromVersion, String toVersion, String query) throws TimeoutException Migrates issues matching the jql query provided to a new fix version.- Parameters:
projectKey
- The project keytoVersion
- The new fixVersionquery
- A JQL Query- Throws:
TimeoutException
- if too long
-
migrateIssuesToFixVersion
public void migrateIssuesToFixVersion(String projectKey, String versionName, String query) throws TimeoutException Migrates issues matching the jql query provided to a new fix version.- Parameters:
projectKey
- The project keyversionName
- The new fixVersionquery
- A JQL Query- Throws:
TimeoutException
- if too long
-
addFixVersionToIssue
public void addFixVersionToIssue(String projectKey, String versionName, String query) throws TimeoutException Adds new fix version to issues matching the jql.- Parameters:
projectKey
- the project keyversionName
- the versionquery
- the query- Throws:
TimeoutException
- if too long
-
progressMatchingIssues
public boolean progressMatchingIssues(String jqlSearch, String workflowActionName, String comment, PrintStream console) throws TimeoutException Progresses all issues matching the JQL search, using the given workflow action. Optionally adds a comment to the issue(s) at the same time.- Parameters:
jqlSearch
- the queryworkflowActionName
- the workflowActionNamecomment
- the commentconsole
- the console- Throws:
TimeoutException
- TimeoutException if too long
-
map
-
getJiraSites
Creates automatically jiraSession for each jiraSite found -
getSitesFromFolders
Creates automatically jiraSession for each jiraSite found -
get
Gets the effectiveJiraSite
associated with the given project and creates automatically jiraSession for each jiraSite found- Returns:
null
if no such was found.
-