diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index f02258cd5d..81d7112151 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,12 +1,18 @@ { "name": "Nav2", - "image": "ghcr.io/ros-planning/navigation2:main-dev", + "image": "ghcr.io/ros-planning/navigation2:main", "runArgs": [ "--privileged", "--network=host" ], "workspaceMount": "source=${localWorkspaceFolder},target=/opt/overlay_ws/src/navigation2,type=bind", "workspaceFolder": "/opt/overlay_ws/src", + "onCreateCommand": "navigation2/.devcontainer/on-create-command.sh", + "updateContentCommand": "navigation2/.devcontainer/update-content-command.sh", + "remoteEnv": { + "OVERLAY_MIXINS": "release ccache lld", + "CCACHE_DIR": "${containerEnv:OVERLAY_WS}/.ccache" + }, "features": { // "ghcr.io/devcontainers/features/desktop-lite:1": {}, "ghcr.io/devcontainers/features/github-cli:1": {} diff --git a/.devcontainer/on-create-command.sh b/.devcontainer/on-create-command.sh new file mode 100755 index 0000000000..b630db77f6 --- /dev/null +++ b/.devcontainer/on-create-command.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +set -exo pipefail + +env + +cd $OVERLAY_WS +. $UNDERLAY_WS/install/setup.sh + +git config --global --add safe.directory "*" +colcon cache lock + +colcon build \ + --symlink-install \ + --mixin $OVERLAY_MIXINS + +sed --in-place \ + 's|^source .*|source "$OVERLAY_WS/install/setup.bash"|' \ + /ros_entrypoint.sh diff --git a/.devcontainer/update-content-command.sh b/.devcontainer/update-content-command.sh new file mode 100755 index 0000000000..7954e0dbc5 --- /dev/null +++ b/.devcontainer/update-content-command.sh @@ -0,0 +1,57 @@ +#!/bin/bash + +set -exo pipefail + +env + +cd $OVERLAY_WS + +colcon cache lock + +BUILD_UNFINISHED=$( + colcon list \ + --names-only \ + --packages-skip-build-finished \ + | xargs) +echo BUILD_UNFINISHED: $BUILD_UNFINISHED + +BUILD_FAILED=$( + colcon list \ + --names-only \ + --packages-select-build-failed \ + | xargs) +echo BUILD_FAILED: $BUILD_FAILED + +BUILD_INVALID=$( + colcon list \ + --names-only \ + --packages-select-cache-invalid \ + --packages-select-cache-key build \ + | xargs) +echo BUILD_INVALID: $BUILD_INVALID + +BUILD_PACKAGES="" +if [ -n "$BUILD_UNFINISHED" ] || \ + [ -n "$BUILD_FAILED" ] || \ + [ -n "$BUILD_INVALID" ] +then + BUILD_PACKAGES=$( + colcon list \ + --names-only \ + --packages-above \ + $BUILD_UNFINISHED \ + $BUILD_FAILED \ + $BUILD_INVALID \ + | xargs) +fi +echo BUILD_PACKAGES: $BUILD_PACKAGES + +colcon clean packages --yes \ + --packages-select ${BUILD_PACKAGES} \ + --base-select install + +. $UNDERLAY_WS/install/setup.sh +colcon build \ + --symlink-install \ + --mixin $OVERLAY_MIXINS \ + --packages-select ${BUILD_PACKAGES} diff --git a/.github/workflows/update_ci_image.yaml b/.github/workflows/update_ci_image.yaml index 2879224fae..33bb8fd386 100644 --- a/.github/workflows/update_ci_image.yaml +++ b/.github/workflows/update_ci_image.yaml @@ -109,23 +109,3 @@ jobs: - name: Image digest if: steps.config.outputs.trigger == 'true' run: echo ${{ steps.docker_build.outputs.digest }} - - name: Build and push ${{ github.ref_name }}-dev - if: steps.config.outputs.trigger == 'true' - id: docker_build_dev - uses: docker/build-push-action@v4 - with: - pull: true - push: true - cache-from: | - type=registry,ref=ghcr.io/ros-planning/navigation2:${{ github.ref_name }} - type=registry,ref=ghcr.io/ros-planning/navigation2:${{ github.ref_name }}-dev - cache-to: type=inline - build-args: | - RUN_TESTS=True - target: tester - tags: | - ghcr.io/ros-planning/navigation2:${{ github.ref_name }}-dev - ghcr.io/ros-planning/navigation2:${{ github.ref_name }}-dev-${{ steps.config.outputs.timestamp }} - - name: Image digest - if: steps.config.outputs.trigger == 'true' - run: echo ${{ steps.docker_build.outputs.digest }}