Skip to content

Commit fd14494

Browse files
authored
Merge pull request #2241 from rnc/MVNSETTINGS
Pass maven settings through
2 parents b674871 + a9505a5 commit fd14494

File tree

5 files changed

+16
-5
lines changed

5 files changed

+16
-5
lines changed

deploy/tasks/maven-deployment.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,4 @@ spec:
7676
- --directory=/var/workdir/deployment
7777
- --mvn-repo=$(params.MVN_REPO)
7878
- --mvn-username=$(params.MVN_USERNAME)
79+
- --mvn-settings=/var/workdir/settings.xml

java-components/build-request-processor/src/main/java/com/redhat/hacbs/container/deploy/DeployCommand.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ public class DeployCommand implements Runnable {
2828
@ConfigProperty(name = "maven.password")
2929
Optional<String> mvnPassword;
3030

31+
@CommandLine.Option(names = "--mvn-settings")
32+
String mvnSettings;
33+
3134
@CommandLine.Option(names = "--mvn-repo")
3235
String mvnRepo;
3336

@@ -45,6 +48,9 @@ public void run() {
4548
Log.warnf("No deployed artifacts found. Has the build been correctly configured to deploy?");
4649
throw new RuntimeException("Deploy failed");
4750
}
51+
if (isNotEmpty(mvnSettings)) {
52+
System.setProperty("maven.settings", mvnSettings);
53+
}
4854
if (isNotEmpty(mvnRepo)) {
4955
// Maven Repo Deployment
5056
MavenRepositoryDeployer deployer = new MavenRepositoryDeployer(mvnCtx, mvnUser, mvnPassword.orElse(""), mvnRepo, serverId, deploymentPath);

java-components/build-request-processor/src/main/java/com/redhat/hacbs/container/deploy/mavenrepository/MavenRepositoryDeployer.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@ public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs)
122122
throw new RuntimeException(e);
123123
}
124124
} else {
125-
if (files.stream().anyMatch(p -> !p.toFile().isDirectory())) {
126-
Log.warnf("For directory %s, no pom file found with files %s", dir,
127-
files);
125+
var filtered = files.stream().filter(f -> !f.toFile().isDirectory()).toList();
126+
if (!filtered.isEmpty()) {
127+
Log.warnf("For directory %s, no pom file found with files %s", dir, filtered);
128128
}
129129
}
130130

java-components/build-request-processor/src/test/java/com/redhat/hacbs/container/deploy/MavenDeployTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ public void testDeploy() throws IOException {
6969

7070
deployCommand.run();
7171
List<LogRecord> logRecords = LogCollectingTestResource.current().getRecords();
72+
73+
assertTrue(logRecords.stream().anyMatch(r -> LogCollectingTestResource.format(r).contains("no pom file found with files")));
7274
assertTrue(logRecords.stream().anyMatch(r -> LogCollectingTestResource.format(r)
7375
.contains("Deploying [com.company.foo:foo-baz:pom:3.25.8]")));
7476
assertTrue(logRecords.stream().anyMatch(r -> LogCollectingTestResource.format(r)
@@ -86,6 +88,8 @@ private Path createDeploymentRepo()
8688
Path artifacts = Paths.get(testData.toString(), "artifacts").toAbsolutePath();
8789
Files.createDirectories(artifacts);
8890

91+
Files.createFile(Paths.get(artifacts.toString(), "test-file.txt"));
92+
8993
// Add data to artifacts folder
9094
for (Map.Entry<String, Set<String>> artifactFiles : ARTIFACT_FILE_MAP.entrySet()) {
9195
String groupPath = GROUP.replace(DOT, File.separator);

pkg/apis/jvmbuildservice/v1alpha1/systemconfig_types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ type SystemConfigList struct {
4747

4848
const (
4949
KonfluxGitDefinition = "https://raw.githubusercontent.com/konflux-ci/build-definitions/refs/heads/main/task/git-clone/0.1/git-clone.yaml"
50-
KonfluxPreBuildDefinitions = "https://raw.githubusercontent.com/rnc/jvm-build-service/PIPELINE/deploy/tasks/pre-build.yaml"
50+
KonfluxPreBuildDefinitions = "https://raw.githubusercontent.com/redhat-appstudio/jvm-build-service/main/deploy/tasks/pre-build.yaml"
5151
KonfluxBuildDefinitions = "https://raw.githubusercontent.com/konflux-ci/build-definitions/refs/heads/main/task/buildah-oci-ta/0.2/buildah-oci-ta.yaml"
52-
KonfluxMavenDeployDefinitions = "https://raw.githubusercontent.com/rnc/jvm-build-service/PIPELINE/deploy/tasks/maven-deployment.yaml"
52+
KonfluxMavenDeployDefinitions = "https://raw.githubusercontent.com/rnc/jvm-build-service/MVNSETTINGS/deploy/tasks/maven-deployment.yaml"
5353
)

0 commit comments

Comments
 (0)