Skip to content

feat(Makefile): add CI matrix generation and buildnumber guard#109

Merged
printminion-co merged 8 commits into
masterfrom
mk/dev/cached-matrix-build
May 19, 2026
Merged

feat(Makefile): add CI matrix generation and buildnumber guard#109
printminion-co merged 8 commits into
masterfrom
mk/dev/cached-matrix-build

Conversation

@printminion-co

@printminion-co printminion-co commented Apr 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Rebuilds the HiDrive Next IONOS/Makefile from hardcoded per-app targets into a category-list + dynamic-pattern style, and adopts the structural patterns from sister-repo ncw-config.

Serves the cached matrix CI pipeline in IONOS-Productivity/nc-server#226.

What's new vs. the original PR 109

Beyond the original PR 109's scope (category lists, dynamic matrix, define macros, .precheck, app-list uniqueness validation, buildnumber guard), this version also lifts these patterns from ncw-config:

  • Tightened composer/npm flags: --no-interaction, --prefer-offline --no-audit.
  • APP_FOLDERS_TO_SHIP = apps-external apps-custom (HiDrive Next ships both) wired into patch_shipped_json via the new patch_shipped_json_add_shipped_apps.sh patcher.
  • REMOVE_UNWANTED_APPS driven by IONOS/removed-apps.txt; expands to -x "apps/<name>/*" exclusions in zip_dependencies.
  • Pipeline targets build_after_external_apps and package_after_build for staged CI workflows.
  • validate_external_apps target + script — walks both apps-custom/ and apps-external/, suggests the right category per app, and reports apps that exist on disk but aren't in any list.
  • validate_all umbrella target chaining both validations through $(MAKE).
  • Verbose [i] / [✓] log output in every recipe (build macros, theming/theme specials, add_config_partials, zip_dependencies, clean, build_nextcloud_*).
  • clean also removes .buildnumber + trailing [✓] Clean completed.
  • SPDX header2025 STRATO GmbH.
  • $(MAKE) for recursive build in build_nc_theming_app (Phase D) — caught by Copilot in PR review.

Category split (final)

List Apps Source dir
CUSTOM_NPM_APPS simplesettings apps-custom/
CUSTOM_COMPOSER_APPS nc_ionos_processes apps-custom/
EXTERNAL_FULL_APPS richdocuments user_oidc viewer apps-external/
SPECIAL_BUILD_APPS nc_theming nc-ionos-theme apps-custom/ + themes/

What was not lifted from ncw-config

ncw-server-specific patterns kept out because HiDrive Next doesn't need them:

  • notify_push binary handling (ARCHITECTURE, NOTIFY_PUSH_*, the binary download/checksum target, build_notify_push_*).
  • The 5-category ncw split (FULL_BUILD_APPS, COMPOSER_ONLY_APPS, COMPOSER_NO_SCRIPTS_APPS, …) — HiDrive Next's smaller app set fits cleanly into 4 lists.
  • build_core_app_theming, build_ncw, build_all_external_apps aggregates.
  • The YAML matrix target (generate_external_apps_matrix) — we only emit JSON.
  • MAKEFLAGS parallel-jobs / load-average cap — deferred; can land in a follow-up if needed.

Verification done locally

  • make help lists every category and validation/matrix target.
  • make generate_apps_matrix_json | jq -r '.[].name' emits the expected 7 entries, sorted.
  • make validate_app_list_uniqueness passes.
  • make validate_external_apps runs and surfaces apps on disk that aren't yet in any list (real finding — see follow-up note below).

Related

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds CI support utilities and hardens packaging by centralizing app/theme build lists, generating a CI matrix JSON, and enforcing build metadata presence.

Changes:

  • Introduces categorized app lists and dynamic build_<app>_app targets derived from those lists.
  • Adds generate_apps_matrix_json target for CI matrix generation.
  • Enforces presence of .buildnumber during zip_dependencies and includes it in the packaged zip.
  • Adds a validation script/target to prevent app list duplication and hardcoded-target conflicts.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
Makefile Adds app category lists, dynamic build targets, CI matrix JSON generation, .buildnumber guard, and validation target.
scripts/validate_app_list_uniqueness.sh New validation script to check cross-list uniqueness and hardcoded target conflicts.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/validate_app_list_uniqueness.sh
Comment thread scripts/validate_app_list_uniqueness.sh Outdated
Comment thread scripts/validate_app_list_uniqueness.sh Outdated
Comment thread Makefile Outdated
Comment thread Makefile Outdated
@printminion-co printminion-co force-pushed the mk/dev/cached-matrix-build branch from f0aa8b1 to 8d59541 Compare May 11, 2026 14:07
@printminion-co printminion-co added this to the web-5 milestone May 11, 2026
@printminion-co printminion-co force-pushed the mk/dev/cached-matrix-build branch from 8d59541 to c5d0048 Compare May 11, 2026 15:56
@printminion-co printminion-co requested a review from Copilot May 11, 2026 15:59

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Comment thread Makefile Outdated
Comment thread Makefile Outdated
Comment thread Makefile Outdated
Comment thread scripts/validate_app_list_uniqueness.sh
printminion-co added a commit that referenced this pull request May 12, 2026
Plain 'make build_css' inside the recipe is the wrong form for a
recursive build: it doesn't inherit the jobserver from the parent make
invocation, so when the Makefile is driven with 'make -j' (or from a
parent build that already holds jobserver tokens) the inner make
either prints 'warning: jobserver unavailable' or silently loses
parallel scheduling.

Replace it with $(MAKE), which GNU Make documents as the canonical
form for recursive invocations — it propagates MAKEFLAGS, jobserver
tokens, and triggers the recursive-make detection that prints
'make[1]: Entering directory ...' on entry.

Caught by GitHub Copilot in PR 109 review:
#109 (comment)
@printminion-co printminion-co force-pushed the mk/dev/cached-matrix-build branch from c5d0048 to 2e0d407 Compare May 12, 2026 08:29
@printminion-co printminion-co requested a review from Copilot May 12, 2026 09:33

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Comment thread scripts/validate_external_apps.sh
Comment thread scripts/validate_app_list_uniqueness.sh
Comment thread Makefile
Comment thread scripts/patch_shipped_json_add_shipped_apps.sh Outdated
printminion-co added a commit that referenced this pull request May 12, 2026
Plain 'make build_css' inside the recipe is the wrong form for a
recursive build: it doesn't inherit the jobserver from the parent make
invocation, so when the Makefile is driven with 'make -j' (or from a
parent build that already holds jobserver tokens) the inner make
either prints 'warning: jobserver unavailable' or silently loses
parallel scheduling.

Replace it with $(MAKE), which GNU Make documents as the canonical
form for recursive invocations — it propagates MAKEFLAGS, jobserver
tokens, and triggers the recursive-make detection that prints
'make[1]: Entering directory ...' on entry.

Caught by GitHub Copilot in PR 109 review:
#109 (comment)
@printminion-co printminion-co force-pushed the mk/dev/cached-matrix-build branch from d7d5dd3 to a962209 Compare May 12, 2026 14:17
printminion-co added a commit that referenced this pull request May 12, 2026
Plain 'make build_css' inside the recipe is the wrong form for a
recursive build: it doesn't inherit the jobserver from the parent make
invocation, so when the Makefile is driven with 'make -j' (or from a
parent build that already holds jobserver tokens) the inner make
either prints 'warning: jobserver unavailable' or silently loses
parallel scheduling.

Replace it with $(MAKE), which GNU Make documents as the canonical
form for recursive invocations — it propagates MAKEFLAGS, jobserver
tokens, and triggers the recursive-make detection that prints
'make[1]: Entering directory ...' on entry.

Caught by GitHub Copilot in PR 109 review:
#109 (comment)
@printminion-co printminion-co force-pushed the mk/dev/cached-matrix-build branch from a962209 to 58c35cd Compare May 12, 2026 14:20
printminion-co added a commit that referenced this pull request May 12, 2026
Plain 'make build_css' inside the recipe is the wrong form for a
recursive build: it doesn't inherit the jobserver from the parent make
invocation, so when the Makefile is driven with 'make -j' (or from a
parent build that already holds jobserver tokens) the inner make
either prints 'warning: jobserver unavailable' or silently loses
parallel scheduling.

Replace it with $(MAKE), which GNU Make documents as the canonical
form for recursive invocations — it propagates MAKEFLAGS, jobserver
tokens, and triggers the recursive-make detection that prints
'make[1]: Entering directory ...' on entry.

Caught by GitHub Copilot in PR 109 review:
#109 (comment)
@printminion-co printminion-co force-pushed the mk/dev/cached-matrix-build branch from 58c35cd to 862d29e Compare May 12, 2026 14:44
@printminion-co printminion-co requested a review from Copilot May 12, 2026 14:45

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Comment thread Makefile
Comment thread Makefile
Comment thread Makefile
Comment thread scripts/validate_external_apps.sh
printminion-co added a commit that referenced this pull request May 12, 2026
Plain 'make build_css' inside the recipe is the wrong form for a
recursive build: it doesn't inherit the jobserver from the parent make
invocation, so when the Makefile is driven with 'make -j' (or from a
parent build that already holds jobserver tokens) the inner make
either prints 'warning: jobserver unavailable' or silently loses
parallel scheduling.

Replace it with $(MAKE), which GNU Make documents as the canonical
form for recursive invocations — it propagates MAKEFLAGS, jobserver
tokens, and triggers the recursive-make detection that prints
'make[1]: Entering directory ...' on entry.

Caught by GitHub Copilot in PR 109 review:
#109 (comment)
@printminion-co printminion-co force-pushed the mk/dev/cached-matrix-build branch from 862d29e to 953e639 Compare May 12, 2026 15:01
@printminion-co printminion-co requested a review from Copilot May 12, 2026 15:07

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.

Comment thread scripts/validate_external_apps.sh
Comment thread scripts/validate_app_list_uniqueness.sh
Comment thread scripts/patch_shipped_json_add_shipped_apps.sh
Comment thread scripts/validate_app_list_uniqueness.sh
Comment thread Makefile
Comment thread scripts/validate_external_apps.sh
Adds the generate_apps_matrix_json target that emits the CI build matrix
from the canonical app-list variables, then refactors the target to use
the dynamic app-list pattern shared with the rest of the Makefile so the
matrix never drifts from the build inputs.
…mon vars

Replaces hand-written per-app build recipes with define macros:

- build_custom_npm_app / build_custom_composer_app / build_external_full_app
  generate dynamic %-suffix rules over CUSTOM_NPM_TARGETS,
  CUSTOM_COMPOSER_TARGETS and EXTERNAL_FULL_TARGETS.
- Verbose [i]/[✓] log output is wired into every recipe so the CI log
  reads consistently across categories.
- `make help` lists targets category-by-category and reflects the
  dynamic app set.
- build_nc_theming_app uses $(MAKE) for the recursive build so flags
  and jobserver state propagate.
Introduces the .precheck sentinel target that verifies preconditions
(IONOS-side inputs available, .buildnumber tracked in clean, build
completion summary printed) before any IO-side target runs, so a missing
.buildnumber or unfetched submodule fails fast with a clear message
instead of producing a half-built package.
Adds scripts/patch_shipped_json_add_shipped_apps.sh and wires it into a
two-phase patch_shipped_json target: phase 1 patches the bundled
shipped.json with apps under APP_FOLDERS_TO_SHIP, phase 2 layers in any
IONOS-specific overrides. Splitting the work keeps both phases scriptable
and lets CI verify the result between phases.
…ps.txt

Add a runtime-evaluated REMOVE_UNWANTED_APPS variable that reads
IONOS/removed-apps.txt (skipping comments and blanks) and prefixes each
entry with apps/. The result is fed to zip_dependencies via
$(foreach app,$(REMOVE_UNWANTED_APPS),-x "$(app)/*"), so removed
apps disappear from the final package without editing the Makefile.

removed-apps.txt is created empty (header comment only) so the foreach
expands to nothing today.
…age_after_build

Two new targets for staged CI pipelines that build external apps in a
separate job:

  build_after_external_apps : build_nextcloud + add_config_partials
                              (runs after the external-apps matrix
                              finishes — does NOT rebuild them)
  package_after_build       : alias for zip_dependencies, named to make
                              the pipeline stage intent obvious

The existing build_release / build_locally aggregates are unchanged.
…pps + validate_all umbrella

Adds two validation scripts and Makefile wiring:

- scripts/validate_app_list_uniqueness.sh — fails the build if an app
  appears in more than one category list (e.g., both custom and
  external), since duplicates break the matrix generator.
- scripts/validate_external_apps.sh — verifies every entry in
  EXTERNAL_FULL_TARGETS actually exists under apps-external/ with a
  buildable appinfo, catching submodule drift.
- validate_all — umbrella target that runs both, plus a final
  '[i] Package … created successfully' line in zip_dependencies so the
  CI log clearly marks the end of packaging.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

@printminion-co printminion-co merged commit 7ec41e4 into master May 19, 2026
16 checks passed
@printminion-co printminion-co deleted the mk/dev/cached-matrix-build branch May 19, 2026 09:48
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.

3 participants