diff --git a/.rhcicd/sonarqube/Dockerfile b/.rhcicd/sonarqube/Dockerfile index 8371ada26a..108d87b642 100644 --- a/.rhcicd/sonarqube/Dockerfile +++ b/.rhcicd/sonarqube/Dockerfile @@ -4,8 +4,6 @@ FROM registry.access.redhat.com/ubi9/openjdk-21 # Switch to the root user to be able to install the required packages. USER root -# This argument holds the new password for the "cacerts" keystore. -ARG cacerts_keystore_password # The argument that holds Red Hat IT's custom certificate's location. ARG rh_it_root_ca_cert_url ARG rh_it_root_ca_cert_secondary_url @@ -17,43 +15,11 @@ RUN dnf --disablerepo=* -y install https://download.postgresql.org/pub/repos/yum RUN dnf install -y postgresql15-server RUN dnf install -y postgresql15-contrib - -# 1. Install the UUID package which is required for the scripts. -# 2. Change the default "cacert" keystore's password to a custom one for more -# security. -# 3. Import Red Hat IT's custom self signed certificate in the general -# "cacerts" file. -# 4. Remove the certificate file. -RUN mkdir --parents "/var/cache/yum/metadata" \ - && microdnf install --assumeyes uuid-1.6.2-55.el9.x86_64 \ - && microdnf clean all \ - && readonly rh_it_root_ca_file="$(mktemp)" \ - && readonly rh_it_root_ca_secondary_file="$(mktemp)" \ - && curl --output "${rh_it_root_ca_file}" --insecure "${rh_it_root_ca_cert_url}" \ - && curl --output "${rh_it_root_ca_secondary_file}" --insecure "${rh_it_root_ca_cert_secondary_url}" \ - && keytool \ - -cacerts \ - -new "${cacerts_keystore_password}" \ - -storepasswd \ - -storepass "changeit" \ - && keytool \ - -alias "RH-IT-Root-CA" \ - -cacerts \ - -file "${rh_it_root_ca_file}" \ - -importcert \ - -noprompt \ - -storepass "${cacerts_keystore_password}" \ - -trustcacerts \ - && keytool \ - -alias "RH-IT-Root-CA-SECONDARY" \ - -cacerts \ - -file "${rh_it_root_ca_secondary_file}" \ - -importcert \ - -noprompt \ - -storepass "${cacerts_keystore_password}" \ - -trustcacerts \ - && rm "${rh_it_root_ca_file}" \ - && rm "${rh_it_root_ca_secondary_file}" +# Add RedHat CAs on OS truststore (check https://certs.corp.redhat.com/ for more details) +RUN curl --output rh_it_root_ca_file.crt --insecure "${rh_it_root_ca_cert_url}" \ + && curl --output rh_it_root_ca_secondary_file.crt --insecure "${rh_it_root_ca_cert_secondary_url}" \ + && mv rh*.crt /etc/pki/ca-trust/source/anchors \ + && update-ca-trust # Copy the repository contents. COPY --chown=default:default . /home/default diff --git a/.rhcicd/sonarqube/sonarqube.bash b/.rhcicd/sonarqube/sonarqube.bash index 405b1a6669..535a9d91a3 100755 --- a/.rhcicd/sonarqube/sonarqube.bash +++ b/.rhcicd/sonarqube/sonarqube.bash @@ -18,7 +18,6 @@ readonly COMMIT_SHORT=$(git rev-parse --short=7 HEAD) # Build the Docker image. # docker build \ - --build-arg cacerts_keystore_password="${CACERTS_KEYSTORE_PASSWORD}" \ --build-arg rh_it_root_ca_cert_url="${RH_IT_ROOT_CA_CERT_URL}" \ --build-arg rh_it_root_ca_cert_secondary_url="${RH_IT_ROOT_CA_CERT_SECONDARY_URL}" \ --file .rhcicd/sonarqube/Dockerfile \ diff --git a/pom.xml b/pom.xml index 8aa720222b..c29a62e7c2 100644 --- a/pom.xml +++ b/pom.xml @@ -83,7 +83,7 @@ 3.15.1 1.4.11 - 4.0.0.4121 + 5.0.0.4389 ${project.build.directory}/jacoco-report target/jacoco-report/jacoco.xml