PMM-13776 Create a pmm-ui package to cache its artifacts#5679
PMM-13776 Create a pmm-ui package to cache its artifacts#5679ademidoff wants to merge 9 commits into
Conversation
The PMM UI was built inside pmm-managed.spec and had no package name, so its S3 build cache key tracked the pmm HEAD commit and was rebuilt on every push. Split the UI into its own pmm-ui RPM package and derive its cache key from the last commit that touched ui/ (git log -1 -- ui), so it is rebuilt only when the branch actually differs from its base in the UI sources. - Add build/packages/rpm/server/SPECS/pmm-ui.spec building both the pmm app (/usr/share/pmm-ui) and the pmm-compat Grafana panel (/usr/share/percona-dashboards/panels/pmm-compat-app) - Drop the UI build/install/files from pmm-managed.spec, bump its release - build-server-rpm: optional 3rd arg scopes the package commit (cache key and source archive) to a git path, falling back to HEAD - Register pmm-ui in build-server-rpm-all and install it in the pmm-images ansible role
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5679 +/- ##
==========================================
+ Coverage 43.59% 45.14% +1.55%
==========================================
Files 415 418 +3
Lines 43134 43315 +181
==========================================
+ Hits 18804 19555 +751
+ Misses 22454 21822 -632
- Partials 1876 1938 +62
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Extend the path-scoped cache key to percona-dashboards so it is rebuilt only when its sources change, saving CI time on unrelated pushes. Scope each package to its source dir plus its spec file, because the spec pins inputs that are not in the source tree (percona-dashboards pins the ClickHouse datasource and polystat panel plugin versions). Without the spec in the scope, a plugin version bump would reuse a stale cached artifact. - build-server-rpm: allow the git-path arg to hold several space-separated pathspecs - build-server-rpm-all: scope percona-dashboards to "dashboards <its spec>" and pmm-ui to "ui <its spec>"
There was a problem hiding this comment.
Pull request overview
This PR splits the PMM UI build/install out of pmm-managed into a dedicated pmm-ui RPM, and updates the RPM build scripts so the S3 build-cache key can be scoped to changes under specific git paths (e.g., ui/) rather than always tracking repo HEAD.
Changes:
- Added a new
pmm-uiRPM spec that builds UI artifacts viamake -C ui releaseand installs them into the runtime-expected locations. - Updated
pmm-managed.specto remove UI build/install steps and bump the release with a changelog entry. - Enhanced the RPM build scripts to optionally derive the
%global commit(and thus the cache key/source archive) from the last commit that touched a provided git pathspec; wired this up forpercona-dashboardsand the newpmm-ui, and addedpmm-uito the image build install list.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| ui/LICENSE | Adds an Apache-2.0 license file for the UI subtree, used by the new pmm-ui RPM %license. |
| build/scripts/build-server-rpm-all | Registers pmm-ui build and scopes cache keys for percona-dashboards and pmm-ui to path-based git history. |
| build/scripts/build-server-rpm | Adds optional path-scoped git commit selection for cache keys/source archives; passes through the optional arg to prepare_specs. |
| build/packages/rpm/server/SPECS/pmm-ui.spec | New RPM spec to build/install pmm UI and pmm-compat panel plugin artifacts. |
| build/packages/rpm/server/SPECS/pmm-managed.spec | Removes UI build/install/file ownership from pmm-managed and bumps release/changelog. |
| build/ansible/roles/pmm-images/tasks/main.yml | Ensures pmm-ui is installed in built images. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| %define build_timestamp %(date -u +"%y%m%d%H%M") | ||
| %define release 20 | ||
| %define release 21 | ||
| %define rpm_release %{release}.%{build_timestamp}.%{shortcommit}%{?dist} |
| License: Apache-2.0 | ||
| URL: https://%{provider} | ||
| Source0: https://%{provider}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz | ||
|
|
PMM-13776
SUBMODULES-4490
Problem
The PMM UI was built inside
build/packages/rpm/server/SPECS/pmm-managed.specand had no package name of its own. Its S3 build-cache key therefore tracked the pmm repoHEADcommit, so the UI was rebuilt on every push even when nothing underui/changed.Solution
Split the UI into its own
pmm-uiRPM package and make its cache key track only UI changes, using native git.build/packages/rpm/server/SPECS/pmm-ui.spec— runsmake -C ui release(turbo builds both apps) and installs to the same paths the runtime already expects:ui/apps/pmm/dist→/usr/share/pmm-ui(served by nginx)ui/apps/pmm-compat/dist→/usr/share/percona-dashboards/panels/pmm-compat-app(Grafana panel plugin)build/packages/rpm/server/SPECS/pmm-managed.spec— dropped the UI build/install/files; bumped%define release20→21 with a changelog entry.build/scripts/build-server-rpm—prepare_specs/buildtake an optional 3rd arg (a git path). When set, the package's%global commit(which feeds both the S3 cache key and the source archive) is derived fromgit log -1 --format=%H -- <path>instead ofHEAD, with aHEADfallback. So the key stays constant across pushes that don't touch the path — the package is rebuilt only when the branch actually differs from its base in that path.build/scripts/build-server-rpm-all— registersbuild-server-rpm pmm-ui pmm ui.build/ansible/roles/pmm-images/tasks/main.yml— installspmm-ui.The dual ownership of
/usr/share/percona-dashboards/...betweenpmm-uiandpercona-dashboardsmirrors the arrangementpmm-managedpreviously had, so there's no new RPM conflict.Testing
Verified locally:
bash -non the changed scripts,shellcheck(no new warnings), and thegit log -1 --format=%H -- uipath-scoping on the repo. Full RPM build /rpmspecparsing is delegated to CI (needs the pmm-submodules workspace layout, the rpmbuild image, and S3).