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
1 change: 0 additions & 1 deletion deploy/tasks/maven-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,3 @@ spec:
- --mvn-repo=$(params.MVN_REPO)
- --mvn-username=$(params.MVN_USERNAME)
- --server-id=$(params.MVN_SERVER_ID)
- --mvn-settings=/var/workdir/settings/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public void run() {
export MAVEN_HOME=${MAVEN_HOME:=/opt/maven/3.8.8}
export GRADLE_USER_HOME="${JBS_WORKDIR}/software/settings/.gradle"

mkdir -p ${JBS_WORKDIR}/logs ${JBS_WORKDIR}/packages ${JBS_WORKDIR}/settings ${HOME}/.sbt/1.0 ${GRADLE_USER_HOME} ${HOME}/.m2
mkdir -p ${JBS_WORKDIR}/logs ${JBS_WORKDIR}/packages ${HOME}/.sbt/1.0 ${GRADLE_USER_HOME} ${HOME}/.m2
cd ${JBS_WORKDIR}/source

if [ -n "${JAVA_HOME}" ]; then
Expand All @@ -119,7 +119,6 @@ public void run() {
runBuild += getMavenSetup();

runBuild += """
cp -a ${HOME}/.m2/*.xml ${JBS_WORKDIR}/settings
fi

if [ -n "${GRADLE_HOME}" ]; then
Expand Down Expand Up @@ -191,14 +190,12 @@ private String getContainerFile() {
COPY --from=0 /var/workdir/ /var/workdir/
RUN /opt/jboss/container/java/run/run-java.sh copy-artifacts --source-path=/var/workdir/workspace/source --deploy-path=/var/workdir/workspace/artifacts
FROM scratch
COPY --from=1 /var/workdir/workspace/settings /settings/
COPY --from=1 /var/workdir/workspace/artifacts /deployment/
""".formatted(buildRequestProcessorImage);
} else {
containerFile +=
"""
FROM scratch
COPY --from=0 /var/workdir/workspace/settings /settings/
COPY --from=0 /var/workdir/workspace/artifacts /deployment/
""";
}
Expand Down Expand Up @@ -281,24 +278,7 @@ private String getMavenSetup() {
</activeProfiles>

<interactiveMode>false</interactiveMode>
<!--
Needed for Maven 3.9+. Switched to native resolver
https://maven.apache.org/guides/mini/guide-resolver-transport.html
-->
<servers>
<server>
<id>indy-mvn</id>
<configuration>
<connectionTimeout>60000</connectionTimeout>
<httpHeaders>
<property>
<name>Authorization</name>
<value>Bearer ${ACCESS_TOKEN}</value>
</property>
</httpHeaders>
</configuration>
</server>
</servers>

<proxies>
<proxy>
<id>indy-http</id>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import static org.apache.commons.lang3.ObjectUtils.isNotEmpty;

import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Optional;

Expand All @@ -25,6 +26,9 @@
@CommandLine.Option(names = "--mvn-username")
String mvnUser;

@ConfigProperty(name = "access.token")
Optional<String> accessToken;

@ConfigProperty(name = "maven.password")
Optional<String> mvnPassword;

Expand Down Expand Up @@ -55,6 +59,38 @@
}
System.setProperty("maven.settings", mvnSettings);
}
if (isNotEmpty(accessToken)) {
String servers = """

Check warning on line 63 in java-components/build-request-processor/src/main/java/com/redhat/hacbs/container/deploy/DeployCommand.java

View check run for this annotation

Codecov / codecov/patch

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

Added line #L63 was not covered by tests
<settings>
<!--
Needed for Maven 3.9+. Switched to native resolver
https://maven.apache.org/guides/mini/guide-resolver-transport.html
-->
<servers>
<server>
<id>indy-mvn</id>
<configuration>
<connectionTimeout>60000</connectionTimeout>
<httpHeaders>
<property>
<name>Authorization</name>
<value>Bearer ${ACCESS_TOKEN}</value>
</property>
</httpHeaders>
</configuration>
</server>
</servers>
</settings>
""";
if (isNotEmpty(mvnSettings)) {
// TODO: Would need to merge the two files. NYI for now as I don't think we need this pattern
throw new RuntimeException("Merging settings.xml not supported");

Check warning on line 87 in java-components/build-request-processor/src/main/java/com/redhat/hacbs/container/deploy/DeployCommand.java

View check run for this annotation

Codecov / codecov/patch

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

Added line #L87 was not covered by tests
} else {
Path settings = Path.of(deploymentPath.getParent().toString(), "settings.xml");
Files.write(settings, servers.getBytes());
System.setProperty("maven.settings", settings.toString());

Check warning on line 91 in java-components/build-request-processor/src/main/java/com/redhat/hacbs/container/deploy/DeployCommand.java

View check run for this annotation

Codecov / codecov/patch

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

Added lines #L89 - L91 were not covered by tests
}
}
if (isNotEmpty(mvnRepo)) {
// Maven Repo Deployment
MavenRepositoryDeployer deployer = new MavenRepositoryDeployer(mvnCtx, mvnUser, mvnPassword.orElse(""), mvnRepo, serverId, deploymentPath);
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/jvmbuildservice/v1alpha1/systemconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@ 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/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/redhat-appstudio/jvm-build-service/main/deploy/tasks/maven-deployment.yaml"
KonfluxMavenDeployDefinitions = "https://raw.githubusercontent.com/rnc/jvm-build-service/REVERT/deploy/tasks/maven-deployment.yaml"
)
Loading