From 14bc9315ec8ca924e2a00b9c84ed1e5901906bf2 Mon Sep 17 00:00:00 2001 From: Yutaka Kondo Date: Thu, 23 May 2024 13:27:50 +0900 Subject: [PATCH] feat(ci,docker): change `vcs import` to `COPY src` (#4738) * introduce src-imported stage Signed-off-by: Yutaka Kondo * empty Signed-off-by: Yutaka Kondo * generate install package lists * append || true Signed-off-by: Yutaka Kondo * cat packages Signed-off-by: Yutaka Kondo * chore(docker): separate `rosdep install` and `colcon build` RUN commands (#4719) * wip Signed-off-by: Yutaka Kondo * wip Signed-off-by: Yutaka Kondo * Update Dockerfile * Update Dockerfile * install pacmod * rename * Revert "install pacmod" This reverts commit ebff10f4747489da490fa54497c2722fdec91def. * install pacmod3 * register pamod3 repos * ignore hadolint * revert * run set-dev-env.sh * pip install * copy * rosdep update * vcs import outside dockerfile Signed-off-by: Yutaka Kondo * refine order and remove /autoware/src at last * fix hadolint * remove tar files Signed-off-by: Yutaka Kondo * shell: bash Signed-off-by: Yutaka Kondo --------- Signed-off-by: Yutaka Kondo --- .../actions/docker-build-and-push/action.yaml | 18 ++++++++++++++++++ ...docker-build-and-push-main-self-hosted.yaml | 16 ++++++++++++++++ .../workflows/docker-build-and-push-main.yaml | 16 ++++++++++++++++ docker/autoware-openadk/Dockerfile | 10 +++------- 4 files changed, 53 insertions(+), 7 deletions(-) diff --git a/.github/actions/docker-build-and-push/action.yaml b/.github/actions/docker-build-and-push/action.yaml index 13526e9083e..53a95eb8fe7 100644 --- a/.github/actions/docker-build-and-push/action.yaml +++ b/.github/actions/docker-build-and-push/action.yaml @@ -151,6 +151,12 @@ runs: overwrite: true if-no-files-found: error + - name: Remove tar file - prebuilt + if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.artifacts-destination == 'tarball' }} + run: | + rm /tmp/prebuilt.tar + shell: bash + - name: Upload Artifact - devel if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.artifacts-destination == 'tarball' }} id: artifact-upload-step-devel @@ -163,6 +169,12 @@ runs: overwrite: true if-no-files-found: error + - name: Remove tar file - devel + if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.artifacts-destination == 'tarball' }} + run: | + rm /tmp/devel.tar + shell: bash + - name: Upload Artifact - runtime if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.artifacts-destination == 'tarball' }} id: artifact-upload-step-runtime @@ -175,6 +187,12 @@ runs: overwrite: true if-no-files-found: error + - name: Remove tar file - runtime + if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.artifacts-destination == 'tarball' }} + run: | + rm /tmp/runtime.tar + shell: bash + - name: Output artifact URLs id: output-artifact-urls run: | diff --git a/.github/workflows/docker-build-and-push-main-self-hosted.yaml b/.github/workflows/docker-build-and-push-main-self-hosted.yaml index 69a553a6cb0..98b194f5d76 100644 --- a/.github/workflows/docker-build-and-push-main-self-hosted.yaml +++ b/.github/workflows/docker-build-and-push-main-self-hosted.yaml @@ -56,9 +56,25 @@ jobs: - name: Check out repository uses: actions/checkout@v4 + - name: Install vcstool + run: | + sudo apt-get -y update + sudo apt-get -y install python3-pip + pip install --no-cache-dir vcstool + + - name: Set git config + uses: autowarefoundation/autoware-github-actions/set-git-config@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + - name: Free disk space uses: ./.github/actions/free-disk-space + - name: Run vcs import + run: | + mkdir src + vcs import src < autoware.repos + - name: Build 'autoware-openadk' uses: ./.github/actions/docker-build-and-push with: diff --git a/.github/workflows/docker-build-and-push-main.yaml b/.github/workflows/docker-build-and-push-main.yaml index bea0df4a950..729f7e9297a 100644 --- a/.github/workflows/docker-build-and-push-main.yaml +++ b/.github/workflows/docker-build-and-push-main.yaml @@ -51,9 +51,25 @@ jobs: - name: Check out repository uses: actions/checkout@v4 + - name: Install vcstool + run: | + sudo apt-get -y update + sudo apt-get -y install python3-pip + pip install --no-cache-dir vcstool + + - name: Set git config + uses: autowarefoundation/autoware-github-actions/set-git-config@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + - name: Free disk space uses: ./.github/actions/free-disk-space + - name: Run vcs import + run: | + mkdir src + vcs import src < autoware.repos + - name: Build 'autoware-openadk' uses: ./.github/actions/docker-build-and-push with: diff --git a/docker/autoware-openadk/Dockerfile b/docker/autoware-openadk/Dockerfile index 07dc6046494..c7362e17069 100644 --- a/docker/autoware-openadk/Dockerfile +++ b/docker/autoware-openadk/Dockerfile @@ -40,14 +40,10 @@ WORKDIR /autoware RUN --mount=type=ssh \ ./setup-dev-env.sh -y rosdep \ && pip uninstall -y ansible ansible-core \ - && pip install --no-cache-dir vcstool \ && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* "$HOME"/.cache -WORKDIR /autoware -COPY autoware.repos /autoware/ -RUN --mount=type=ssh \ - mkdir src \ - && vcs import src < autoware.repos +# Copy repository files +COPY src /autoware/src # Generate install package lists RUN rosdep update && rosdep keys --ignore-src --from-paths src \ @@ -83,7 +79,6 @@ RUN --mount=type=ssh \ && find / -name 'libnv*.a' -delete # Install rosdep dependencies -COPY --from=src-imported /autoware/src /autoware/src COPY --from=src-imported /rosdep-all-depend-packages.txt /tmp/rosdep-all-depend-packages.txt # hadolint ignore=SC2002 RUN --mount=type=ssh \ @@ -92,6 +87,7 @@ RUN --mount=type=ssh \ && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* "$HOME"/.cache # Build Autoware +COPY --from=src-imported /autoware/src /autoware/src RUN source /opt/ros/"$ROS_DISTRO"/setup.bash \ && colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release --cmake-args \ " -Wno-dev" \