Skip to content

Commit 74d90f3

Browse files
authored
Support for Dev Containers and Codespaces (ros-navigation#3457)
* 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
1 parent 0a63bf9 commit 74d90f3

File tree

4 files changed

+85
-8
lines changed

4 files changed

+85
-8
lines changed

.devcontainer/devcontainer.json

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"name": "Nav2",
3+
"image": "ghcr.io/ros-planning/navigation2:main-dev",
4+
"runArgs": [
5+
"--privileged",
6+
"--network=host"
7+
],
8+
"workspaceMount": "source=${localWorkspaceFolder},target=/opt/overlay_ws/src/navigation2,type=bind",
9+
"workspaceFolder": "/opt/overlay_ws/src",
10+
"features": {
11+
// "ghcr.io/devcontainers/features/desktop-lite:1": {},
12+
"ghcr.io/devcontainers/features/github-cli:1": {}
13+
},
14+
"customizations": {
15+
"codespaces": {
16+
"openFiles": [
17+
"doc/development/codespaces.md"
18+
]
19+
},
20+
"vscode": {
21+
"settings": {},
22+
"extensions": [
23+
"eamodio.gitlens",
24+
"esbenp.prettier-vscode",
25+
"GitHub.copilot",
26+
"ms-iot.vscode-ros",
27+
"streetsidesoftware.code-spell-checker",
28+
"twxs.cmake"
29+
]
30+
}
31+
}
32+
}

.dockerignore

+4-3
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
# Repo
33

44
.circleci/
5-
.github/
5+
.devcontainer/
6+
.dockerignore
67
.git/
78
.github/
8-
.dockerignore
99
.gitignore
10-
**Dockerfile
1110
**.Dockerfile
11+
**Dockerfile
12+
doc/

.github/workflows/update_ci_image.yaml

+26-5
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
trigger: ${{ steps.check.outputs.trigger }}
3737
no_cache: ${{ steps.check.outputs.no_cache }}
3838
container:
39-
image: ghcr.io/ros-planning/navigation2:main
39+
image: ghcr.io/ros-planning/navigation2:${{ github.ref_name }}
4040
steps:
4141
- name: "Check apt updates"
4242
id: check
@@ -91,20 +91,41 @@ jobs:
9191
trigger=true
9292
fi
9393
echo "::set-output name=trigger::${trigger}"
94-
- name: Build and push
94+
- name: Build and push ${{ github.ref_name }}
9595
if: steps.config.outputs.trigger == 'true'
9696
id: docker_build
9797
uses: docker/build-push-action@v4
9898
with:
9999
pull: true
100100
push: true
101101
no-cache: ${{ steps.config.outputs.no_cache }}
102-
cache-from: type=registry,ref=ghcr.io/ros-planning/navigation2:main
102+
cache-from: type=registry,ref=ghcr.io/ros-planning/navigation2:${{ github.ref_name }}
103103
cache-to: type=inline
104104
target: builder
105105
tags: |
106-
ghcr.io/ros-planning/navigation2:main
107-
ghcr.io/ros-planning/navigation2:main-${{ steps.config.outputs.timestamp }}
106+
ghcr.io/ros-planning/navigation2:${{ github.ref_name }}
107+
ghcr.io/ros-planning/navigation2:${{ github.ref_name }}-${{ steps.config.outputs.timestamp }}
108+
- name: Image digest
109+
if: steps.config.outputs.trigger == 'true'
110+
run: echo ${{ steps.docker_build.outputs.digest }}
111+
- name: Build and push ${{ github.ref_name }}-dev
112+
if: steps.config.outputs.trigger == 'true'
113+
id: docker_build
114+
uses: docker/build-push-action@v4
115+
with:
116+
pull: true
117+
push: true
118+
cache-from: |
119+
type=registry,ref=ghcr.io/ros-planning/navigation2:${{ github.ref_name }}
120+
type=registry,ref=ghcr.io/ros-planning/navigation2:${{ github.ref_name }}-dev
121+
cache-to: type=inline
122+
build-args: |
123+
RUN_TESTS=True
124+
FAIL_ON_TEST_FAILURE=''
125+
target: tester
126+
tags: |
127+
ghcr.io/ros-planning/navigation2:${{ github.ref_name }}-dev
128+
ghcr.io/ros-planning/navigation2:${{ github.ref_name }}-dev-${{ steps.config.outputs.timestamp }}
108129
- name: Image digest
109130
if: steps.config.outputs.trigger == 'true'
110131
run: echo ${{ steps.docker_build.outputs.digest }}

doc/development/codespaces.md

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Codespaces
2+
3+
TODO: welcome and introduction
4+
5+
# Overview
6+
7+
TODO: document devcontainer
8+
TODO: reference extensions
9+
TODO: use of dockercompose and services
10+
11+
# Terminal
12+
13+
TODO: link to vscode terminal
14+
15+
# Graphics and Simulations
16+
17+
TODO: vnc options
18+
TODO: foxglove example
19+
TODO: gazebo example with gzweb
20+
21+
# References
22+
23+
TODO: links to more info

0 commit comments

Comments
 (0)