Skip to content

Commit c86553f

Browse files
authored
feat(update-checker): validate add-on dependencies (#109)
1 parent 478c9f9 commit c86553f

2 files changed

Lines changed: 40 additions & 0 deletions

File tree

.github/scripts/update-checker.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,42 @@ check_ddev_generated() {
365365
done
366366
}
367367

368+
# Check that dependencies in install.yaml use org/repo format
369+
check_dependencies() {
370+
local install_yaml="install.yaml"
371+
372+
local line entry in_section
373+
local list_item_re='^[[:space:]]*-[[:space:]]+(.*)'
374+
375+
in_section=false
376+
while IFS= read -r line; do
377+
if [[ "$line" == "dependencies:" ]]; then
378+
in_section=true
379+
continue
380+
fi
381+
382+
[[ "$in_section" != "true" ]] && continue
383+
384+
# A top-level YAML key (starts with a letter) ends the section
385+
[[ "$line" =~ ^[a-zA-Z] ]] && break
386+
387+
[[ "$line" =~ $list_item_re ]] || continue
388+
entry="${BASH_REMATCH[1]}"
389+
390+
[[ -z "$entry" ]] && continue
391+
392+
if [[ "$entry" != */* ]]; then
393+
local example_repo
394+
if [[ "$entry" == ddev-* ]]; then
395+
example_repo="ddev/$entry"
396+
else
397+
example_repo="ddev/ddev-$entry"
398+
fi
399+
actions+=("install.yaml dependency '$entry' should use org/repo format (e.g. '$example_repo'), see upstream file $UPSTREAM/$install_yaml")
400+
fi
401+
done < "$install_yaml"
402+
}
403+
368404
# Check .gitattributes
369405
check_gitattributes() {
370406
local gitattributes=".gitattributes"
@@ -467,6 +503,9 @@ run_checks() {
467503
# Check #ddev-generated in files listed in install.yaml
468504
check_ddev_generated
469505

506+
# Check dependencies use org/repo format
507+
check_dependencies
508+
470509
# Check docker-compose.*.yaml for conditions
471510
check_docker_compose_yaml
472511

install.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ global_files:
8585
ddev_version_constraint: '>= v1.24.10'
8686

8787
# List of add-on names that this add-on depends on
88+
# Dependencies must use org/repo format (e.g. ddev/ddev-redis), otherwise DDEV cannot resolve them
8889
dependencies:
8990
# - ddev/ddev-redis
9091

0 commit comments

Comments
 (0)