From fde1c7770ca10110f4d28a762c8bd299f3c0c7c5 Mon Sep 17 00:00:00 2001 From: Michael Clarke Date: Sat, 7 Sep 2024 09:45:36 +0100 Subject: [PATCH] #958: Remove group assignment during container build The sonarqube images no longer create a sonarqube group for the sonarqube user to be placed into, instead they put the sonarqube user in the root group. To prevent the plugin builds failing when attempting to set the plugin ownership to a group that doesn't exist, the `chown` command is being altered to only set the user ownership, not the associated group. --- Dockerfile | 4 ++-- release.Dockerfile | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 78ea6bef1..6e0c84b6c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,13 @@ ARG SONARQUBE_VERSION -FROM gradle:8.9-jdk17-jammy as builder +FROM gradle:8.9-jdk17-jammy AS builder COPY . /home/build/project WORKDIR /home/build/project RUN gradle build -x test FROM sonarqube:${SONARQUBE_VERSION} -COPY --from=builder --chown=sonarqube:sonarqube /home/build/project/build/libs/sonarqube-community-branch-plugin-*.jar /opt/sonarqube/extensions/plugins/ +COPY --from=builder --chown=sonarqube /home/build/project/build/libs/sonarqube-community-branch-plugin-*.jar /opt/sonarqube/extensions/plugins/ ARG PLUGIN_VERSION ENV PLUGIN_VERSION=${PLUGIN_VERSION} diff --git a/release.Dockerfile b/release.Dockerfile index b82d214c3..706aaeb2f 100644 --- a/release.Dockerfile +++ b/release.Dockerfile @@ -5,7 +5,7 @@ FROM sonarqube:${SONARQUBE_VERSION} ARG PLUGIN_VERSION ENV PLUGIN_VERSION=${PLUGIN_VERSION} -ADD --chown=sonarqube:sonarqube https://github.com/mc1arke/sonarqube-community-branch-plugin/releases/download/${PLUGIN_VERSION}/sonarqube-community-branch-plugin-${PLUGIN_VERSION}.jar /opt/sonarqube/extensions/plugins/ +ADD --chown=sonarqube https://github.com/mc1arke/sonarqube-community-branch-plugin/releases/download/${PLUGIN_VERSION}/sonarqube-community-branch-plugin-${PLUGIN_VERSION}.jar /opt/sonarqube/extensions/plugins/ ENV SONAR_WEB_JAVAADDITIONALOPTS="-javaagent:./extensions/plugins/sonarqube-community-branch-plugin-${PLUGIN_VERSION}.jar=web" ENV SONAR_CE_JAVAADDITIONALOPTS="-javaagent:./extensions/plugins/sonarqube-community-branch-plugin-${PLUGIN_VERSION}.jar=ce"