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 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")
      • getContributorRoles

        @NotNull
        List<UserRoleFilter> getContributorRoles()
        Returns:
        contributor roles filters available for the corresponding VCS hosting type
      • 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 - project
        user - 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
      • 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 implemetation
        generateBranchSpecs - 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 with getPullRequestBranchRefsExamples() and acceptsVcsUrl(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
      • areBranchSpecsEscaped

        boolean areBranchSpecsEscaped​(@NotNull
                                      Map<String,​String> params)
        Parameters:
        params - build feature parameters
        Returns:
        true if the build feature can use backslash to escape some characters in branch names
        Since:
        2024.03