Skip to content

Commit

Permalink
Support for Dev Containers and Codespaces (#3457)
Browse files Browse the repository at this point in the history
* Alias image tag over current branch name

* Duplicate build and push steps for dev tag

* Alias image tag over current branch name

* Modify build and push steps for dev tag

* Build and push dev tag first
to not cache from stale stages
as otherwise caching from multple regestry images seems error prone

* Revert "Build and push dev tag first"
as otherwise the build failer durring the dev tag
could then still block build of the main tag

This reverts commit 12dd5b1.

* Cache from multple reference images
while giving layers from the main tag priority
this assumes that cache-from prioritizes firstly listed references

https://github.com/moby/buildkit/blob/0ad8d61575be009ce6478edf1d85716849c8ff1a/solver/llbsolver/bridge.go#L92

* Cache tests in dev image as well
colcon cache can then skip tests for uneffected packages

* Add devcontainer.json

* Ignore doc for image builds

* Add more extensions

* Change workspaceFolder to root src path
to avoid auto generating .vscode folder in repo
created by ms-iot.vscode-ros extension
upon configuring ros packages with c_cpp_properties.json

* Enable features
for github-cli

* Add docs about codespaces
and have it opened when starting codespaces
  • Loading branch information
ruffsl authored Mar 10, 2023
1 parent 0a63bf9 commit 74d90f3
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 8 deletions.
32 changes: 32 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "Nav2",
"image": "ghcr.io/ros-planning/navigation2:main-dev",
"runArgs": [
"--privileged",
"--network=host"
],
"workspaceMount": "source=${localWorkspaceFolder},target=/opt/overlay_ws/src/navigation2,type=bind",
"workspaceFolder": "/opt/overlay_ws/src",
"features": {
// "ghcr.io/devcontainers/features/desktop-lite:1": {},
"ghcr.io/devcontainers/features/github-cli:1": {}
},
"customizations": {
"codespaces": {
"openFiles": [
"doc/development/codespaces.md"
]
},
"vscode": {
"settings": {},
"extensions": [
"eamodio.gitlens",
"esbenp.prettier-vscode",
"GitHub.copilot",
"ms-iot.vscode-ros",
"streetsidesoftware.code-spell-checker",
"twxs.cmake"
]
}
}
}
7 changes: 4 additions & 3 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
# Repo

.circleci/
.github/
.devcontainer/
.dockerignore
.git/
.github/
.dockerignore
.gitignore
**Dockerfile
**.Dockerfile
**Dockerfile
doc/
31 changes: 26 additions & 5 deletions .github/workflows/update_ci_image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
trigger: ${{ steps.check.outputs.trigger }}
no_cache: ${{ steps.check.outputs.no_cache }}
container:
image: ghcr.io/ros-planning/navigation2:main
image: ghcr.io/ros-planning/navigation2:${{ github.ref_name }}
steps:
- name: "Check apt updates"
id: check
Expand Down Expand Up @@ -91,20 +91,41 @@ jobs:
trigger=true
fi
echo "::set-output name=trigger::${trigger}"
- name: Build and push
- name: Build and push ${{ github.ref_name }}
if: steps.config.outputs.trigger == 'true'
id: docker_build
uses: docker/build-push-action@v4
with:
pull: true
push: true
no-cache: ${{ steps.config.outputs.no_cache }}
cache-from: type=registry,ref=ghcr.io/ros-planning/navigation2:main
cache-from: type=registry,ref=ghcr.io/ros-planning/navigation2:${{ github.ref_name }}
cache-to: type=inline
target: builder
tags: |
ghcr.io/ros-planning/navigation2:main
ghcr.io/ros-planning/navigation2:main-${{ steps.config.outputs.timestamp }}
ghcr.io/ros-planning/navigation2:${{ github.ref_name }}
ghcr.io/ros-planning/navigation2:${{ github.ref_name }}-${{ steps.config.outputs.timestamp }}
- 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
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
FAIL_ON_TEST_FAILURE=''
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 }}
23 changes: 23 additions & 0 deletions doc/development/codespaces.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Codespaces

TODO: welcome and introduction

# Overview

TODO: document devcontainer
TODO: reference extensions
TODO: use of dockercompose and services

# Terminal

TODO: link to vscode terminal

# Graphics and Simulations

TODO: vnc options
TODO: foxglove example
TODO: gazebo example with gzweb

# References

TODO: links to more info

0 comments on commit 74d90f3

Please sign in to comment.