Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/oats.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ jobs:
} >> "$GITHUB_OUTPUT"
echo "Resolved image=$image tag=$tag group=$group (event=$EVENT_NAME)"

- name: Report disk space
run: |
docker image prune -f
df -h / /tmp "$GITHUB_WORKSPACE"
docker system df

- name: Pull ODM image
run: docker pull "${{ steps.params.outputs.image }}:${{ steps.params.outputs.tag }}"

Expand Down
53 changes: 53 additions & 0 deletions .github/workflows/runner-maintenance.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Inspects the self-hosted OATS runner and, on request, prunes Docker. Run it
# from the Actions tab to check disk space and host tools without a shell on
# the machine. It shares the OATS concurrency group so it never removes images
# while a suite run is in progress.

name: Runner maintenance

on:
workflow_dispatch:
inputs:
prune:
description: Remove all unused Docker images, containers, networks and build cache
type: boolean
default: false

concurrency:
group: oats-${{ github.repository }}
cancel-in-progress: false

jobs:
maintenance:
runs-on: self-hosted
timeout-minutes: 30
steps:
- name: Disk space
run: |
df -h
echo
docker system df

- name: Docker
run: |
docker info --format 'Data root: {{.DockerRootDir}}'
docker version --format 'Server: {{.Server.Version}}'
echo
docker image ls --format 'table {{.Repository}}:{{.Tag}}\t{{.Size}}\t{{.CreatedSince}}'

- name: Host tools
run: |
for tool in git wget rsync sed unzip jq docker; do
printf '%-8s %s\n' "$tool" "$(command -v "$tool" || echo MISSING)"
done
echo
free -h
nproc

- name: Prune Docker
if: inputs.prune
run: |
docker system prune -af
echo
df -h /
docker system df
4 changes: 2 additions & 2 deletions docs/ci.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ outside it, namely the runner, the cross-repo token and the ODM-side trigger.
Register a runner against this repository (*Settings → Actions → Runners*). The
default `self-hosted` label is all the workflow asks for.

It needs docker, plus `git`, `wget`, `rsync`, `sed`, `unzip`, `jq`, and
`gdalinfo` on `PATH`; `./run` bootstraps bats itself. Give it plenty of RAM —
It needs docker, plus `git`, `wget`, `rsync`, `sed`, `unzip` and `jq` on
`PATH`; `./run` bootstraps bats itself. Give it plenty of RAM —
the suite is RAM-bound and the `all` group sets the ceiling. Each full run
generates about 60GB of output right now so as a rough guide we should aim for
about 1TB of disk space.
Expand Down
18 changes: 18 additions & 0 deletions functions.bash
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,24 @@ run_test(){
[ "$status" -eq 0 ]
}

# Runs a tool from the ODM image under test, with the current test's output
# directory mounted at /dataset. Paths given to the tool are container paths.
# Images built with pixi put their tools on PATH through the shell hook; older
# images keep them under SuperBuild/install.
odm_tool(){
docker run --rm \
-v "$(pwd)/$output_dir:/dataset" \
--entrypoint bash \
"$DOCKER_IMAGE:$tag" \
-c '
if [ -f /code/scripts/pixi-shell-hook ]; then
. /code/scripts/pixi-shell-hook
else
export PATH="/code/SuperBuild/install/bin:$PATH"
fi
exec "$@"' bash "$@"
}

teardown(){
[ -n "${odm_status:-}" ] || return 0

Expand Down
1 change: 0 additions & 1 deletion run
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ environment_check(){
check_command "sed" "Run \033[1msudo apt install -y sed\033[0m" "sudo apt install -y sed"
check_command "unzip" "Run \033[1msudo apt install -y unzip\033[0m" "sudo apt install -y unzip"
check_command "jq" "Run \033[1msudo apt install -y jq\033[0m" "sudo apt install -y jq"
check_command "gdalinfo" "Run \033[1msudo apt install -y gdal-bin\033[0m" "sudo apt install -y gdal-bin"
}

ensure_bats(){
Expand Down
2 changes: 1 addition & 1 deletion tests/brighton.oat
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ DATASET_URL=https://github.com/OpenDroneMap/drone_dataset_brighton_beach/archive
[ -e "$output_dir/dsm_tiles" ]
[ -e "$output_dir/dtm_tiles" ]

gdalinfo "$output_dir/odm_orthophoto/odm_orthophoto.tif" | grep -q Overviews
odm_tool gdalinfo /dataset/odm_orthophoto/odm_orthophoto.tif | grep -q Overviews
}

@test "GeoTIFF alignment" {
Expand Down