Skip to content

Commit

Permalink
Add docker into repository (#467)
Browse files Browse the repository at this point in the history
* Update workflow

* Clean up

* Update workflow version

* update token

* Update tags in compose files

* Fixes

* Fix

* fix

* Fix

* Change action name

* Update docker/Dockerfile.hardware

Co-authored-by: Dawid Kmak <73443304+KmakD@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Dawid Kmak <73443304+KmakD@users.noreply.github.com>

* Add envs to compose

* Add needs

* Update docker/demo/compose.simulation.yaml

Co-authored-by: Dawid Kmak <73443304+KmakD@users.noreply.github.com>

---------

Co-authored-by: action-bot <action-bot@action-bot.com>
Co-authored-by: Dawid Kmak <73443304+KmakD@users.noreply.github.com>
  • Loading branch information
3 people authored Dec 20, 2024
1 parent 45359eb commit f1d45b4
Show file tree
Hide file tree
Showing 28 changed files with 144 additions and 868 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.*/
docker/
Original file line number Diff line number Diff line change
@@ -1,19 +1,36 @@
---
name: Build/Publish ROS Docker Image
name: Build Docker

on:
workflow_dispatch:
workflow_call:
inputs:
panther_codebase_version:
description: Version of the panther_ros to be used in the docker image (branch/tag/commit).
build_type:
description: Is it a "development" or a "stable" release?
required: true
type: string
default: ros2-devel
default: development
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:
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:
description: In case of "stable" release specify the date of the existing docker image in format
YYYYMMDD (eg. 20220124)
type: string
default: '20131206'
workflow_dispatch:
inputs:
build_type:
description: Is it a "development" or a "stable" release?
required: true
default: development
type: choice
default: development
options:
- development
- stable
Expand All @@ -32,30 +49,24 @@ on:
YYYYMMDD (eg. 20220124)
type: string
default: '20131206'
feature_branch_tag_suffix:
description: In case of "development" release from a feature branch specify the custom tag suffix
for the docker image
type: string
default: ''

jobs:
build:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
include:
- dockerfile: Dockerfile.hardware
- dockerfile: ./docker/Dockerfile.hardware
platforms: linux/arm64
ros_distro: humble
- dockerfile: Dockerfile.simulation
- dockerfile: ./docker/Dockerfile.simulation
repo_name: panther-gazebo
platforms: linux/amd64
ros_distro: humble

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Build Docker Image
uses: husarion-ci/ros-docker-img-action@v0.8
Expand All @@ -65,13 +76,10 @@ jobs:
main_branch_name: ros2
dockerfile: ${{ matrix.dockerfile }}
repo_name: ${{ matrix.repo_name }}
branch_name: ${{ inputs.panther_codebase_version }}
build_type: ${{ inputs.build_type }}
ros_distro: ${{ matrix.ros_distro }}
platforms: ${{ matrix.platforms }}
# variables important only for stable release
target_distro: ${{ inputs.target_distro }}
target_release: ${{ inputs.target_release }}
target_date: ${{ inputs.target_date }}
# variables important only for development release
feature_branch_tag_suffix: ${{ inputs.feature_branch_tag_suffix }}
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: Pre-Commit
name: Pre-commit

on:
push:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/protect-default-branch.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: Validate PR head branch
name: Protect Default Branch
on:
pull_request:
branches:
Expand Down
131 changes: 50 additions & 81 deletions .github/workflows/release-candidate.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: Release candidate
name: Release Candidate

on:
workflow_dispatch:
Expand All @@ -15,121 +15,90 @@ env:
RC_BRANCH_NAME: ${{ github.event.inputs.version }}-${{ github.event.inputs.date }}

jobs:
check_docs:
name: Check docs build
docs:
name: Docs
runs-on: ubuntu-22.04
steps:
- name: Trigger repository build workflow
uses: convictional/trigger-workflow-and-wait@v1.6.1
- name: Check docs build
uses: convictional/trigger-workflow-and-wait@v1.6.5
with:
owner: husarion
repo: docs_new
github_token: ${{ secrets.GH_PAT }}
workflow_file_name: test-release.yml
github_token: ${{ secrets.RAFAL_ACCESS_TOKEN }}
workflow_file_name: parser-test.yaml
ref: master
client_payload: '{"husarion_ugv_branch": "ros2-devel"}'

# TODO: Add unit testing for panther_ros when ready
unit_test_panther_ros:
name: Run unit tests for panther_ros
# TODO: Add unit testing when ready
unit_tests:
name: Unit tests
runs-on: ubuntu-22.04
steps:
- name: Trigger repository build workflow
run: echo "Unit tests for panther_ros are not fully implemented yet -> SKIPPING!"
- name: Run unit tests
run: echo "Unit tests are not fully implemented yet -> SKIPPING!"

create_release_candidate_branches:
name: Create release candidate branches
docker:
name: Docker
needs: unit_tests
runs-on: ubuntu-22.04
needs:
- unit_test_panther_ros
strategy:
matrix:
repo: [panther_ros, panther-docker, panther-rpi-os-img]
steps:
- name: Create test branch
uses: GuillaumeFalourd/create-other-repo-branch-action@v1.5
- name: Checkout
uses: actions/checkout@v4

- name: Update docker image tag
run: |
sed -i 's/\(husarion\/panther:humble-\)[^[:space:]]*/\1${{ env.RC_BRANCH_NAME }}/g' docker/demo/compose.hardware.yaml
sed -i 's/\(husarion\/panther:humble-\)[^[:space:]]*/\1${{ env.RC_BRANCH_NAME }}/g' docker/demo/compose.rviz.yaml
sed -i 's/\(husarion\/panther-gazebo:humble-\)[^[:space:]]*/\1${{ env.RC_BRANCH_NAME }}/g' docker/demo/compose.simulation.yaml
- name: Commit changes
uses: EndBug/add-and-commit@v9
with:
repository_owner: husarion
repository_name: ${{ matrix.repo }}
new_branch_name: ${{ env.RC_BRANCH_NAME }}
new_branch_ref: ros2-devel
access_token: ${{ secrets.GH_PAT}}
message: Update tags in compose files
author_name: action-bot
author_email: action-bot@action-bot.com
new_branch: ${{ env.RC_BRANCH_NAME }}

update_tags_in_compose:
name: Update Docker image tags in compose
runs-on: ubuntu-22.04
needs:
- create_release_candidate_branches
steps:
- name: Trigger repository build workflow
uses: convictional/trigger-workflow-and-wait@v1.6.1
- name: Build Docker
uses: ./.github/workflows/build-docker.yaml
with:
owner: husarion
repo: panther-docker
github_token: ${{ secrets.GH_PAT }}
workflow_file_name: update-tags-in-compose.yaml
ref: ${{ env.RC_BRANCH_NAME }}
client_payload: |
{
"branch_name": "${{ env.RC_BRANCH_NAME }}",
"image_tag": "humble-${{ env.RC_BRANCH_NAME }}"
}
build_type: development

build_and_push_docker_images:
name: Build panther docker images
os_image:
name: OS image
needs: docker
runs-on: ubuntu-22.04
needs:
- update_tags_in_compose
steps:
- name: Trigger repository build workflow
uses: convictional/trigger-workflow-and-wait@v1.6.1
- name: Create new branch
uses: GuillaumeFalourd/create-other-repo-branch-action@v1.5
with:
owner: husarion
repo: panther-docker
github_token: ${{ secrets.GH_PAT }}
workflow_file_name: ros-docker-image.yaml
ref: ${{ env.RC_BRANCH_NAME }}
client_payload: |
{
"panther_codebase_version": "${{ env.RC_BRANCH_NAME }}",
"build_type": "development",
"target_distro": "humble"
}
repository_owner: husarion
repository_name: panther-rpi-os-img
new_branch_name: ${{ env.RC_BRANCH_NAME }}
new_branch_ref: ros2-devel
access_token: ${{ secrets.RAFAL_ACCESS_TOKEN}}

build_and_publish_rpi_image:
name: Build panther system image
needs:
- update_tags_in_compose
runs-on: ubuntu-22.04
steps:
- name: Trigger repository build workflow
uses: convictional/trigger-workflow-and-wait@v1.6.1
- name: Build OS image
uses: convictional/trigger-workflow-and-wait@v1.6.5
with:
owner: husarion
repo: panther-rpi-os-img
github_token: ${{ secrets.GH_PAT }}
github_token: ${{ secrets.RAFAL_ACCESS_TOKEN }}
workflow_file_name: build_and_deploy_image.yaml
ref: ${{ env.RC_BRANCH_NAME }}
client_payload: |
{
"dev_image": "true",
"panther_codebase_version": "${{ env.RC_BRANCH_NAME }}",
"husarion_ugv_version": "${{ env.RC_BRANCH_NAME }}",
"image_tag": "${{ github.event.inputs.version }}"
}
build_and_publish_rpi_flash_os_image:
name: Build panther flash OS image
if: ${{ fromJSON(github.event.inputs.automatic_mode) == true }}
needs:
- build_and_publish_rpi_image
runs-on: ubuntu-22.04
steps:
- name: Trigger repository build workflow
uses: convictional/trigger-workflow-and-wait@v1.6.1
- name: Build flash OS image
uses: convictional/trigger-workflow-and-wait@v1.6.5
with:
owner: husarion
repo: panther-rpi-os-img
github_token: ${{ secrets.GH_PAT }}
github_token: ${{ secrets.RAFAL_ACCESS_TOKEN }}
workflow_file_name: build_and_deploy_flash_os_image.yaml
ref: ${{ env.RC_BRANCH_NAME }}
client_payload: |
Expand Down
Loading

0 comments on commit f1d45b4

Please sign in to comment.