Interface RepositoryHookRequest
- All Known Subinterfaces:
MergeHookRequest
,PullRequestMergeHookRequest
- All Known Implementing Classes:
AbstractRepositoryHookRequest
,BranchCreationHookRequest
,BranchDeletionHookRequest
,BranchHookRequest
,FileEditHookRequest
,RepositoryPushHookRequest
,SimpleMergeHookRequest
,SimplePullRequestMergeHookRequest
,SimpleRepositoryHookRequest
,TagCreationHookRequest
,TagDeletionHookRequest
,TagHookRequest
public interface RepositoryHookRequest
Request that is provided to
repository-hook
modules for inspection
(pre-hooks
and
post-hooks
). The request describes the
ref changes
that are about to be made (pre-hooks), or that have just been made
(post-hooks).
A request is marked as a dry-run
request when the proposed ref changes
need to be quickly verified, for instance to determine whether a button in the web UI should be enabled.
Hooks that are called with a dry-run
request should avoid expensive checks and operations.
- Since:
- 5.0
-
Method Summary
Modifier and TypeMethodDescriptionRetrieves any additional context that was supplied to the request.boolean
isDryRun()
-
Method Details
-
getContext
Retrieves any additional context that was supplied to the request. This context is intended to allow plugin developers to implement their own behavior around ref-changes. As a result, its contents are unspecified; they depend on the installed plugins.On
dry runs
, the context will always be empty.- Returns:
- additional context provided when the ref-change was requested, if any
-
getRefChanges
- Returns:
- the proposed ref changes. Can be
empty
for some dry-run requests where the target hash is not yet known because the relevant commit hasn't been created yet. As an example, this is the case formerge requests
. In these cases, the specialized request type should provide sufficient information about the proposed change. ForMergeHookRequest
, this would beMergeHookRequest.getFromRef()
andMergeHookRequest.getToRef()
.
-
getRepository
- Returns:
- the repository that's being updated
-
getScmHookDetails
- Returns:
- SCM level hook details, if available. This will only be available when the hook is called synchronously as part of an SCM hook (such as pre-receive).
-
getTrigger
- Returns:
- the trigger of the request. This allows hook to adapt their logic based on the trigger.
-
isDryRun
boolean isDryRun()- Returns:
true
if this hook is a dry-run request, otherwisefalse
-