Package hudson.plugins.jira
Class JiraSite
- java.lang.Object
-
- hudson.model.AbstractDescribableImpl<JiraSite>
-
- hudson.plugins.jira.JiraSite
-
- All Implemented Interfaces:
Describable<JiraSite>
public class JiraSite extends AbstractDescribableImpl<JiraSite>
You must get instance of this only by using the staticget(hudson.model.Job<?, ?>)
orgetSitesFromFolders(ItemGroup)
methods The constructors are only used by JenkinsRepresents 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 Classes Modifier and Type Class Description static class
JiraSite.DescriptorImpl
static class
JiraSite.ExtendedAsynchronousJiraRestClientFactory
-
Field Summary
Fields Modifier and Type Field Description URL
alternativeUrl
URL of Jira for normal access, likehttp://jira.codehaus.org/
.String
credentialsId
The id of the credentials to use.static Pattern
DEFAULT_ISSUE_PATTERN
Regexp pattern that identifies Jira issue token.static int
DEFAULT_READ_TIMEOUT
static int
DEFAULT_THREAD_EXECUTOR_NUMBER
static int
DEFAULT_TIMEOUT
Default rest api client calls timeout, in seconds See issue JENKINS-31113boolean
disableChangelogAnnotations
Disable annotating the changelogsString
groupVisibility
Group visibility to constrain the visibility of the added comment.boolean
recordScmChanges
to record scm changes in jira issueString
roleVisibility
Role visibility to constrain the visibility of the added comment.boolean
supportsWikiStyleComment
True if this Jira is configured to allow Confluence-style Wiki comment.int
timeout
connection timeout used when calling jira rest api, in secondsboolean
updateJiraIssueForAllStatus
updated jira issue for all statusURL
url
URL of Jira for Jenkins access, likehttp://jira.codehaus.org/
.boolean
useBearerAuth
Jira requires Bearer Authentication for loginboolean
useHTTPAuth
Jira requires HTTP Authentication for login
-
Constructor Summary
Constructors Constructor Description JiraSite(String url)
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)
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
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
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
get(Job<?,?> p)
Gets the effectiveJiraSite
associated with the given project and creates automatically jiraSession for each jiraSite foundURL
getAlternativeUrl()
URL
getAlternativeUrl(String id)
Computes the alternative link URL to the given issue.String
getCredentialsId()
String
getDateTimePattern()
boolean
getDisableChangelogAnnotations()
String
getGroupVisibility()
protected com.atlassian.httpclient.api.factory.HttpClientOptions
getHttpClientOptions()
JiraIssue
getIssue(String id)
Returns the remote issue with the given id ornull
if it wasn't found.Pattern
getIssuePattern()
static List<JiraSite>
getJiraSites(Item item)
Creates automatically jiraSession for each jiraSite foundString
getName()
Set<String>
getProjectKeys(Item item)
Gets the list of project IDs in this Jira.int
getReadTimeout()
String
getReleaseNotesForFixVersion(String projectKey, String versionName, String filter)
Generates release notes for a given version.String
getRoleVisibility()
JiraSession
getSession()
Deprecated.should not be usedJiraSession
getSession(Item item)
Gets a remote access session to this Jira site (job-aware) Creates one if none exists already.static List<JiraSite>
getSitesFromFolders(ItemGroup itemGroup)
Creates automatically jiraSession for each jiraSite foundint
getThreadExecutorNumber()
int
getTimeout()
URL
getUrl()
URL
getUrl(JiraIssue issue)
Computes the URL to the given issue.URL
getUrl(String id)
Computes the URL to the given issue.Pattern
getUserPattern()
Gets the user-defined issue pattern if any.Set<ExtendedVersion>
getVersions(String projectKey)
Deprecated.boolean
isAppendChangeTimestamp()
boolean
isRecordScmChanges()
boolean
isSupportsWikiStyleComment()
boolean
isUpdateJiraIssueForAllStatus()
boolean
isUseBearerAuth()
boolean
isUseHTTPAuth()
protected static com.github.benmanes.caffeine.cache.Cache<String,Optional<com.atlassian.jira.rest.client.api.domain.Issue>>
makeIssueCache()
static ItemGroup
map(Item item)
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
readResolve()
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
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 Detail
-
DEFAULT_ISSUE_PATTERN
public static final Pattern 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_TIMEOUT
Default rest api client calls timeout, in seconds See issue JENKINS-31113- See Also:
- Constant Field Values
-
DEFAULT_READ_TIMEOUT
public static final int DEFAULT_READ_TIMEOUT
- See Also:
- Constant Field Values
-
DEFAULT_THREAD_EXECUTOR_NUMBER
public static final int DEFAULT_THREAD_EXECUTOR_NUMBER
- See Also:
- Constant Field Values
-
url
public final URL url
URL of Jira for Jenkins access, likehttp://jira.codehaus.org/
. Mandatory. Normalized to end with '/'
-
alternativeUrl
public URL alternativeUrl
URL of Jira for normal access, likehttp://jira.codehaus.org/
. Mandatory. Normalized to end with '/'
-
useHTTPAuth
public boolean useHTTPAuth
Jira requires HTTP Authentication for login
-
credentialsId
public String credentialsId
The id of the credentials to use. Optional.
-
useBearerAuth
public boolean useBearerAuth
Jira requires Bearer Authentication for login
-
groupVisibility
public String groupVisibility
Group visibility to constrain the visibility of the added comment. Optional.
-
roleVisibility
public String roleVisibility
Role visibility to constrain the visibility of the added comment. Optional.
-
supportsWikiStyleComment
public boolean supportsWikiStyleComment
True if this Jira is configured to allow Confluence-style Wiki comment.
-
recordScmChanges
public boolean recordScmChanges
to record scm changes in jira issue- Since:
- 1.21
-
disableChangelogAnnotations
public boolean disableChangelogAnnotations
Disable annotating the changelogs- Since:
- todo
-
updateJiraIssueForAllStatus
public boolean updateJiraIssueForAllStatus
updated jira issue for all status- Since:
- 1.22
-
timeout
public int timeout
connection timeout used when calling jira rest api, in seconds
-
-
Constructor Detail
-
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)
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)
Deprecated.
-
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
@DataBoundConstructor public JiraSite(String url)
-
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 Detail
-
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
public String getCredentialsId()
-
setCredentialsId
@DataBoundSetter public void setCredentialsId(String credentialsId)
-
setDateTimePattern
@DataBoundSetter public void setDateTimePattern(String dateTimePattern)
-
setThreadExecutorNumber
@DataBoundSetter public void setThreadExecutorNumber(int threadExecutorNumber)
-
getThreadExecutorNumber
public int getThreadExecutorNumber()
-
setAppendChangeTimestamp
@DataBoundSetter public void setAppendChangeTimestamp(boolean appendChangeTimestamp)
-
getDateTimePattern
public String getDateTimePattern()
-
isAppendChangeTimestamp
public boolean isAppendChangeTimestamp()
-
getAlternativeUrl
public URL getAlternativeUrl()
-
isUseHTTPAuth
public boolean isUseHTTPAuth()
-
isUseBearerAuth
public boolean isUseBearerAuth()
-
getGroupVisibility
public String getGroupVisibility()
-
getRoleVisibility
public String getRoleVisibility()
-
isSupportsWikiStyleComment
public boolean isSupportsWikiStyleComment()
-
isRecordScmChanges
public boolean isRecordScmChanges()
-
isUpdateJiraIssueForAllStatus
public boolean isUpdateJiraIssueForAllStatus()
-
setAlternativeUrl
@DataBoundSetter public void setAlternativeUrl(String alternativeUrl)
-
setUseHTTPAuth
@DataBoundSetter public void setUseHTTPAuth(boolean useHTTPAuth)
-
setUseBearerAuth
@DataBoundSetter public void setUseBearerAuth(boolean useBearerAuth)
-
setGroupVisibility
@DataBoundSetter public void setGroupVisibility(String groupVisibility)
-
setRoleVisibility
@DataBoundSetter public void setRoleVisibility(String roleVisibility)
-
setSupportsWikiStyleComment
@DataBoundSetter public void setSupportsWikiStyleComment(boolean supportsWikiStyleComment)
-
setRecordScmChanges
@DataBoundSetter public void setRecordScmChanges(boolean recordScmChanges)
-
setUserPattern
@DataBoundSetter public void setUserPattern(String userPattern)
-
setUpdateJiraIssueForAllStatus
@DataBoundSetter public void setUpdateJiraIssueForAllStatus(boolean updateJiraIssueForAllStatus)
-
readResolve
protected Object readResolve()
-
makeIssueCache
protected static com.github.benmanes.caffeine.cache.Cache<String,Optional<com.atlassian.jira.rest.client.api.domain.Issue>> makeIssueCache()
-
getName
public String getName()
-
getSession
@Deprecated public JiraSession getSession()
Deprecated.should not be used
-
getSession
@Nullable public JiraSession getSession(Item item)
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
@Nullable public URL getUrl()
- Returns:
- the server URL
-
getUrl
public URL getUrl(JiraIssue issue) throws IOException
Computes the URL to the given issue.- Throws:
IOException
-
getUrl
public URL getUrl(String id) throws MalformedURLException
Computes the URL to the given issue.- Throws:
MalformedURLException
-
getAlternativeUrl
public URL getAlternativeUrl(String id) throws MalformedURLException
Computes the alternative link URL to the given issue.- Throws:
MalformedURLException
-
getUserPattern
public Pattern getUserPattern()
Gets the user-defined issue pattern if any.- Returns:
- the pattern or null
-
getIssuePattern
public Pattern getIssuePattern()
-
getProjectKeys
public Set<String> getProjectKeys(Item item)
Gets the list of project IDs in this Jira. This information could be bit old, or it can be null.
-
getIssue
@CheckForNull public JiraIssue getIssue(String id) throws IOException
Returns the remote issue with the given id ornull
if it wasn't found.- Throws:
IOException
-
existsIssue
@Deprecated public boolean existsIssue(String id)
Deprecated.
-
getVersions
@Deprecated public Set<ExtendedVersion> getVersions(String projectKey)
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
-
getJiraSites
public static List<JiraSite> getJiraSites(Item item)
Creates automatically jiraSession for each jiraSite found
-
getSitesFromFolders
public static List<JiraSite> getSitesFromFolders(ItemGroup itemGroup)
Creates automatically jiraSession for each jiraSite found
-
-