Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JENKINS-73297] Improve error handling when commit is not found #815

Merged
merged 2 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ private RemoteResultWrapper<Delta> calculateDelta(final Repository repository) t
GitDelta delta = new GitDelta(currentCommitId, referenceCommitId, Map.of(), exception.getMessage());
RemoteResultWrapper<Delta> wrapper = new RemoteResultWrapper<>(delta, "Errors from Git Delta:");

wrapper.logError("Could not find commit", exception);
wrapper.logException(exception, "Could not find the specified commit - is the SCM parameter correctly set?");

return wrapper;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public Optional<Delta> calculateDelta(final Run<?, ?> build, final Run<?, ?> ref
RemoteResultWrapper<Delta> wrapped = git.withRepository(
new DeltaRepositoryCallback(currentCommit, referenceCommit));
wrapped.getInfoMessages().forEach(log::logInfo);
wrapped.getErrorMessages().forEach(log::logError);
return Optional.of(wrapped.getResult());
}
catch (IOException | InterruptedException exception) {
Expand All @@ -77,12 +78,12 @@ public Optional<Delta> calculateDelta(final Run<?, ?> build, final Run<?, ?> ref
}

/**
* Returns the latest commit of the {@link GitCommitsRecord commits record} of a Git repository.
* Returns the latest commit of the {@link GitCommitsRecord commit record} of a Git repository.
*
* @param buildName
* the name of the build the commits record corresponds to
* @param record
* the commits record
* the commit record
* @param log
* the log
*
Expand Down
Loading