Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] main from osrf:main #4

Open
wants to merge 63 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
510bb2f
Update to use 22.04 and test python 3.10 (#219)
tfoote Apr 11, 2023
b16136e
Add ability to preserve host user groups inside container
miguelprada Feb 28, 2023
44f7946
Adding a permissive option to user-preserve-groups incase there are g…
tfoote Apr 17, 2023
2e6466f
Also preserve groups with matching name and id in host and target
miguelprada Apr 20, 2023
4ce4e29
add error messages for group issues
tfoote May 4, 2023
514aa6f
extend use group option to also support explicitly listing groups on …
tfoote May 4, 2023
a085fb7
Cherry picking the group-add commits for group-add (#222)
tfoote May 4, 2023
b00c1c6
adding debian bookworm support
tfoote May 4, 2023
d5e9ecf
0.2.11
tfoote May 4, 2023
04cfc29
Fix default logic for user-preserve-groups (#224)
tfoote May 4, 2023
64e7c05
0.2.12
tfoote May 4, 2023
2a7e15f
Upgrading CI versions due to deprecated results (#228)
tfoote May 4, 2023
4716db7
issue #153 - Option for Hostname (#226)
BabaYaga1221 May 5, 2023
9304066
register Hostname plugin and add basic tests (#229)
tfoote May 5, 2023
0dd2dd7
Create codecov.yml (#231)
tfoote May 5, 2023
e01d9cc
Fix nvidia runtime fail on arm64 & add --group-add plugin (#211)
amadeuszsz May 8, 2023
f6d8918
unpinning urllib3 now that the fix upstream is released (#235)
tfoote May 13, 2023
2b8d5ab
fix: nvidia arg (#234)
amadeuszsz May 15, 2023
3afa6ac
Add extension ordering (#242)
agyoungs Oct 3, 2023
4401ae6
Separate out pre and post user snippets. (#243)
tfoote Oct 3, 2023
c62c4b9
Create directory structure when writing files (#244)
agyoungs Oct 6, 2023
d50f1c3
Update README.md (#247)
tfoote Oct 6, 2023
41a2269
Allow binary files to be copied into the build context (#250)
agyoungs Nov 17, 2023
41502b3
Remove old tutorial links (#254)
tfoote Nov 18, 2023
6d276a4
add simple test of CLI (#256)
tfoote Nov 24, 2023
d623245
Keep empy less than 4 (#260)
tfoote Dec 3, 2023
4de56c1
Add indirection for changes in empy 3 vs 4 (#261)
tfoote Dec 6, 2023
a06612f
unpin empy from 3.x (#262)
tfoote Dec 10, 2023
68826b8
0.2.13
tfoote Dec 10, 2023
cd919bf
Update deb platforms for release (#264)
nuclearsandwich Jan 20, 2024
998761f
Remove deprecated use of pkg_resources (#265)
tfoote Jan 26, 2024
635d7c7
0.2.14
tfoote Jan 26, 2024
80a9292
switch to use get_name() instead of .name (#267)
tfoote Feb 5, 2024
35e68c1
Add a shorthand option for switching to alternate rmws (#268)
tfoote Feb 29, 2024
39a2842
Add changelog
tfoote Mar 1, 2024
9937f50
0.2.15
tfoote Mar 1, 2024
9774799
[git extension] fix existing user_override_name key, but with None va…
muritane Mar 18, 2024
4078d22
Fix --user arg when using empy 4 (#276)
garyservin Mar 29, 2024
b47fc22
updating changelog
tfoote Apr 1, 2024
4b074a9
0.2.16
tfoote Apr 1, 2024
2edda23
[nvidia_extension] add 24.04 to supported_versions (#279)
muritane Jul 11, 2024
a9f70f9
docs: fix spelling (#282)
dijonkitchen Aug 11, 2024
034e91d
0.2.17
tfoote Aug 29, 2024
73ab0d6
Implement glvnd version option and default policy (#281)
tfoote Aug 29, 2024
18c2cc4
Feature/added ipc flag (#285)
sachinkum0009 Sep 3, 2024
b76c363
Update volume extension to use the new interface (#288)
tfoote Sep 20, 2024
3f02bdc
Remove default value for defaults (#289)
tfoote Sep 20, 2024
3c9ea15
Feature/remove default arguments warning for volume extension (#292)
blooop Oct 16, 2024
cfdc630
Feature/external repos (#293)
blooop Oct 29, 2024
cff5cb2
Add support for ulimit flag (#291)
fpadula Oct 29, 2024
2bb6b43
Update cuda snippet according to nvidia official instructions
jonazpiazu Nov 7, 2024
91c9db9
Simplify CUDA installation snippet
tfoote Nov 9, 2024
27e7fbc
update supported base OSs for Cuda
tfoote Nov 9, 2024
3449afa
fix test for new cuda installation package
tfoote Nov 9, 2024
b2aa5e1
simplify cuda tests to not need nvidia or x11
tfoote Nov 9, 2024
24dd5e1
Add clear_image to ImageGenerator to enable non-persistence and not t…
tfoote Nov 9, 2024
261fbc6
upgrade to actions/checkoutv4
tfoote Nov 9, 2024
24da57f
upgrade to setup-python@v5
tfoote Nov 9, 2024
3b21f78
Add UI feedback that image is being cleaned up, and how to avoid.
tfoote Nov 15, 2024
b150019
Mark entire CudaTest class as requiring docker
cottsay Dec 3, 2024
89af699
Mark test_docker_user_setting as requiring docker
cottsay Dec 3, 2024
37c0ba6
Isolate shm implementation from #304
tfoote Jan 10, 2025
fc46227
0.2.18
tfoote Jan 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 36 additions & 9 deletions .github/workflows/basic-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,52 @@ on: [push, pull_request]
jobs:
basic_ci:
name: Basic CI
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: [3.8]
python-version: ['3.8', 3.x]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies And Self
- name: Install Test Dependencies And Self
run: |
python -m pip install --upgrade pip setuptools wheel
# Workaround for https://github.com/docker/docker-py/issues/2807
python -m pip install six
python -m pip install -e .[test] codecov pytest-cov
- name: Run headless tests
uses: GabrielBB/xvfb-action@v1
uses: coactions/setup-xvfb@v1
with:
run: python -m pytest -s -v --cov=rocker -m "not nvidia"
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v3
cli_smoke_tests:
name: CLI smoke tests
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: [3.8, '3.x']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies And Self
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install -e .
- name: Check os_detector script
run: |
detect_docker_image_os ubuntu
- name: Check detector help
run: |
detect_docker_image_os ubuntu -h
- name: Check main runs
run: |
rocker ubuntu 'true'
- name: Check rocker help
run: |
rocker -h

324 changes: 324 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

28 changes: 16 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Whereas with `rocker` you can invoke your specific plugins and it will use multi



## Know extensions
## Known extensions

Rocker supports extensions via entry points there are some built in but you can add your own.

Expand All @@ -38,7 +38,7 @@ You can get full details on the extensions from the main `rocker --help` command
- pulse -- Mount pulse audio into the container
- ssh -- Pass through ssh access to the container.

As well as access to many of the docker arguments as well such as `device`, `env`, `volume`, `name`, `network`, and `privileged`.
As well as access to many of the docker arguments as well such as `device`, `env`, `volume`, `name`, `network`, `ipc`, and `privileged`.

### Externally maintained extensions

Expand All @@ -47,8 +47,21 @@ Here's a list of public repositories with extensions.
- Off-your-rocker: https://github.com/sloretz/off-your-rocker
- mp_rocker: https://github.com/miguelprada/mp_rocker
- ghrocker: https://github.com/tfoote/ghrocker
- novnc_rocker: https://github.com/tfoote/novnc-rocker
- template_rocker: https://github.com/blooop/template_rocker
- deps_rocker: https://github.com/blooop/deps_rocker
- pixi_rocker: https://github.com/blooop/pixi_rocker
- conda_rocker: https://github.com/blooop/conda_rocker
- palanteer_rocker: https://github.com/blooop/palanteer_rocker
- lazygit_rocker: https://github.com/blooop/lazygit_rocker


### Externally maintained rocker wrappers

Here is a list of public repositories that wrap rocker and extend its functionality. These tools are meant to be a drop in replacement of rocker so that all the existing behavior stays the same.

- rockerc: https://github.com/blooop/rockerc wraps rocker to enable putting rocker commands into a yaml config file.
- rockervsc: https://github.com/blooop/rockervsc wraps rocker so that a vscode instance attaches to the launched container.

# Prerequisites

Expand Down Expand Up @@ -153,7 +166,7 @@ Then you can run pytest.
Notes:

- Make sure to use the python3 instance of pytest from inside the environment.
- The tests include an nvidia test which assumes you're using a machine with an nvidia gpu.
- The tests include an nvidia test which assumes you're using a machine with an nvidia gpu. To skip them use `-m "not nvidia"`


# Example usage
Expand All @@ -169,15 +182,6 @@ After the ekf converges,

You can send a takeoff command and then click to command the vehicle to fly to a point on the map.


## Fly a plane

Example usage with a plane

rocker --nvidia --x11 --user --home --pull --pulse tfoote/drone_demo roslaunch sitl_launcher plane_demo.launch world_name:=worlds/plane.world gui:=false

In QGroundControl go ahead and make a mission, upload it, and then start the mission.

## ROS 2 rviz

rocker --nvidia --x11 osrf/ros:crystal-desktop rviz2
Expand Down
3 changes: 3 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
comment:
layout: "reach, diff, flags, files"
behavior: default
17 changes: 13 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@
import os
from setuptools import setup

# importlib-metadata dependency can be removed when RHEL8 and other 3.6 based systems are not in support cycles

install_requires = [
'empy',
'importlib-metadata; python_version < "3.8"',
'pexpect',
'packaging',
'urllib3',
]

# docker API used to be in a package called `docker-py` before the 2.0 release
Expand All @@ -31,35 +35,41 @@

kwargs = {
'name': 'rocker',
'version': '0.2.10',
'version': '0.2.18',
'packages': ['rocker'],
'package_dir': {'': 'src'},
'package_data': {'rocker': ['templates/*.em']},
'entry_points': {
'console_scripts': [
'rocker = rocker.cli:main',
'detect_docker_image_os = rocker.cli:detect_image_os',
],
],
'rocker.extensions': [
'cuda = rocker.nvidia_extension:Cuda',
'devices = rocker.extensions:Devices',
'dev_helpers = rocker.extensions:DevHelpers',
'env = rocker.extensions:Environment',
'expose = rocker.extensions:Expose',
'git = rocker.git_extension:Git',
'group_add = rocker.extensions:GroupAdd',
'home = rocker.extensions:HomeDir',
'hostname = rocker.extensions:Hostname',
'ipc = rocker.extensions:Ipc',
'name = rocker.extensions:Name',
'network = rocker.extensions:Network',
'nvidia = rocker.nvidia_extension:Nvidia',
'port = rocker.extensions:Port',
'privileged = rocker.extensions:Privileged',
'pulse = rocker.extensions:PulseAudio',
'rmw = rocker.rmw_extension:RMW',
'shm_size = rocker.extensions:ShmSize',
'ssh = rocker.ssh_extension:Ssh',
'ulimit = rocker.ulimit_extension:Ulimit',
'user = rocker.extensions:User',
'volume = rocker.volume_extension:Volume',
'x11 = rocker.nvidia_extension:X11',
]
},
},
'author': 'Tully Foote',
'author_email': '[email protected]',
'keywords': ['Docker'],
Expand All @@ -83,4 +93,3 @@
}

setup(**kwargs)

18 changes: 14 additions & 4 deletions src/rocker/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from .core import get_rocker_version
from .core import RockerExtensionManager
from .core import DependencyMissing
from .core import ExtensionError

from .os_detector import detect_os

Expand All @@ -34,6 +35,7 @@ def main():
parser.add_argument('--noexecute', action='store_true', help='Deprecated')
parser.add_argument('--nocache', action='store_true')
parser.add_argument('--nocleanup', action='store_true', help='do not remove the docker container when stopped')
parser.add_argument('--persist-image', action='store_true', help='do not remove the docker image when stopped', default=False) #TODO(tfoote) Add a name to it if persisting
parser.add_argument('--pull', action='store_true')
parser.add_argument('--version', action='version',
version='%(prog)s ' + get_rocker_version())
Expand All @@ -54,9 +56,11 @@ def main():
args_dict['mode'] = OPERATIONS_DRY_RUN
print('DEPRECATION Warning: --noexecute is deprecated for --mode dry-run please switch your usage by December 2020')

active_extensions = extension_manager.get_active_extensions(args_dict)
# Force user to end if present otherwise it will break other extensions
active_extensions.sort(key=lambda e:e.get_name().startswith('user'))
try:
active_extensions = extension_manager.get_active_extensions(args_dict)
except ExtensionError as e:
print(f"ERROR! {str(e)}")
return 1
print("Active extensions %s" % [e.get_name() for e in active_extensions])

base_image = args.image
Expand All @@ -65,10 +69,16 @@ def main():
exit_code = dig.build(**vars(args))
if exit_code != 0:
print("Build failed exiting")
if not args_dict['persist_image']:
dig.clear_image()
return exit_code
# Convert command into string
args.command = ' '.join(args.command)
return dig.run(**args_dict)
result = dig.run(**args_dict)
if not args_dict['persist_image']:
print(f'Clearing Image: {dig.image_id}s\nTo not clean up use --persist-images')
dig.clear_image()
return result


def detect_image_os():
Expand Down
Loading