Skip to content

PMM-13776 Create a pmm-ui package to cache its artifacts#5679

Open
ademidoff wants to merge 9 commits into
mainfrom
PMM-13776-create-pmm-ui-package
Open

PMM-13776 Create a pmm-ui package to cache its artifacts#5679
ademidoff wants to merge 9 commits into
mainfrom
PMM-13776-create-pmm-ui-package

Conversation

@ademidoff

@ademidoff ademidoff commented Jul 21, 2026

Copy link
Copy Markdown
Member

PMM-13776

SUBMODULES-4490

Problem

The PMM UI was built inside build/packages/rpm/server/SPECS/pmm-managed.spec and had no package name of its own. Its S3 build-cache key therefore tracked the pmm repo HEAD commit, so the UI was rebuilt on every push even when nothing under ui/ changed.

Solution

Split the UI into its own pmm-ui RPM package and make its cache key track only UI changes, using native git.

  • New build/packages/rpm/server/SPECS/pmm-ui.spec — runs make -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 release 20→21 with a changelog entry.
  • build/scripts/build-server-rpmprepare_specs/build take 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 from git log -1 --format=%H -- <path> instead of HEAD, with a HEAD fallback. 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 — registers build-server-rpm pmm-ui pmm ui.
  • build/ansible/roles/pmm-images/tasks/main.yml — installs pmm-ui.

The dual ownership of /usr/share/percona-dashboards/... between pmm-ui and percona-dashboards mirrors the arrangement pmm-managed previously had, so there's no new RPM conflict.

Testing

Verified locally: bash -n on the changed scripts, shellcheck (no new warnings), and the git log -1 --format=%H -- ui path-scoping on the repo. Full RPM build / rpmspec parsing is delegated to CI (needs the pmm-submodules workspace layout, the rpmbuild image, and S3).

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
@ademidoff
ademidoff requested a review from a team as a code owner July 21, 2026 23:23
@ademidoff
ademidoff requested review from 4nte and maxkondr and removed request for a team July 21, 2026 23:23
@codecov

codecov Bot commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 45.14%. Comparing base (31318c7) to head (52e41a2).
⚠️ Report is 65 commits behind head on main.

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     
Flag Coverage Δ
admin 34.94% <ø> (+0.15%) ⬆️
agent 50.17% <ø> (+1.13%) ⬆️
managed 44.90% <ø> (+1.92%) ⬆️
vmproxy 72.22% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

ademidoff and others added 3 commits July 22, 2026 13:30
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>"
@ademidoff
ademidoff requested a review from a team as a code owner July 22, 2026 11:10
@ademidoff
ademidoff requested review from fabio-silva and mattiasimonato and removed request for a team July 22, 2026 11:10
@ademidoff
ademidoff requested a review from talhabinrizwan July 22, 2026 11:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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-ui RPM spec that builds UI artifacts via make -C ui release and installs them into the runtime-expected locations.
  • Updated pmm-managed.spec to 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 for percona-dashboards and the new pmm-ui, and added pmm-ui to 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.

Comment on lines 8 to 10
%define build_timestamp %(date -u +"%y%m%d%H%M")
%define release 20
%define release 21
%define rpm_release %{release}.%{build_timestamp}.%{shortcommit}%{?dist}
Comment on lines +16 to +19
License: Apache-2.0
URL: https://%{provider}
Source0: https://%{provider}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz

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.

4 participants