Skip to content

Commit f9884c7

Browse files
authored
Merge pull request #472 from jonesbusy/feature/fix-null-owner
Fix null owner and change various logger
2 parents 1800cd2 + af36b84 commit f9884c7

7 files changed

Lines changed: 14 additions & 9 deletions

File tree

Jenkinsfile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
@Library('pipeline-library@pull/893/head') _
2-
31
// While this isn't a plugin, it is much simpler to reuse the pipeline code for CI
42
// allowing easy windows / linux testing and producing incrementals
53
// the only feature that buildPlugin has that relates to plugins is allowing you to test against multiple jenkins versions
64
buildPlugin(
75
useContainerAgent: false,
8-
useArtifactCachingProxy: false,
96
configurations: [
107
[platform: 'linux', jdk: 21],
118
[platform: 'windows', jdk: 21],

plugin-modernizer-cli/src/test/java/io/jenkins/tools/pluginmodernizer/cli/CommandLineITCase.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,8 @@ public void testBuildMetadata(PluginMetadata expectedMetadata, WireMockRuntimeIn
208208
// Assert output
209209
assertAll(
210210
() -> assertEquals(0, result.getExitCode()),
211+
() -> assertTrue(Files.readAllLines(outputPath.resolve("stdout.txt")).stream()
212+
.anyMatch(line -> line.matches("(.*)GitHub owner: fake-owner(.*)"))),
211213
() -> assertTrue(Files.readAllLines(outputPath.resolve("stdout.txt")).stream()
212214
.anyMatch(line ->
213215
line.matches(".*Metadata was fetched for plugin empty and is available at.*"))));

plugin-modernizer-cli/src/test/java/io/jenkins/tools/pluginmodernizer/cli/utils/GitHubServerContainer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ private void setupMock() {
120120
byte[] privateKey = sshIdentity.getPrivateKey();
121121
try {
122122
Files.write(keysPath.resolve(plugin), privateKey);
123-
LOG.info("Private key: {}", keysPath.resolve(plugin));
123+
LOG.debug("Private key: {}", keysPath.resolve(plugin));
124124
} catch (IOException e) {
125125
throw new ModernizerException("Error writing private key", e);
126126
}

plugin-modernizer-cli/src/test/resources/logback-test.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
<appender-ref ref="CONSOLE" />
1616
</root>
1717
<logger name="io.jenkins.tools.pluginmodernizer" level="TRACE" />
18+
<logger name="io.jenkins.tools.pluginmodernizer.cli.utils" level="INFO" />
1819
<logger name="org.testcontainers" level="INFO" />
20+
<logger name="com.github.sparsick.testcontainers" level="INFO" />
21+
<logger name="tc.rockstorm/git-server:2.45" level="WARN" />
22+
<logger name="tc.testcontainers/ryuk:0.9.0" level="WARN" />
1923
<logger name="com.github.dockerjava" level="INFO" />
2024
</configuration>

plugin-modernizer-core/src/main/java/io/jenkins/tools/pluginmodernizer/core/extractor/MetadataFlag.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,11 @@ public boolean isApplicable(Plugin plugin, PluginService pluginService) {
145145
return false;
146146
}
147147
if (plugin.getMetadata().hasFlag(this)) {
148-
LOG.debug("Flag {} already set for plugin {}", this, plugin.getName());
148+
LOG.trace("Flag {} already set for plugin {}", this, plugin.getName());
149149
return true;
150150
}
151151
if (isApplicablePlugin == null) {
152-
LOG.debug("No applicable plugin check for flag {}", this);
152+
LOG.trace("No applicable plugin check for flag {}", this);
153153
return false;
154154
}
155155
boolean result = isApplicablePlugin.test(plugin, pluginService);

plugin-modernizer-core/src/main/java/io/jenkins/tools/pluginmodernizer/core/github/GHService.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,9 @@ public void fetch(Plugin plugin) {
511511
}
512512
try {
513513
fetchRepository(plugin);
514-
LOG.debug("Fetched repository from {}", repository.getSshUrl());
514+
LOG.debug(
515+
"Fetched repository from {}",
516+
sshKeyAuth ? repository.getSshUrl() : repository.getHttpTransportUrl());
515517
} catch (GitAPIException | URISyntaxException e) {
516518
LOG.error("Failed to fetch the repository", e);
517519
plugin.addError("Failed to fetch the repository", e);

plugin-modernizer-core/src/main/java/io/jenkins/tools/pluginmodernizer/core/impl/PluginModernizer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,9 @@ public void start() {
140140
// Debug config
141141
LOG.debug("Plugins: {}", config.getPlugins());
142142
LOG.debug("Recipe: {}", config.getRecipe().getName());
143-
LOG.debug("GitHub owner: {}", config.getGithubOwner());
143+
LOG.debug("GitHub owner: {}", getGithubOwner());
144144
if (ghService.isSshKeyAuth()) {
145-
LOG.debug("SSH private key: {}", config.getSshPrivateKey());
145+
LOG.debug("SSH private key: {}", getSshPrivateKeyPath());
146146
} else {
147147
LOG.debug("Using GitHub token for git authentication");
148148
}

0 commit comments

Comments
 (0)