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

Deploy tool improvements #223

Merged
merged 15 commits into from
Feb 7, 2024
Merged
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
run: git config --global --add safe.directory /__w/bitbots_main/bitbots_main

- name: Pull source code for libraries and install dependencies
run: make install HTTPS=true ARGS="-ci"
run: make install HTTPS=true ARGS="--ci"

- name: Set up colcon workspace
run: |
Expand Down
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
"rclpy",
"rhoban",
"robocup",
"rory",
"rosbag",
"rosbags",
"rosdep",
Expand Down
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


# Bit-Bots Software Stack

[![Build & Test](https://github.com/bit-bots/bitbots_main/actions/workflows/ci.yml/badge.svg)](https://github.com/bit-bots/bitbots_main/actions/workflows/ci.yml)
Expand All @@ -21,23 +19,23 @@ Full step-by-step instructions for installing the Bit-Bots software stack and RO

If you want to update this repo, all third party source files as well as the supplementing files, run

``` bash
``` shell
make pull-all
```

If you encounter any problems consider cleaning the third party source files (the `lib` folder) first:

**THIS DELETES ALL CHANGES YOU MADE TO THE THIRD PARTY SOURCE FILES**
**THIS DELETES ALL CHANGES YOU MADE TO THE THIRD PARTY SOURCE FILES!**

``` bash
``` shell
make fresh-libs
```

## Run auto formatting

To format all code in the repository, run

``` bash
``` shell
make format
```

Expand Down
1 change: 1 addition & 0 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
black # Auto-formatting for python
exhale # Necessary for rst rendering
fabric # Manages SSH sessions for the deploy tool
paramiko # Necessary for fabric
pre-commit # Installs and runs pre-commit hooks for git
rich # Rich terminal output
ruff # Python linting
Expand Down
10 changes: 5 additions & 5 deletions scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,31 @@ Five different tasks can be performed:

- Get help and list all arguments:

```bash
```shell
./deploy_robots.py --help
```

- Default usage: Run all tasks on the `nuc1` host:

```bash
```shell
./deploy_robots.py nuc1
```

- Make all robots ready for games. This also launch the teamplayer software on all robots:

```bash
```shell
./deploy_robots.py ALL
```

- Only run the sync and build tasks on the `nuc1` and `nuc2` hosts:

```bash
```shell
./deploy_robots.py --sync --build nuc1 nuc2
```

- Only build the `bitbots_utils` ROS package on the `nuc1` host:

```bash
```shell
./deploy_robots.py --package bitbots_utils nuc1
```

Expand Down
47 changes: 31 additions & 16 deletions scripts/deploy/deploy_robots.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,15 @@
print_known_targets,
print_success,
)
from deploy.tasks import AbstractTask, AbstractTaskWhichRequiresSudo, Build, Configure, Install, Launch, Sync
from deploy.tasks import (
AbstractTask,
AbstractTaskWhichRequiresSudo,
Build,
Configure,
Install,
Launch,
Sync,
)
from rich.prompt import Prompt

# TODO: Install this script as a command line tool
Expand Down Expand Up @@ -47,7 +55,7 @@ def _parse_arguments(self) -> argparse.Namespace:
parser = ArgumentParserShowTargets(
description="Deploy the Bit-Bots software on a robot. "
"This script provides 5 tasks: sync, install, configure, build, launch. "
"By default, it runs all tasks. You can select a subset of tasks by using the corresponding flags."
"By default, it runs all tasks. You can select a subset of tasks by using the corresponding flags. "
"For example, to only run the sync and build task, use the -sb."
)

Expand All @@ -66,50 +74,57 @@ def _parse_arguments(self) -> argparse.Namespace:
"--sync",
dest="only_sync",
action="store_true",
help="Only synchronize (copy) files from you to the target machine",
help="Only synchronize (copy) files from you to the target machine.",
)
parser.add_argument(
"-i",
"--install",
dest="only_install",
action="store_true",
help="Only install ROS dependencies on the target",
help="Only install ROS dependencies on the targets.",
)
parser.add_argument(
"-c", "--configure", dest="only_configure", action="store_true", help="Only configure the target machine"
"-c", "--configure", dest="only_configure", action="store_true", help="Only configure the target machines."
)
parser.add_argument(
"-b", "--build", dest="only_build", action="store_true", help="Only build on the target machine"
"-b", "--build", dest="only_build", action="store_true", help="Only build/compile on the target machines."
)
parser.add_argument(
"-l",
"--launch",
dest="only_launch",
action="store_true",
help="Only launch teamplayer software on the target",
help="Only launch teamplayer software on the targets.",
)

# Optional arguments
parser.add_argument("-p", "--package", default="", help="Synchronize and build only the given ROS package")
parser.add_argument("-u", "--user", default="bitbots", help="The user to connect to the target machines with")
parser.add_argument("-w", "--workspace", default="~/colcon_ws", help="The workspace to deploy to")
parser.add_argument("-p", "--package", default="", help="Synchronize and build only the given ROS package.")
parser.add_argument(
"--clean",
action="store_true",
help="Clean complete workspace (source and install, ...) before syncing and building",
help="Clean complete workspace (source and install, ...) before syncing and building.",
)
parser.add_argument("--clean-src", action="store_true", help="Clean source directory before syncing")
parser.add_argument("--clean-src", action="store_true", help="Clean source directory before syncing.")
parser.add_argument(
"--clean-build",
action="store_true",
help="Clean workspace before building. If --package is given, clean only that package",
help="Clean workspace before building. If --package is given, clean only that package.",
)
parser.add_argument("--connection-timeout", default=10, help="Timeout to establish SSH connections in seconds.")
parser.add_argument(
"--print-bit-bot", action="store_true", default=False, help="Print our logo at script start"
"--print-bit-bot", action="store_true", default=False, help="Print our logo at script start."
)
parser.add_argument("-v", "--verbose", action="count", default=0, help="More output.")
parser.add_argument("-q", "--quiet", action="count", default=0, help="Less output.")
parser.add_argument(
"-u", "--user", default="bitbots", help="The SSH user to connect to the target machines with"
)
parser.add_argument(
"-w",
"--workspace",
default="~/colcon_ws",
help="Path to the workspace directory to deploy to. Defaults to '~/colcon_ws'",
)
parser.add_argument("-v", "--verbose", action="count", default=0, help="More output")
parser.add_argument("-q", "--quiet", action="count", default=0, help="Less output")

args = parser.parse_args()

Expand Down
24 changes: 12 additions & 12 deletions scripts/deploy/known_targets.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
nuc1:
ip: "172.20.1.11"
"172.20.1.11":
hostname: "nuc1"
robot_name: "amy"
nuc2:
ip: "172.20.1.12"
"172.20.1.12":
hostname: "nuc2"
robot_name: "rory"
nuc3:
ip: "172.20.1.13"
"172.20.1.13":
hostname: "nuc3"
robot_name: "jack"
nuc4:
ip: "172.20.1.14"
"172.20.1.14":
hostname: "nuc4"
robot_name: "donna"
nuc5:
ip: "172.20.1.15"
"172.20.1.15":
hostname: "nuc5"
robot_name: "melody"
nuc6:
ip: "172.20.1.16"
"172.20.1.16":
hostname: "nuc6"
robot_name: "rose"
Loading
Loading