From 59a4a9598bf2b4a87c8eaff3ef9b1de24fa7f1ce Mon Sep 17 00:00:00 2001 From: oguzkaganozt Date: Fri, 22 Mar 2024 17:04:06 +0300 Subject: [PATCH] fix: ccache permissions (#4556) * fix ccache permissions Signed-off-by: oguzkaganozt * Link CC and CXX to ccache Signed-off-by: oguzkaganozt * style(pre-commit): autofix --------- Signed-off-by: oguzkaganozt Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .github/workflows/build-main-self-hosted.yaml | 4 ++++ .github/workflows/build-main.yaml | 4 ++++ ansible/roles/build_tools/tasks/main.yaml | 24 +++++++++++++++++++ docker/autoware-openadk/Dockerfile | 7 +----- 4 files changed, 33 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-main-self-hosted.yaml b/.github/workflows/build-main-self-hosted.yaml index e4cc44884e3..cc6396e01ea 100644 --- a/.github/workflows/build-main-self-hosted.yaml +++ b/.github/workflows/build-main-self-hosted.yaml @@ -67,3 +67,7 @@ jobs: - name: Show disk space run: | df -h + + - name: Show ccache stats + run: | + ccache -s diff --git a/.github/workflows/build-main.yaml b/.github/workflows/build-main.yaml index 7b21980574a..38250e160b4 100644 --- a/.github/workflows/build-main.yaml +++ b/.github/workflows/build-main.yaml @@ -62,3 +62,7 @@ jobs: - name: Show disk space run: | df -h + + - name: Show ccache stats + run: | + ccache -s diff --git a/ansible/roles/build_tools/tasks/main.yaml b/ansible/roles/build_tools/tasks/main.yaml index e83056a6428..91f8718a039 100644 --- a/ansible/roles/build_tools/tasks/main.yaml +++ b/ansible/roles/build_tools/tasks/main.yaml @@ -4,3 +4,27 @@ name: ccache state: latest update_cache: true + +- name: Add CCACHE_DIR to .bashrc + ansible.builtin.lineinfile: + dest: ~/.bashrc + line: export CCACHE_DIR="/ccache" + state: present + create: true + mode: 0644 + +- name: Export CC to ccache + ansible.builtin.lineinfile: + dest: ~/.bashrc + line: export CC="/usr/lib/ccache/gcc" + state: present + create: true + mode: 0644 + +- name: Export CXX to ccache + ansible.builtin.lineinfile: + dest: ~/.bashrc + line: export CXX="/usr/lib/ccache/g++" + state: present + create: true + mode: 0644 diff --git a/docker/autoware-openadk/Dockerfile b/docker/autoware-openadk/Dockerfile index bd41668d6f5..7b8919b20b9 100644 --- a/docker/autoware-openadk/Dockerfile +++ b/docker/autoware-openadk/Dockerfile @@ -45,9 +45,6 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO ARG SETUP_ARGS ARG ROS_DISTRO -ENV CCACHE_DIR=/ccache -ENV CC="/usr/lib/ccache/gcc" -ENV CXX="/usr/lib/ccache/g++" # Set up development environment RUN --mount=type=ssh \ @@ -74,6 +71,7 @@ RUN --mount=type=ssh \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ && find /autoware/install -type d -exec chmod 777 {} \; \ + && chmod -R 777 /ccache \ && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* "$HOME"/.cache \ && rm -rf /autoware/build /autoware/src @@ -88,9 +86,6 @@ RUN --mount=type=ssh \ && pip uninstall -y ansible ansible-core \ && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* "$HOME"/.cache -# Change working directory to workspace -WORKDIR /workspace - # Create entrypoint COPY docker/autoware-openadk/etc/ros_entrypoint.sh /ros_entrypoint.sh RUN chmod +x /ros_entrypoint.sh