Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions deploy/tasks/maven-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,25 @@ spec:
description: Name of the processor image. Useful to override for development.
type: string
default: "quay.io/redhat-user-workloads/konflux-jbs-pnc-tenant/jvm-build-service/build-request-processor:latest"
- name: caTrustConfigMapKey
description: The name of the key in the ConfigMap that contains the
CA bundle data.
type: string
default: ca-bundle.crt
- name: caTrustConfigMapName
description: The name of the ConfigMap to read CA bundle data from.
type: string
default: trusted-ca
volumes:
- name: workdir
emptyDir: {}
- name: trusted-ca
configMap:
name: $(params.caTrustConfigMapName)
items:
- key: $(params.caTrustConfigMapKey)
path: ca-bundle.crt
optional: true
stepTemplate:
volumeMounts:
- mountPath: /var/workdir
Expand Down Expand Up @@ -74,6 +90,10 @@ spec:
requests:
cpu: 10m
memory: 512Mi
volumeMounts:
- mountPath: /mnt/trusted-ca
name: trusted-ca
readOnly: true
env:
- name: MAVEN_PASSWORD
valueFrom:
Expand All @@ -88,3 +108,13 @@ spec:
- --mvn-repo=$(params.MVN_REPO)
- --mvn-username=$(params.MVN_USERNAME)
- --server-id=$(params.MVN_SERVER_ID)
script: |
#!/bin/bash
set -e
ca_bundle=/mnt/trusted-ca/ca-bundle.crt
if [ -f "$ca_bundle" ]; then
echo "INFO: Using mounted CA bundle: $ca_bundle"
cp -vf $ca_bundle /etc/pki/ca-trust/source/anchors
update-ca-trust
fi
/opt/jboss/container/java/run/run-java.sh $@
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
@CommandLine.Command(name = "deploy")
public class DeployCommand implements Runnable {

@CommandLine.Option(names = "--directory")
@CommandLine.Option(names = "--directory", required = true)
String artifactDirectory;

// Maven Repo Deployment specification
Expand All @@ -35,7 +35,7 @@ public class DeployCommand implements Runnable {
@CommandLine.Option(names = "--mvn-settings")
String mvnSettings;

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

@CommandLine.Option(names = "--server-id")
Expand All @@ -59,7 +59,7 @@ public void run() {
}
System.setProperty("maven.settings", mvnSettings);
}
if (isNotEmpty(accessToken)) {
if (accessToken.isPresent()) {
String servers = """
<settings>
<!--
Expand Down Expand Up @@ -91,12 +91,9 @@ public void run() {
System.setProperty("maven.settings", settings.toString());
}
}
if (isNotEmpty(mvnRepo)) {
// Maven Repo Deployment
MavenRepositoryDeployer deployer = new MavenRepositoryDeployer(mvnCtx, mvnUser, mvnPassword.orElse(""), mvnRepo, serverId, deploymentPath);
deployer.deploy();
}

// Maven Repo Deployment
MavenRepositoryDeployer deployer = new MavenRepositoryDeployer(mvnCtx, mvnUser, mvnPassword.orElse(""), mvnRepo, serverId, deploymentPath);
deployer.deploy();
} catch (Exception e) {
Log.error("Deployment failed", e);
throw new RuntimeException(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public void testDeploy() throws IOException {
DeployCommand deployCommand = new DeployCommand();
deployCommand.mvnCtx = mvnContext;
deployCommand.mvnPassword = Optional.empty();
deployCommand.accessToken = Optional.empty();
deployCommand.mvnRepo = deployment.toAbsolutePath().toUri().toString();
deployCommand.artifactDirectory = onDiskRepo.toString();

Expand Down
Loading