Skip to content

Commit

Permalink
Fix error handling
Browse files Browse the repository at this point in the history
- build.yaml: don't continue on error (this makes the workflow succeed on failures)
- instead, always deploy in scheduled.yaml
- ignore known failures (only issue a warning)
  • Loading branch information
rhaschke committed Dec 20, 2024
1 parent aa77691 commit 5e6ed68
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 4 deletions.
1 change: 0 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ jobs:
runs-on: ${{ inputs.ARCH == 'x64' && 'ubuntu-22.04' || inputs.ARCH }}
timeout-minutes: ${{ inputs.BUILD_TIMEOUT || (inputs.ARCH == 'x64' && 340 || 2880) }}
name: build debs
continue-on-error: true
outputs:
LATEST_PACKAGE: ${{ steps.build.outputs.LATEST_PACKAGE }}

Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/interactive.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ jobs:

stage-2:
needs: stage-1
if: needs.stage-1.result == 'success' || ${{ inputs.CONTINUE_ON_ERROR }}
uses: ubi-agni/ros-builder-action/.github/workflows/build.yaml@main
with:
DEB_DISTRO: ${{ inputs.DEB_DISTRO || vars.DEB_DISTRO }}
Expand All @@ -109,6 +110,7 @@ jobs:

stage-3:
needs: stage-2
if: needs.stage-2.result == 'success' || ${{ inputs.CONTINUE_ON_ERROR }}
uses: ubi-agni/ros-builder-action/.github/workflows/build.yaml@main
with:
DEB_DISTRO: ${{ inputs.DEB_DISTRO || vars.DEB_DISTRO }}
Expand All @@ -131,7 +133,7 @@ jobs:
INSTALL_TO_CHROOT: ${{ inputs.INSTALL_TO_CHROOT || vars.INSTALL_TO_CHROOT || false }}

deploy:
needs: stage-3
needs: [stage-1, stage-2, stage-3]
if: success() && vars.DEPLOY_URL
timeout-minutes: 15
runs-on: ubuntu-latest
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/scheduled.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: scheduled

on:
workflow_dispatch:
schedule:
# 8 PM UTC every day
- cron: "0 20 * * *"
Expand Down Expand Up @@ -30,7 +31,7 @@ jobs:

deploy:
needs: build
if: success() && vars.DEPLOY_URL
if: always() && vars.DEPLOY_URL
timeout-minutes: 15
runs-on: ubuntu-latest
concurrency:
Expand Down
8 changes: 8 additions & 0 deletions ros-one.repos
Original file line number Diff line number Diff line change
Expand Up @@ -1060,3 +1060,11 @@ sbuild_options:
eigenpy:
amd64: --jobs=2
arm64: --jobs=1

known_failures:
all:
- jsk_3rdparty/*
jammy:
noble:
- librealsense2
- gazebo_ros_pkgs/gazebo_dev
17 changes: 16 additions & 1 deletion src/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,19 @@ function build_python_pkg {
ici_label update_repo
}

function known_to_fail {
local pkg_path=$1
for key in all "$DEB_DISTRO"; do
while IFS= read -r failure; do
# shellcheck disable=SC2053
if [[ "$pkg_path" == $failure ]]; then
return 0
fi
done < <(yq ".known_failures.${key}[]" "$WS_SOURCE" 2> /dev/null)
done
return 1
}

function build_source {
local old_path=$PWD
local ws_path="$PWD/ws"
Expand Down Expand Up @@ -339,7 +352,9 @@ function build_source {
*) msg_prefix="unnamed step failed ($exit_code)" ;;
esac

if [ "$CONTINUE_ON_ERROR" = false ]; then
if known_to_fail "${PKG_FOLDERS[$idx]}"; then
gha_warning "$msg_prefix on $pkg_desc."
elif [ "$CONTINUE_ON_ERROR" = false ]; then
# exit with custom error message
ici_exit "$exit_code" gha_error "$msg_prefix on $pkg_desc."
else
Expand Down

0 comments on commit 5e6ed68

Please sign in to comment.