Interface PullRequestProviderService
-
public interface PullRequestProviderService
Pull request provider service is used to generate pull request providers for a specific third party system (VCS hosting) type
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description boolean
acceptsVcsUrl(String vcsUrl)
boolean
areBranchSpecsEscaped(Map<String,String> params)
PullRequestProvider
createPullRequestProvider(VcsRoot vcsRoot, BuildTypeSettings buildTypeSettings, PullRequestRetrievalProblems problems, Map<String,String> customParameters)
Creates pull request provider if it matches the VCS root and the build typeString
describeParameters(Map<String,String> params)
String
getAdditionalSuggestionIfFeatureAllowsUntrustedBuilds(Map<String,String> parameters)
Performs additional checks if build feature allows untrusted builds from forks.Map<String,Object>
getBuildFeatureFormOptions(SProject project, SUser user, Map<String,String> params)
List<UserRoleFilter>
getContributorRoles()
String
getDisplayType()
Collection<Predicate<PullRequest>>
getFilters(Map<String,String> parameters, BuildTypeEx buildType)
Returns a specific contributor roles filterdefault List<OAuthConnectionDescriptor>
getOAuthConnections(SProject project)
Returns available OAuth connections of the corresponding type for a specified projectMap<OAuthConnectionDescriptor,Boolean>
getOAuthConnections(SProject project, SUser user)
Returns available OAuth connections of the corresponding type for a specified project and userString
getPullRequestBranchPrefix()
Used to determine untrusted pull requests.List<String>
getPullRequestBranchRefsExamples()
PullRequestFeatureDetector
getPullRequestFeatureDetector()
String
getSettingsUrl()
String
getType()
boolean
isEnabled()
Collection<InvalidProperty>
processParameters(BuildTypeIdentity buildTypeOrTemplate, Map<String,String> params)
Processes and validates build feature parameters for a corresponding VCS hosting typeSet<String>
provideActualBranchesOrBrachSpecs(Collection<PullRequest> pullRequests, Map<String,String> params, boolean generateBranchSpecs)
Returns set of branches or branch specs (depending on @generateBranchSpecs) corresponding on Pull Request detect branches mode (source, request, merge)
-
-
-
Method Detail
-
isEnabled
boolean isEnabled()
- Returns:
- false if the support for this VCS hosting type is disabled by a feature toggle
-
getType
@NotNull String getType()
- Returns:
- VCS hosting type that is served by the providers returned by this service
-
getDisplayType
String getDisplayType()
- Returns:
- VCS hosting type in human readable form (e.g. "GitHub")
-
createPullRequestProvider
@Nullable PullRequestProvider createPullRequestProvider(@NotNull VcsRoot vcsRoot, @NotNull BuildTypeSettings buildTypeSettings, @NotNull PullRequestRetrievalProblems problems, @Nullable Map<String,String> customParameters) throws PullRequestRetrievalException
Creates pull request provider if it matches the VCS root and the build type- Parameters:
vcsRoot
- VCS root instancebuildTypeSettings
- build type or templateproblems
- pull request retrieval problems reportercustomParameters
- if provided it is used instead of the build feature parameters- Returns:
- created pull request provider if possible, null otherwise
- Throws:
PullRequestRetrievalException
-
getContributorRoles
@NotNull List<UserRoleFilter> getContributorRoles()
- Returns:
- contributor roles filters available for the corresponding VCS hosting type
-
getFilters
@NotNull Collection<Predicate<PullRequest>> getFilters(Map<String,String> parameters, BuildTypeEx buildType)
Returns a specific contributor roles filter- Parameters:
parameters
- Filter id- Returns:
- see above
-
getOAuthConnections
@NotNull Map<OAuthConnectionDescriptor,Boolean> getOAuthConnections(@NotNull SProject project, @NotNull SUser user)
Returns available OAuth connections of the corresponding type for a specified project and user- Parameters:
project
- projectuser
- user- Returns:
- see above
-
getOAuthConnections
@NotNull default List<OAuthConnectionDescriptor> getOAuthConnections(@NotNull SProject project)
Returns available OAuth connections of the corresponding type for a specified project- Parameters:
project
- project- Returns:
- see above
-
processParameters
@NotNull Collection<InvalidProperty> processParameters(@NotNull BuildTypeIdentity buildTypeOrTemplate, @NotNull Map<String,String> params)
Processes and validates build feature parameters for a corresponding VCS hosting type- Parameters:
buildTypeOrTemplate
-params
- name value pairs- Returns:
- list of errors
-
getSettingsUrl
String getSettingsUrl()
- Returns:
- A URL of a JSP file that renders corresponding build feature settings
-
getPullRequestFeatureDetector
PullRequestFeatureDetector getPullRequestFeatureDetector()
-
getBuildFeatureFormOptions
Map<String,Object> getBuildFeatureFormOptions(SProject project, SUser user, @NotNull Map<String,String> params)
-
provideActualBranchesOrBrachSpecs
Set<String> provideActualBranchesOrBrachSpecs(@NotNull Collection<PullRequest> pullRequests, @NotNull Map<String,String> params, boolean generateBranchSpecs)
Returns set of branches or branch specs (depending on @generateBranchSpecs) corresponding on Pull Request detect branches mode (source, request, merge)- Parameters:
pullRequests
-params
- Map which must contain parameter to determine detect branch mode for each implemetationgenerateBranchSpecs
- boolean which determine type of values putting into returning set: branch names or branch specs- Returns:
- set of branches or branch specs
-
getPullRequestBranchPrefix
@Nullable String getPullRequestBranchPrefix()
Used to determine untrusted pull requests. Should be implemented together withgetPullRequestBranchRefsExamples()
andacceptsVcsUrl(String)
- Returns:
- the prefix of the branch ref for pull request or null if there is no branches for pull requests, or we don't want to detect builds with pull requests branches as untrusted for this provider
- Since:
- 2024.03
-
acceptsVcsUrl
boolean acceptsVcsUrl(@NotNull String vcsUrl)
- Returns:
- true if the url corresponds to vcs hosting of this provider
- Since:
- 2024.03
-
getPullRequestBranchRefsExamples
@NotNull List<String> getPullRequestBranchRefsExamples()
- Returns:
- possible variations of branch references for pull requests
- Since:
- 2024.3
-
getAdditionalSuggestionIfFeatureAllowsUntrustedBuilds
@Nullable String getAdditionalSuggestionIfFeatureAllowsUntrustedBuilds(@NotNull Map<String,String> parameters)
Performs additional checks if build feature allows untrusted builds from forks.- Returns:
- suggestions how to alter build feature to stop untrusted builds from forks from running(e.g. allow to run builds only from organization members), empty string if untrusted pull requests are not allowed, or null if not implemented
- Since:
- 2024.03
-
-