From 7466774d1109006eed46bffce55cc836a592685c Mon Sep 17 00:00:00 2001 From: sokhealy Date: Fri, 19 Jul 2024 16:39:08 -0700 Subject: [PATCH 1/3] update java for sonar-scanner --- Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 97f61c5..8cecda6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,7 +18,9 @@ RUN apt-get update && apt-get install --yes \ check \ clang-format-13 \ libserialport-dev \ - ros-humble-gps-msgs + ros-humble-gps-msgs \ + # Sonar-scanner dependency + openjdk-19-jdk # Add a "dockerdev" user with sudo capabilities # 1000 is the first user ID issued on Ubuntu; might From 21da040b90370d3906d657365e0a710f962c336e Mon Sep 17 00:00:00 2001 From: sokhealy Date: Fri, 19 Jul 2024 17:05:44 -0700 Subject: [PATCH 2/3] update java home and path --- code_coverage.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/code_coverage.sh b/code_coverage.sh index 0fd45e3..6a5209b 100755 --- a/code_coverage.sh +++ b/code_coverage.sh @@ -11,6 +11,8 @@ export GITHUB_TOKEN=$1 export SONAR_TOKEN=$2 +export JAVA_HOME=/usr/lib/jvm/java-19-openjdk-amd64 +export PATH=$JAVA_HOME/bin:$PATH mkdir -p build cd build From 84348ea8173eeccd5c0a1da9bf6048a2103e234a Mon Sep 17 00:00:00 2001 From: sokhealy Date: Mon, 22 Jul 2024 13:15:47 -0700 Subject: [PATCH 3/3] update sonoar scanner version --- .github/workflows/build.yml | 2 +- Dockerfile | 24 +++++++++++++++--------- code_coverage.sh | 2 -- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c07a921..0374be0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,7 +6,7 @@ on: pull_request: types: [opened, synchronize, reopened] env: - SONAR_SCANNER_VERSION: 4.7.0.2747 + SONAR_SCANNER_VERSION: 6.1.0.4477 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} PARALLEL_THREADS: 2 diff --git a/Dockerfile b/Dockerfile index 8cecda6..5df4922 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM osrf/ros:humble-desktop -ARG SONAR_SCANNER_VERSION=4.7.0.2747 +ARG SONAR_SCANNER_VERSION=6.1.0.4477 ARG DEBIAN_FRONTEND=noninteractive @@ -11,6 +11,7 @@ ENV HOME /home/dockerdev ARG UID=1000 RUN apt-get update && apt-get install --yes \ + apt-utils \ build-essential \ pkg-config \ cmake \ @@ -18,16 +19,21 @@ RUN apt-get update && apt-get install --yes \ check \ clang-format-13 \ libserialport-dev \ - ros-humble-gps-msgs \ - # Sonar-scanner dependency - openjdk-19-jdk + ros-humble-gps-msgs # Add a "dockerdev" user with sudo capabilities # 1000 is the first user ID issued on Ubuntu; might # be different for Mac users. Might need to add more. -RUN useradd -u ${UID} -ms /bin/bash -G sudo dockerdev && \ - echo '%sudo ALL=(ALL) NOPASSWD:ALL' >>/etc/sudoers && \ - chown -R dockerdev:dockerdev $HOME/ +# Create the user with the specified UID +RUN useradd -u $UID -m dockerdev && \ + # Set the user's shell to /bin/bash + chsh -s /bin/bash dockerdev && \ + # Add the user to the sudo group + usermod -aG sudo dockerdev && \ + # Add the user to sudoers with no password prompt for sudo commands + echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers && \ + # Change ownership of the home directory to the new user + chown -R dockerdev:dockerdev $HOME USER dockerdev @@ -46,10 +52,10 @@ RUN sudo apt-get -y install gcovr # Download and set up sonar-scanner RUN sudo apt-get -y install unzip && \ mkdir -p $HOME/.sonar && \ - curl -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${SONAR_SCANNER_VERSION}-linux.zip && \ + curl -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${SONAR_SCANNER_VERSION}-linux-x64.zip && \ unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/ -ENV PATH="${PATH}:/home/dockerdev/.sonar/sonar-scanner-${SONAR_SCANNER_VERSION}-linux/bin" +ENV PATH="${PATH}:/home/dockerdev/.sonar/sonar-scanner-${SONAR_SCANNER_VERSION}-linux-x64/bin" WORKDIR /mnt/workspace/src/swiftnav-ros2 diff --git a/code_coverage.sh b/code_coverage.sh index 6a5209b..0fd45e3 100755 --- a/code_coverage.sh +++ b/code_coverage.sh @@ -11,8 +11,6 @@ export GITHUB_TOKEN=$1 export SONAR_TOKEN=$2 -export JAVA_HOME=/usr/lib/jvm/java-19-openjdk-amd64 -export PATH=$JAVA_HOME/bin:$PATH mkdir -p build cd build