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

Add workflow to master branch #476

Open
wants to merge 1 commit into
base: ros2
Choose a base branch
from
Open

Conversation

rafal-gorecki
Copy link
Contributor

@rafal-gorecki rafal-gorecki commented Jan 7, 2025

Description

  • Add build-docker.yaml workflow

Requirements

  • Code style guidelines followed
  • Documentation updated

Summary by CodeRabbit

  • New Features

    • Added a new GitHub Actions workflow for automated Docker image building
    • Supports manual and programmatic workflow triggering
    • Configurable build options for different platforms and ROS distributions
  • Chores

    • Introduced CI/CD infrastructure for Docker image generation

Sorry, something went wrong.

Copy link
Contributor

coderabbitai bot commented Jan 7, 2025

Walkthrough

A new GitHub Actions workflow build-docker.yaml has been created to automate Docker image building. The workflow supports both automated and manual triggering, with configurable parameters for build type, distribution, release, and date. It uses a matrix strategy to build images for different platforms (ARM64 and AMD64) targeting the ROS "humble" distribution. The workflow leverages the husarion-ci/ros-docker-img-action to construct Docker images with flexible configuration options.

Changes

File Change Summary
.github/workflows/build-docker.yaml - Added new GitHub Actions workflow
- Introduced workflow inputs: build_type, target_distro, target_release, target_date
- Configured matrix build for ARM64 and AMD64 platforms
- Implemented workflow_call and workflow_dispatch triggers

Sequence Diagram

Loading
sequenceDiagram
    participant Trigger as Workflow Trigger
    participant Matrix as Build Matrix
    participant Docker as Docker Image Build
    participant Registry as Docker Hub

    Trigger->>Matrix: Invoke with parameters
    Matrix->>Docker: Build ARM64 Image
    Matrix->>Docker: Build AMD64 Image
    Docker->>Registry: Push Images

Possibly related PRs


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (3)
.github/workflows/build-docker.yaml (3)

27-51: Consider reusing input definitions to avoid duplication.

The input definitions are duplicated between workflow_call and workflow_dispatch. Consider extracting common configurations to reusable YAML anchors to maintain consistency and reduce duplication.

Example using YAML anchors:

# At the top of the file
definitions: &common_inputs
  target_distro: &target_distro
    description: In case of "stable" release specify the ROS distro of the existing docker image (eg. humble)
    type: string
    default: humble
  target_release: &target_release
    description: In case of "stable" release specify the version of the existing docker image (eg. 1.0.12)
    type: string
    default: 0.0.0
  target_date: &target_date
    description: In case of "stable" release specify the date of the existing docker image in format YYYYMMDD (eg. 20220124)
    type: string
    default: '20131206'

on:
  workflow_call:
    inputs:
      build_type:
        description: Is it a "development" or a "stable" release?
        type: string
        default: development
      target_distro:
        <<: *target_distro
      target_release:
        <<: *target_release
      target_date:
        <<: *target_date
  workflow_dispatch:
    inputs:
      build_type:
        description: Is it a "development" or a "stable" release?
        type: choice
        options: [development, stable]
        default: development
      target_distro:
        <<: *target_distro
      target_release:
        <<: *target_release
      target_date:
        <<: *target_date

76-76: Consider making main_branch_name configurable.

The main_branch_name is hardcoded to 'ros2'. Consider making it configurable through workflow inputs if different branches might be used in the future.


82-85: Improve comment clarity for stable release variables.

The comment could be more specific about when and how these variables are used. Consider updating it to explain their purpose and impact on the build process.

-          # variables important only for stable release
+          # These variables are used when build_type is "stable" to tag the image correctly
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ad89d1e and 78bae2d.

📒 Files selected for processing (1)
  • .github/workflows/build-docker.yaml (1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/build-docker.yaml

11-11: input "build_type" of workflow_call event has the default value "development", but it is also required. if an input is marked as required, its default value will never be used

(events)

🔇 Additional comments (3)
.github/workflows/build-docker.yaml (3)

1-3: LGTM!

The workflow name is clear and descriptive.


22-26: Verify the default target_date value.

The default target_date is set to '20131206' which seems outdated. Consider updating it to a more recent date or removing the default value if it's not needed.


58-65: Verify repo_name configuration in matrix.

The repo_name is only defined for the simulation build. Is this intentional? If not, consider adding it to the hardware build configuration as well.

Comment on lines +7 to +11
build_type:
description: Is it a "development" or a "stable" release?
required: true
type: string
default: development
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Remove redundant required flag or default value for build_type input.

The input is marked as required but also has a default value. This configuration is contradictory since the default value will never be used for required inputs.

Choose one of these options:

      build_type:
        description: Is it a "development" or a "stable" release?
-       required: true
        type: string
        default: development

OR

      build_type:
        description: Is it a "development" or a "stable" release?
        required: true
        type: string
-       default: development
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
build_type:
description: Is it a "development" or a "stable" release?
required: true
type: string
default: development
build_type:
description: Is it a "development" or a "stable" release?
type: string
default: development
🧰 Tools
🪛 actionlint (1.7.4)

11-11: input "build_type" of workflow_call event has the default value "development", but it is also required. if an input is marked as required, its default value will never be used

(events)

@rafal-gorecki rafal-gorecki requested a review from BOOTCFG January 9, 2025 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant