Skip to content

Commit f893ed4

Browse files
committed
Add the default ca-bundle and import it into java truststore
1 parent f919901 commit f893ed4

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

java-components/build-request-processor/src/main/java/com/redhat/hacbs/container/build/preprocessor/AbstractPreprocessor.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,15 @@ public void run() {
113113
PATH="${JAVA_HOME}/bin:$PATH"
114114
fi
115115
116+
# Go through certificates and insert them into the cacerts
117+
for cert in /etc/pki/ca-trust/source/anchors/*; do
118+
echo "inserting $cert into java cacerts"
119+
keytool -import -alias $(basename $cert)-ca \
120+
-file $cert \
121+
-keystore /etc/pki/java/cacerts \
122+
-storepass changeit --noprompt
123+
done;
124+
116125
if [ -n "${MAVEN_HOME}" ]; then
117126
""".formatted(javaHome, type.name(), type.name(), type, buildToolVersion);
118127

@@ -177,6 +186,8 @@ private String getContainerFile() {
177186
ENV PROXY_URL=$PROXY_URL
178187
COPY .jbs/run-build.sh /var/workdir
179188
COPY . /var/workdir/workspace/source/
189+
COPY /mnt/trusted-ca/ca-bundle.crt /etc/pki/ca-trust/source/anchors
190+
RUN update-ca-trust
180191
RUN /var/workdir/run-build.sh
181192
""".formatted(recipeImage);
182193

0 commit comments

Comments
 (0)