Skip to content

Commit

Permalink
Merge pull request #2241 from rnc/MVNSETTINGS
Browse files Browse the repository at this point in the history
Pass maven settings through
  • Loading branch information
rnc authored Oct 28, 2024
2 parents b674871 + a9505a5 commit fd14494
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 5 deletions.
1 change: 1 addition & 0 deletions deploy/tasks/maven-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,4 @@ spec:
- --directory=/var/workdir/deployment
- --mvn-repo=$(params.MVN_REPO)
- --mvn-username=$(params.MVN_USERNAME)
- --mvn-settings=/var/workdir/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ public class DeployCommand implements Runnable {
@ConfigProperty(name = "maven.password")
Optional<String> mvnPassword;

@CommandLine.Option(names = "--mvn-settings")
String mvnSettings;

@CommandLine.Option(names = "--mvn-repo")
String mvnRepo;

Expand All @@ -45,6 +48,9 @@ public void run() {
Log.warnf("No deployed artifacts found. Has the build been correctly configured to deploy?");
throw new RuntimeException("Deploy failed");
}
if (isNotEmpty(mvnSettings)) {
System.setProperty("maven.settings", mvnSettings);
}
if (isNotEmpty(mvnRepo)) {
// Maven Repo Deployment
MavenRepositoryDeployer deployer = new MavenRepositoryDeployer(mvnCtx, mvnUser, mvnPassword.orElse(""), mvnRepo, serverId, deploymentPath);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs)
throw new RuntimeException(e);
}
} else {
if (files.stream().anyMatch(p -> !p.toFile().isDirectory())) {
Log.warnf("For directory %s, no pom file found with files %s", dir,
files);
var filtered = files.stream().filter(f -> !f.toFile().isDirectory()).toList();
if (!filtered.isEmpty()) {
Log.warnf("For directory %s, no pom file found with files %s", dir, filtered);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ public void testDeploy() throws IOException {

deployCommand.run();
List<LogRecord> logRecords = LogCollectingTestResource.current().getRecords();

assertTrue(logRecords.stream().anyMatch(r -> LogCollectingTestResource.format(r).contains("no pom file found with files")));
assertTrue(logRecords.stream().anyMatch(r -> LogCollectingTestResource.format(r)
.contains("Deploying [com.company.foo:foo-baz:pom:3.25.8]")));
assertTrue(logRecords.stream().anyMatch(r -> LogCollectingTestResource.format(r)
Expand All @@ -86,6 +88,8 @@ private Path createDeploymentRepo()
Path artifacts = Paths.get(testData.toString(), "artifacts").toAbsolutePath();
Files.createDirectories(artifacts);

Files.createFile(Paths.get(artifacts.toString(), "test-file.txt"));

// Add data to artifacts folder
for (Map.Entry<String, Set<String>> artifactFiles : ARTIFACT_FILE_MAP.entrySet()) {
String groupPath = GROUP.replace(DOT, File.separator);
Expand Down
4 changes: 2 additions & 2 deletions pkg/apis/jvmbuildservice/v1alpha1/systemconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ type SystemConfigList struct {

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

0 comments on commit fd14494

Please sign in to comment.