-
Notifications
You must be signed in to change notification settings - Fork 49
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
Add a debug flag that enables wire logging for git http requests #1125
Conversation
<dependency> | ||
<groupId>com.squareup.okhttp3</groupId> | ||
<artifactId>okhttp</artifactId> | ||
<version>4.9.1</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.squareup.okhttp3</groupId> | ||
<artifactId>logging-interceptor</artifactId> | ||
<version>4.9.1</version> | ||
</dependency> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For instrumenting the client with logging functionality.
public static String gitApiToken(final Function<String, String> envFunc, final Consumer<Integer> exitFunc) { | ||
final String token = envFunc.apply("git_api_token"); | ||
if (Objects.isNull(token)) { | ||
log.error("Please provide GitHub token in environment variables."); | ||
exitFunc.accept(3); | ||
} | ||
return token; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved from within initializeDockerfileGithubUtil
public static String gitApiUrl(final Namespace ns, final Function<String, String> envFunc) throws IOException { | ||
return Optional.ofNullable( | ||
Optional.ofNullable(ns.getString(GIT_API)) | ||
.orElse(envFunc.apply("git_api_url")) | ||
) | ||
.orElseThrow(() -> new IOException("No Git API URL in environment variables nor on the commmand line.")); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved from within initializeDockerfileGithubUtil
@@ -54,7 +54,7 @@ public void execute(final Namespace ns, DockerfileGitHubUtil dockerfileGitHubUti | |||
log.error("Could not initialize the Image tage store. Exception: ", e); | |||
} | |||
|
|||
if (ns.get(Constants.SKIP_PR_CREATION)) { | |||
if (ns.getBoolean(Constants.SKIP_PR_CREATION)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes error of trying to cast Object to boolean
@@ -39,7 +39,7 @@ public DockerfileGitHubUtil(GitHubUtil gitHubUtil) { | |||
this.gitHubUtil = gitHubUtil; | |||
} | |||
|
|||
protected GitHubUtil getGitHubUtil() { return gitHubUtil; } | |||
public GitHubUtil getGitHubUtil() { return gitHubUtil; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Visible for testing
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #1125 +/- ##
============================================
+ Coverage 84.62% 85.69% +1.07%
- Complexity 378 385 +7
============================================
Files 27 27
Lines 1255 1272 +17
Branches 166 165 -1
============================================
+ Hits 1062 1090 +28
+ Misses 157 146 -11
Partials 36 36
|
No description provided.