-
Notifications
You must be signed in to change notification settings - Fork 38
refactor: Rebase main branch to clean up messy commit history #53
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
Changes from all commits
a970c46
6e1f1d2
5285d38
6bc711b
473dde4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| CONTAINER_USER=ubuntu | ||
| CONTAINER_HOME=/home/ubuntu |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| name: Build and Push RMCS Images | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| push: | ||
| paths: | ||
| - 'Dockerfile' | ||
| branches: | ||
| - main | ||
|
|
||
| jobs: | ||
| build-and-push: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
|
|
||
| - name: Log in to Docker Hub | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
| password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
|
||
| - name: Set up SSH keys | ||
| run: | | ||
| mkdir -p .ssh | ||
| chmod 700 .ssh | ||
| echo "${{ secrets.CONTAINER_ID_RSA }}" > .ssh/id_rsa | ||
| echo "${{ secrets.CONTAINER_ID_RSA_PUB }}" > .ssh/id_rsa.pub | ||
| chmod 600 .ssh/id_rsa | ||
| chmod 644 .ssh/id_rsa.pub | ||
|
|
||
| - name: Build and push rmcs-develop:latest | ||
| uses: docker/build-push-action@v6 | ||
| with: | ||
| context: . | ||
| push: true | ||
| target: rmcs-develop | ||
| tags: qzhhhi/rmcs-develop:latest | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| - name: Build and push rmcs-runtime:latest | ||
| uses: docker/build-push-action@v6 | ||
| with: | ||
| context: . | ||
| push: true | ||
| target: rmcs-runtime | ||
| tags: qzhhhi/rmcs-runtime:latest | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| #! /bin/bash | ||
| #!/bin/bash | ||
|
|
||
| # if arg[1] == "-r" | ||
| if [ "$1" == "-r" ]; then | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,60 @@ | ||
| #! /bin/bash | ||
| #!/bin/bash | ||
|
|
||
| source /opt/ros/jazzy/setup.bash | ||
|
|
||
| cd /workspaces/RMCS/rmcs_ws | ||
| : "${RMCS_PATH:=/workspaces/RMCS}" | ||
|
|
||
| colcon build --symlink-install --merge-install | ||
| if [[ ! -d "${RMCS_PATH}/rmcs_ws" ]]; then | ||
| echo "> ERROR: Workspace not found: ${RMCS_PATH}/rmcs_ws" | ||
| exit 1 | ||
| fi | ||
|
|
||
| cd "${RMCS_PATH}"/rmcs_ws || exit 1 | ||
|
|
||
| [[ -x /opt/cmake/bin/cmake ]] && | ||
| export PATH="/opt/cmake/bin:$PATH" | ||
|
|
||
| cmake_toolchain_args=() | ||
| event_handlers_args=() | ||
|
|
||
| if [[ "${RMCS_USE_LLVM}" == "ON" ]]; then | ||
| missing_tools=() | ||
| for tool in clang clang++ llvm-ar llvm-ranlib ld.lld ninja; do | ||
| if ! command -v "${tool}" &>/dev/null; then | ||
| missing_tools+=("${tool}") | ||
| fi | ||
| done | ||
|
|
||
| if ((${#missing_tools[@]} > 0)); then | ||
| echo "> ERROR: LLVM toolchain is required when RMCS_USE_LLVM=ON." | ||
| echo "> Missing tools: ${missing_tools[*]}" | ||
| echo "> Install the missing tools, or set RMCS_USE_LLVM=OFF to build with GCC." | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "> Compiling With LLVM ToolChain" | ||
| export CC=clang | ||
| export CXX=clang++ | ||
| cmake_toolchain_args=( | ||
| "-GNinja" | ||
| "-DCMAKE_MESSAGE_LOG_LEVEL=ERROR" | ||
| "-DCMAKE_EXE_LINKER_FLAGS=-fuse-ld=lld" | ||
| "-DCMAKE_SHARED_LINKER_FLAGS=-fuse-ld=lld" | ||
| "-DCMAKE_AR=$(command -v llvm-ar)" | ||
| "-DCMAKE_RANLIB=$(command -v llvm-ranlib)" | ||
| ) | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| event_handlers_args=( | ||
| --event-handlers console_cohesion+ | ||
| ) | ||
| fi | ||
|
|
||
| colcon_args=( | ||
| --symlink-install --merge-install | ||
| "${event_handlers_args[@]}" | ||
| ) | ||
| cmake_args=( | ||
| "${cmake_toolchain_args[@]}" | ||
| ) | ||
|
|
||
| CLICOLOR_FORCE=1 NINJA_STATUS="" \ | ||
| colcon build "${colcon_args[@]}" "$@" --cmake-args "${cmake_args[@]}" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,13 @@ | ||
| #! /bin/bash | ||
| #!/bin/bash | ||
|
|
||
| rm -rf /workspaces/RMCS/rmcs_ws/build /workspaces/RMCS/rmcs_ws/install /workspaces/RMCS/rmcs_ws/log | ||
| : "${RMCS_PATH:=/workspaces/RMCS}" | ||
|
|
||
| if [[ -z "${RMCS_PATH}" || "${RMCS_PATH}" == "/" ]]; then | ||
| echo "Invalid RMCS_PATH: '${RMCS_PATH}'" | ||
| exit 1 | ||
| fi | ||
|
|
||
| rm -rf -- \ | ||
| "${RMCS_PATH}/rmcs_ws/build" \ | ||
| "${RMCS_PATH}/rmcs_ws/install" \ | ||
| "${RMCS_PATH}/rmcs_ws/log" |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,51 @@ | ||||||||||||||||||||||
| #compdef build-rmcs | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| local _comp_func="${_comps[colcon]}" | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| if [[ -z "${_comp_func}" ]]; then | ||||||||||||||||||||||
| if (( $+functions[_python_argcomplete] )); then | ||||||||||||||||||||||
| _comp_func="_python_argcomplete" | ||||||||||||||||||||||
| elif (( $+functions[_colcon] )); then | ||||||||||||||||||||||
| _comp_func="_colcon" | ||||||||||||||||||||||
| else | ||||||||||||||||||||||
| _message "colcon completion not found. Please source colcon completion setup." | ||||||||||||||||||||||
| return 1 | ||||||||||||||||||||||
| fi | ||||||||||||||||||||||
| fi | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| if [[ "${_comp_func}" == "_python_argcomplete" ]]; then | ||||||||||||||||||||||
| local IFS=$'\013' | ||||||||||||||||||||||
| local -a completions | ||||||||||||||||||||||
| local _comp_line _comp_point | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| _comp_line="colcon build${BUFFER#build-rmcs}" | ||||||||||||||||||||||
| _comp_point=$((CURSOR + 2)) | ||||||||||||||||||||||
|
Comment on lines
+21
to
+22
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. COMP_POINT 计算存在边界情况问题。 当光标位于 🛠️ 建议修复- _comp_line="colcon build${BUFFER#build-rmcs}"
- _comp_point=$((CURSOR + 2))
+ local _cmd_len=${#${BUFFER%%[[:space:]]*}}
+ _comp_line="colcon build${BUFFER#build-rmcs}"
+ if (( CURSOR <= _cmd_len )); then
+ # Cursor within command name, map proportionally
+ _comp_point=$((CURSOR * 12 / 10))
+ else
+ _comp_point=$((CURSOR + 2))
+ fi📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| completions=($(IFS="$IFS" \ | ||||||||||||||||||||||
| COMP_LINE="${_comp_line}" \ | ||||||||||||||||||||||
| COMP_POINT="${_comp_point}" \ | ||||||||||||||||||||||
| _ARGCOMPLETE=1 \ | ||||||||||||||||||||||
| _ARGCOMPLETE_SHELL="zsh" \ | ||||||||||||||||||||||
| _ARGCOMPLETE_SUPPRESS_SPACE=1 \ | ||||||||||||||||||||||
| __python_argcomplete_run colcon)) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| _describe colcon completions -o nosort | ||||||||||||||||||||||
| return 0 | ||||||||||||||||||||||
| fi | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| local -a _orig_words | ||||||||||||||||||||||
| local _orig_current | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| _orig_words=("${words[@]}") | ||||||||||||||||||||||
| _orig_current=${CURRENT} | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| words=(colcon build "${_orig_words[@]:1}") | ||||||||||||||||||||||
| CURRENT=$((_orig_current + 1)) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| "${_comp_func}" "$@" | ||||||||||||||||||||||
| local status=$? | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| words=("${_orig_words[@]}") | ||||||||||||||||||||||
| CURRENT=${_orig_current} | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| return $status | ||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| #compdef play-autoaim | ||
|
|
||
| _arguments \ | ||
| '--user[Remote username]:username:' \ | ||
| '--remote[Pull SDP from device into container]' \ | ||
| '--no-copy[Skip copy from container to host]' \ | ||
| '--ip[IP address of monitor host]:ip:' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| #compdef set-remote | ||
|
|
||
| _remote_hosts() { | ||
| local hosts=( | ||
| "169.254.233.233" | ||
| "alliance-sentry.local" | ||
| "alliance-infantry.local" | ||
| "alliance-hero.local" | ||
| ) | ||
|
|
||
| # Extract recently used HostName from ~/.ssh/config | ||
| if [[ -f ~/.ssh/config ]]; then | ||
| local extracted | ||
| extracted=(${(f)"$(grep -A1 'Host remote' ~/.ssh/config | grep HostName | awk '{print $2}')"}) | ||
| hosts+=(${extracted}) | ||
| fi | ||
|
|
||
| compadd -- $hosts | ||
| } | ||
|
|
||
| _arguments \ | ||
| '1:Remote host address:_remote_hosts' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| #!/bin/bash | ||
|
|
||
| source ~/env_setup.bash | ||
|
|
||
| ros2 launch foxglove_bridge foxglove_bridge_launch.xml port:=8765 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| readonly DEVELOPER_NAME="ubuntu" | ||
| readonly NVIM_PATH="/opt/nvim-linux-x86_64/bin/nvim" | ||
| readonly NVIM_PORT=6666 | ||
| readonly NVIM_HOST="localhost" | ||
|
|
||
| function show_help() { | ||
| local project_dir="$1" | ||
| local service="$2" | ||
| echo "Usage: $(basename "$0") [path] [zsh|n|nvim|neovide|vim|ide]" | ||
| echo " Project dir: $project_dir" | ||
| echo " Service: $service" | ||
| } | ||
|
|
||
| function rmcs_zsh() { | ||
| local service="$1" | ||
| echo "Starting and entering container..." | ||
| docker compose up -d | ||
| docker compose exec "$service" zsh | ||
| } | ||
|
|
||
| function rmcs_nvim() { | ||
| local service="$1" | ||
| local timeout=10 | ||
| local success=0 | ||
| local port=$NVIM_PORT | ||
|
|
||
| echo "Starting container..." | ||
| docker compose up -d | ||
|
|
||
| echo "Checking available port and starting nvim headless server..." | ||
| while nc -z "$NVIM_HOST" "$port" 2>/dev/null; do | ||
| echo "Port $port is occupied, trying next..." | ||
| port=$((port + 1)) | ||
| done | ||
|
|
||
| echo "Starting nvim server on port $port..." | ||
| docker compose exec -u "$DEVELOPER_NAME" -d "$service" \ | ||
| "$NVIM_PATH" --headless --listen "$NVIM_HOST:$port" | ||
|
|
||
| for i in $(seq 1 $timeout); do | ||
| if nc -z "$NVIM_HOST" "$port" 2>/dev/null; then | ||
| echo "nvim server started on port $port" | ||
| success=1 | ||
| break | ||
| fi | ||
| echo "Waiting for nvim server to start... ($i/$timeout)" | ||
| sleep 1 | ||
| done | ||
|
|
||
| if [ $success -eq 1 ]; then | ||
| echo "Starting neovide..." | ||
| nohup neovide --server="$NVIM_HOST:$port" >/dev/null 2>&1 & | ||
| else | ||
| echo "nvim server failed to start within $timeout seconds, neovide not launched" | ||
| exit 1 | ||
| fi | ||
| } | ||
|
|
||
| function main() { | ||
| local project_dir command | ||
|
|
||
| if [ -d "${1:-}" ]; then | ||
| project_dir="$(cd "$1" && pwd)" | ||
| command="${2:-}" | ||
| else | ||
| project_dir="$(pwd)" | ||
| command="${1:-}" | ||
| fi | ||
|
|
||
| cd "$project_dir" || exit 1 | ||
|
|
||
| if [ ! -f "docker-compose.yml" ]; then | ||
| echo "Error: docker-compose.yml not found in current directory" | ||
| exit 1 | ||
| fi | ||
|
|
||
| local service="rmcs-develop" | ||
|
|
||
| case "$command" in | ||
| zsh) | ||
| rmcs_zsh "$service" | ||
| ;; | ||
| n | nvim | neovide | vim | ide) | ||
| rmcs_nvim "$service" | ||
| ;; | ||
| *) | ||
| show_help "$project_dir" "$service" | ||
| ;; | ||
| esac | ||
| } | ||
|
|
||
| main "$@" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| #! /bin/bash | ||
| #!/bin/bash | ||
|
|
||
| source ~/env_setup.bash | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
自动触发范围太窄,会漏掉很多实际改变镜像内容的提交。
镜像还依赖
.script/**、模板脚本,以及rmcs_ws/src(Dockerfile Line 60-63 的rosdep install直接读这里)。现在只监听Dockerfile,这些路径变化后不会自动重建镜像,发布结果会悄悄落后于main。🔧 建议修正
push: paths: - 'Dockerfile' + - '.script/**' + - 'rmcs_ws/src/**' + - '.github/workflows/update-image.yml' branches: - main🤖 Prompt for AI Agents