Skip to content

fix(ui): Provide prebuilt UI assets in release#5191

Merged
SoloJacobs merged 1 commit intoprometheus:mainfrom
SoloJacobs:package-ui-assets
Apr 26, 2026
Merged

fix(ui): Provide prebuilt UI assets in release#5191
SoloJacobs merged 1 commit intoprometheus:mainfrom
SoloJacobs:package-ui-assets

Conversation

@SoloJacobs
Copy link
Copy Markdown
Contributor

@SoloJacobs SoloJacobs commented Apr 25, 2026

In #5113 I removed the build artifacts from our source repo. This complicated the packaging process for downstream maintainers significantly.

We will still not check the artifacts into our repo directly, since this is a burden to the review process and opens us up to attacks such as the https://en.wikipedia.org/wiki/XZ_Utils_backdoor .

Instead we provide two new mechanisms to obtain the artifacts:

  • alertmanager-web-ui-(file <VERSION).tar.gz will provide the dist folder needed for calling make build.
  • We will upload artifacts via actions/upload-artifact. These can then be easily retrieved for 90 days using gh.

Finally, this commit also ensures that ui/app/dist is always available during build steps. The reason is that caching npm dependencies is not sufficient: Elm will download its files again anyway, since it stores them in ~/.elm. This causes unnecessary network calls.

Technical approach:

  • By moving the validation .build_stamp to dist/, we don't have to upload that file seperately. embed will exclude that file.
  • Storing artifacts in .tarballs is our method for including files in the release. This approach was directly taken from prometheus/prometheus.

Pull Request Checklist

FIX: Provide prebuilt UI assets in release via alertmanager-web-ui-(file <VERSION).tar.gz

Summary by CodeRabbit

  • Chores
    • CI now builds and uploads a reusable frontend distribution artifact used by test, build, and release jobs instead of relying on npm cache.
    • Release workflow downloads and reuses the frontend artifact prior to packaging.
    • Added a Makefile target to produce versioned frontend tarballs for distribution.
    • Frontend build recipes and clean steps updated to track builds reliably and avoid stale artifacts.

@SoloJacobs SoloJacobs requested a review from a team as a code owner April 25, 2026 16:16
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 25, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: ddf4f25e-0700-4055-bc3f-302dc4f46826

📥 Commits

Reviewing files that changed from the base of the PR and between 10707a5 and 475b1f2.

📒 Files selected for processing (4)
  • .github/workflows/ci.yml
  • .github/workflows/release.yml
  • Makefile
  • ui/app/Makefile
✅ Files skipped from review due to trivial changes (1)
  • .github/workflows/release.yml
🚧 Files skipped from review as they are similar to previous changes (1)
  • Makefile

📝 Walkthrough

Walkthrough

CI and Makefile changes add building and packaging of prebuilt frontend assets. The frontend test job generates a tarball and uploads ui/app/dist as a ui-dist artifact; build, test, and release jobs download and extract that artifact before their steps. Frontend Makefile and top-level Makefile add/adjust targets and stamp behavior.

Changes

Cohort / File(s) Summary
CI Workflows
.github/workflows/ci.yml, .github/workflows/release.yml
test_frontend now produces an assets tarball and uploads ui/app/dist as ui-dist. build/test jobs (and release build) download and extract ui-dist before build/test steps. Removed npm cache action in test in favor of artifact download.
Top-level Makefile
Makefile
Adds .PHONY: assets-tarball and assets-tarball target to create alertmanager-web-ui-<VERSION>.tar.gz under .tarballs.
Frontend Makefile
ui/app/Makefile
build now depends on package-lock.json, runs $(MAKE) node_modules then npm run build, and writes dist/.build_stamp. clean removes node_modules (stops removing root .build_stamp). OpenAPI formatting invokes $(MAKE) format.

Sequence Diagram

sequenceDiagram
    participant CI as CI System
    participant ArtifactStore as Artifact Storage
    participant Build as Build Job
    participant Test as Test Job
    participant Release as Release Job

    CI->>CI: test_frontend: run frontend build
    CI->>CI: test_frontend: make assets-tarball (creates .tar.gz)
    CI->>ArtifactStore: upload `ui-dist` (contents of ui/app/dist)

    Build->>ArtifactStore: download `ui-dist`
    Build->>Build: extract -> ui/app/dist
    Build->>Build: continue build (promci / package)

    Test->>ArtifactStore: download `ui-dist`
    Test->>Test: extract -> ui/app/dist
    Test->>Test: run tests

    Release->>ArtifactStore: download `ui-dist`
    Release->>Release: extract -> ui/app/dist
    Release->>Release: build release artifacts
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • TheMeier
  • sysadmind
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix(ui): Provide prebuilt UI assets in release' clearly and specifically describes the main change—adding release distribution of prebuilt UI assets.
Description check ✅ Passed The description thoroughly explains the motivation, technical approach, and design decisions, includes linked issues (#5173, #5163), and provides release notes as required by the template.
Linked Issues check ✅ Passed The PR successfully implements all coding objectives from #5163: tarball distribution mechanism, artifact upload via actions, prebuilt assets in ui/app/dist, and .build_stamp relocation.
Out of Scope Changes check ✅ Passed All changes are scoped to the linked objectives: CI/CD workflow updates for artifact handling, Makefile targets for tarball generation, and frontend build process adjustments—no extraneous modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@Makefile`:
- Around line 41-44: The assets-tarball recipe currently creates an uncompressed
".tar" via "tar cf" and misnames the artifact; update the assets-tarball target
to create a compressed gzip archive named ".tar.gz" by using gzip compression
with tar (i.e., replace the tar invocation that uses "tar cf" and outputs ".tar"
with a gzip-producing command such as "tar czf" and change the output filename
to ".tar.gz" so the produced artifact matches the documented
alertmanager-web-ui-<VERSION>.tar.gz; keep the same VERSION expansion ($(file
<VERSION)) and the -C ui/app dist context.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 3e8d31b2-abb6-46a6-aa96-72d57a0aaeca

📥 Commits

Reviewing files that changed from the base of the PR and between c769adc and 10707a5.

📒 Files selected for processing (4)
  • .github/workflows/ci.yml
  • .github/workflows/release.yml
  • Makefile
  • ui/app/Makefile

Comment thread Makefile Outdated
In prometheus#5113 I removed the
build artifacts from our source repo. This complicated the packaging
process for downstream maintainers significantly.

We will still not check the artifacts into our repo directly, since this
is a burden to the review process and opens us up to attacks such as the
https://en.wikipedia.org/wiki/XZ_Utils_backdoor .

Instead we provide two new mechanisms to obtain the artifacts:

* alertmanager-web-ui-(file <VERSION).tar.gz will provide the `dist`
folder needed for calling `make build`.
* We will upload artifacts via actions/upload-artifact. These can then
be easily retrieved for 90 days using `gh`.

Finally, this commit also ensures that `ui/app/dist` is always available
during build steps. The reason is that caching `npm` dependencies is not
sufficient: `Elm` will download its files again anyway, since it stores
them in `~/.elm`. This causes unnecessary network calls.

Technical approach:

* By moving the validation `.build_stamp` to `dist/`, we don't have to
upload that file seperately. `embed` will exclude that file.
* Storing artifacts in `.tarballs` is our method for including files in
the release. This approach was directly taken from
`prometheus/prometheus`.

Relates-to: prometheus#5173
Fixes: prometheus#5163
Signed-off-by: Solomon Jacobs <solomonjacobs@protonmail.com>
@SoloJacobs
Copy link
Copy Markdown
Contributor Author

Note: I plan to port this into 0.32 branch .

Copy link
Copy Markdown
Contributor

@Spaceman1701 Spaceman1701 left a comment

Choose a reason for hiding this comment

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

Lgtm

@SoloJacobs SoloJacobs merged commit 3cbc006 into prometheus:main Apr 26, 2026
9 checks passed
SoloJacobs added a commit that referenced this pull request Apr 28, 2026
In #5113 I removed the
build artifacts from our source repo. This complicated the packaging
process for downstream maintainers significantly.

We will still not check the artifacts into our repo directly, since this
is a burden to the review process and opens us up to attacks such as the
https://en.wikipedia.org/wiki/XZ_Utils_backdoor .

Instead we provide two new mechanisms to obtain the artifacts:

* alertmanager-web-ui-(file <VERSION).tar.gz will provide the `dist`
folder needed for calling `make build`.
* We will upload artifacts via actions/upload-artifact. These can then
be easily retrieved for 90 days using `gh`.

Finally, this commit also ensures that `ui/app/dist` is always available
during build steps. The reason is that caching `npm` dependencies is not
sufficient: `Elm` will download its files again anyway, since it stores
them in `~/.elm`. This causes unnecessary network calls.

Technical approach:

* By moving the validation `.build_stamp` to `dist/`, we don't have to
upload that file seperately. `embed` will exclude that file.
* Storing artifacts in `.tarballs` is our method for including files in
the release. This approach was directly taken from
`prometheus/prometheus`.

Relates-to: #5173
Fixes: #5163

Signed-off-by: Solomon Jacobs <solomonjacobs@protonmail.com>
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.

Include prebuilt UI assets (or tarball) in release artifacts

2 participants