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

Add a debug flag that enables wire logging for git http requests #1125

Merged
merged 5 commits into from
Jan 16, 2024

Conversation

cjneasbi
Copy link
Contributor

No description provided.

@github-actions github-actions bot added the tests Improvements / maintenance to tests label Sep 27, 2023
Comment on lines +147 to +156
<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>
Copy link
Contributor Author

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.

Comment on lines +201 to +208
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;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved from within initializeDockerfileGithubUtil

Comment on lines +214 to +220
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."));
}
Copy link
Contributor Author

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)) {
Copy link
Contributor Author

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; }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Visible for testing

@codecov
Copy link

codecov bot commented Sep 27, 2023

Codecov Report

Attention: 5 lines in your changes are missing coverage. Please review.

Comparison is base (b147c35) 84.62% compared to head (4fa8723) 85.69%.
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@             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              
Files Coverage Δ
...dockerfileimageupdate/subcommands/impl/Parent.java 92.10% <100.00%> (ø)
...esforce/dockerfileimageupdate/utils/Constants.java 100.00% <ø> (ø)
...kerfileimageupdate/utils/DockerfileGitHubUtil.java 86.53% <100.00%> (ø)
.../salesforce/dockerfileimageupdate/CommandLine.java 75.75% <86.84%> (+13.14%) ⬆️

@afalko afalko merged commit a21d7b6 into main Jan 16, 2024
11 of 12 checks passed
@afalko afalko deleted the W-14174147 branch January 16, 2024 06:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Improvements / maintenance to tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants