Commit graph

189 commits

Author SHA1 Message Date
Julien 9126bbbed0 makefile: Add support for skipping UI build when prebuilt assets are provided
This commit introduces the ability to skip the UI build in the Makefile by
providing prebuilt UI assets, addressing the needs of users who may not have npm
installed or who do not want to go through the front-end build process.

To achieve this, we added the `PREBUILT_ASSETS_STATIC_DIR` environment variable.
If this variable is set, the Makefile will skip the UI build and related tasks,
such as bundling npm licenses. Instead, it will use the prebuilt assets from
the specified directory.

We already publish prebuilt UI assets as part of our release artifacts
(e.g., `prometheus-web-ui-3.0.0-beta.0.tar.gz`). Users can download this tarball,
extract it, and point the `PREBUILT_ASSETS_STATIC_DIR` to the extracted folder.
This reduces build complexity, especially for users who don't have a development
environment for front-end builds.

For example, you can use the command:
`make PREBUILT_ASSETS_STATIC_DIR=static build`
where `static` refers to the directory containing the prebuilt UI files.
This change simplifies the build process while still allowing users to use a
prebuilt UI if desired.

This solution is particularly useful for users who don't need to modify the UI
and prefer to use the prebuilt version that we provide with each release.

Signed-off-by: Julien <roidelapluie@o11y.eu>
2024-09-12 12:20:24 +02:00
Fiona Liao a2bf2bf4ef Change npm deps to 0.3xx
Signed-off-by: Fiona Liao <fiona.liao@grafana.com>
2024-09-10 10:16:45 +01:00
Julius Volz edf31da311 Merge branch 'main' into mantine-ui
Signed-off-by: Julius Volz <julius.volz@gmail.com>
2024-07-15 14:11:48 +02:00
Łukasz Mierzwa dbd29df5df
Fix @goyacc invocation (#14324)
goyacc is installed using 'install-goyacc' and ends up in GOPATH/bin.
GOPATH isn't usually part of standard PATH, so when make tries to run goyacc it fails, unless PATH includes GOPATH/bin.
Other Go tools, like golangci-lint, are also installed via go install into GOPATH/bin but they run correctly because make invocations for them use FIRST_GOPATH viriable to use full path.
Call goyacc using FIRST_GOPATH/bin as well so it works without GOPATH being included in PATH.

Signed-off-by: Lukasz Mierzwa <lukasz@cloudflare.com>
2024-06-20 18:25:44 +01:00
György Krajcsovits 965f507db5 ci: check generated parser code before running unit tests
Check that the generated parser code is consistent with the input definition.

Remove the file before re-generating to make sure that missing goyacc is
not effecting the check.

Fixes: #7488

Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
2024-04-30 17:58:15 +02:00
Julius Volz 5827772f69 Merge branch 'main' into mantine-ui
Signed-off-by: Julius Volz <julius.volz@gmail.com>
2024-04-19 14:03:25 +02:00
Julius Volz e8bbe191d4 Build both old & new UI into Prometheus, allow choosing via feature flag
This keeps the old "react-app" directory in its existing location (to make
it easier to merge changes from the main branch), but separates it from the
npm workspaces setup. Thus it now needs to be npm-installed/built/linted
separately. This is a bit hacky, but should only be needed temporarily,
until the old UI can be removed.

Signed-off-by: Julius Volz <julius.volz@gmail.com>
2024-04-18 15:08:40 +02:00
Owen Williams 4a6f8704ef
parser: remake generated_parser output (#13923)
In a previous PR, the generated parser was created using an old version of goyacc.

Also adds -l to disable line directives, which fixes debug processing and reduces diffs at the expense of making it more difficult to reason about the generated output.

Signed-off-by: Owen Williams <owen.williams@grafana.com>
2024-04-13 12:59:54 +02:00
heyitao d9e4353520 Fix binary detection in Makefile
Signed-off-by: heyitao <heyitao@uniontech.com>
2024-03-21 11:32:23 +08:00
Bartlomiej Plotka f9ecc0d5b5
Updated main and example Go dependencies. (#13255)
Pre step for 2.49-rc.0

Added cmd for documentation module update due to https://github.com/prometheus/prometheus/security/dependabot/92 & other similar alerts.

Signed-off-by: bwplotka <bwplotka@gmail.com>
2023-12-07 15:56:30 +00:00
SuperQ bf2b1ac115
Add test of Go module versions
Make sure that the Go versions in all `go.mod` files are in sync.

Signed-off-by: SuperQ <superq@gmail.com>
2023-12-07 14:44:49 +01:00
Bartol Deak 95b7d592ba
rewrite which with command -v
Signed-off-by: Bartol Deak <b@bdeak.net>
2023-06-13 11:59:17 +02:00
Bartol Deak 06843db80a
Hide which stderr output
Signed-off-by: Bartol Deak <b@bdeak.net>
2023-06-12 23:00:04 +02:00
Julien Pivotto 1922db0586 Document command line tools
Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2023-03-13 14:20:55 +01:00
Harold Dost ba1918b6d3 promql: Add a Makefile target for goyacc
* Add documentation for goyacc as relevant
* Ignore the y.output since it's not needed for build process.

Signed-off-by: Harold Dost <h.dost@criteo.com>
2023-03-06 11:01:23 +01:00
Julien Pivotto 29707b1569 Makefile: Avoid the use of --transform for tar
This makes it compatible with macos tar as well

Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2022-12-14 16:35:13 +01:00
Julien Pivotto 23f87b3278 Makefile: Fix targets order
Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2022-11-15 09:11:11 +01:00
Augustin Husson 7b006e804c
enable ui module publication (#10876)
* enable ui module publication

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>

* use main changelog of Prometheus to reflect the changes of the packages

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>

* ignore changelog and license in the libs

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>

* replace perses references

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
2022-06-30 12:10:10 +02:00
Augustin Husson 5d1756c822
Upgrade codemirror and lezer to the latest version (#10841)
* bump codemirror to v0.20.x and lezer to v.0.16.x

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>

* bump codemirror to v6 and lezer to v1

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>

* stop treating warning as error for UI

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
2022-06-13 17:55:06 +02:00
Julien Pivotto 685ce9964d
Merge pull request #10599 from prometheus/release-2.35
Merge back release 2.35
2022-04-15 00:10:06 +02:00
Julien Pivotto dc8b673299
Build the UI when making UI tarball (#10578)
We run ui-install on ci but not ui-build. This PR resolves that.

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2022-04-12 19:22:51 +01:00
Luke Chen 6555cc68ca
Make the make build depends on npm_licenses task (#7843)
Signed-off-by: Luke Chen <showuon@gmail.com>
2022-04-08 13:47:59 +02:00
Julien Pivotto a236166c71
Store compiled web ui in CI (#10546)
Some downstream distros fail to compile Prometheus UI (Debian, NixOS).

This is an attempt to store compiled UI in circleci for them to consume
it. Currently we do not expose this outside of circleci.

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>

Co-authored-by: Julien Pivotto <roidelapluie@o11y.eu>
2022-04-06 20:23:55 +02:00
Augustin Husson 043a2954f8
UI: stabilize dependencies and environment (#10517)
* create lezer-promql module + move codemirror to a pure esm module + unified dependencies

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>

* ignore test utils file and remove the type "module" in package.json

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>

* use jest to run the lezer-promql test

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>

* give an automatic way to update the ui dependencies

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>

* update all dependencies using make update-npm-deps

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>

* fix react-app test

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>

* remove generated file

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>

* remove unnecessary backslash in script

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>

* fix reviews

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>

* rewording

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>

* use npx to run lezer-generator

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
2022-04-05 11:49:22 +02:00
Julien Pivotto f9d8e5245a
Plugins support (#10495)
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2022-03-29 14:44:39 +02:00
Julien Pivotto c901ebaf8d
ui/compress: Do not change git worktree (#10467)
This change makes sure that the git worktree is not changed while
compressing assets, making it better for local development.

To achieve this, the compression script keeps the un-compressed assets
and generates the go:embed directory when compressing the files.

A .gitignore file has been added to ignore generated files.

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2022-03-20 15:08:32 +01:00
Łukasz Mierzwa fdb6916baf
Set CI=true when running UI tests (#10394)
At the moment when I run make to build Prometheus npm tests are run as part of the process.
By default jest will run in interactive mode, unless CI env variable is set, meaning that it will run forever watching for file changes. This means that to build the binary I need to wait for jest to start and then press Q to exit it, which seems unnecessary.
Set CI=true for npm scripts so it always run in as a single run instead of watch mode.

Signed-off-by: Łukasz Mierzwa <l.mierzwa@gmail.com>
2022-03-09 19:15:04 +01:00
Jan Fajerski 2c3d45c88a
Replace vfsgen with embed for static web assets (#10220)
* remove vfsgen usages

Signed-off-by: Jan Fajerski <jfajersk@redhat.com>

* web: use embed package for static assets

This requires go 1.16.

Signed-off-by: Jan Fajerski <jfajersk@redhat.com>

* circleci: drop go generate in web/ui

Signed-off-by: Jan Fajerski <jfajersk@redhat.com>

* Makefile: compress web assets before build

This commit add compression before (and decompression after) prometheus
is build. This ensures that gzipped assets are embeded in the prometheus
binary, if the builtinassets build tag is passed. If the build tag is
not passed this step is still executed but has no effect.
All this is executed in a subshell so that we can run the decompress
step even if the build step fails, but retain the exit code of promu.
This cleanup could also cover interrupts, but I left that out for now.

Signed-off-by: Jan Fajerski <jfajersk@redhat.com>
2022-03-09 10:21:31 +01:00
Julien Pivotto b48a1e9e9b
Revert "Replace vfsgen with embed for static web assets (#9719)" (#9870)
This reverts commit ddaddc2a7a.
2021-11-26 10:11:26 +01:00
Jan Fajerski ddaddc2a7a
Replace vfsgen with embed for static web assets (#9719)
* remove vfsgen usages

Signed-off-by: Jan Fajerski <jfajersk@redhat.com>

* web: use embed package for static assets

This requires go 1.16.

Signed-off-by: Jan Fajerski <jfajersk@redhat.com>

* circleci: drop go generate in web/ui

Signed-off-by: Jan Fajerski <jfajersk@redhat.com>

* Makefile: compress web assets before build

This commit add compression before (and decompression after) prometheus
is build. This ensures that gzipped assets are embeded in the prometheus
binary, if the builtinassets build tag is passed. If the build tag is
not passed this step is still executed but has no effect.
All this is executed in a subshell so that we can run the decompress
step even if the build step fails, but retain the exit code of promu.
This cleanup could also cover interrupts, but I left that out for now.

Signed-off-by: Jan Fajerski <jfajersk@redhat.com>

* [FIXME]: add new module dependency on common/assets and temp replace

Signed-off-by: Jan Fajerski <jfajersk@redhat.com>
2021-11-25 15:04:51 +01:00
Mateusz Gozdek e235b499b0 Makefile: consistently re-use UI_PATH variable
Signed-off-by: Mateusz Gozdek <mgozdekof@gmail.com>
2021-11-11 01:37:24 +01:00
Augustin Husson 1e6bd815ad fix license tarball
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
2021-09-10 17:38:53 +02:00
Augustin Husson 27aec91914 review the UI ci and associated command
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
2021-09-10 17:18:25 +02:00
Augustin Husson 54dfee02b2
move codemirror-promql as a prometheus web module (#9188)
* move codemirror-promql as a prometheus web module

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>

* remove unecessary file for the codemirror module

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>

* change license for Apache

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>

* fix codemirror build

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
2021-08-20 11:39:07 +02:00
Augustin Husson 7291563d4d
replace yarn by npm (#9198)
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
2021-08-12 20:25:26 +02:00
Levi Harrison 44e2834960
Split Go and React Tests (#8897)
* Added go-ci and react-ci

Co-authored-by: Julien Pivotto <roidelapluie@inuits.eu>
Signed-off-by: Levi Harrison <git@leviharrison.dev>
2021-08-10 16:50:09 +02:00
Michal Wasilewski 46153083db
increase golang ci lint timeout
Signed-off-by: Michal Wasilewski <mwasilewski@gmx.com>
2021-06-12 11:43:34 +02:00
Taishi Matsumoto 89e9632a34
Increase golint timeout 1m -> 2m (#8469)
* Increase golint timeout 1m -> 2m

Signed-off-by: w1mvy <w1mvypine@gmail.com>
2021-02-10 14:02:26 +01:00
Julius Volz 3470ee1fbf
Make React UI the default, keep old UI under /classic (#8142)
The React app's assets are now served under /assets, while all old
custom web assets (including the ones for console templates) are now
served from /classic/static.

I tested different combinations of --web.external-url and
--web.route-prefix with proxies in front, and I couldn't find a problem
yet with the routing. Console templates also still work.

While migrating old endpoints to /classic, I noticed that /version was
being treated like a lot of the old UI pages, with readiness check
handler in front of it, etc. I kept it in /version and removed that
readiness wrapper, since it doesn't seem to be needed for that endpoint.

Signed-off-by: Julius Volz <julius.volz@gmail.com>
2020-11-03 14:51:48 +01:00
Ben Kochie 889f4eb91e
Merge pull request #7067 from carlosedp/ppc64le
Add image build for ppc64le architecture
2020-08-05 18:16:59 +02:00
Ben Ye 50c261502e
add tsdb cmds into promtool (#6088)
Signed-off-by: yeya24 <yb532204897@gmail.com>

update tsdb cli in makefile and promu

Signed-off-by: yeya24 <yb532204897@gmail.com>

remove building tsdb bin

Signed-off-by: yeya24 <yb532204897@gmail.com>

remove useless func

Signed-off-by: yeya24 <yb532204897@gmail.com>

refactor analyzeBlock

Signed-off-by: yeya24 <yb532204897@gmail.com>

Fix Makefile

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2020-07-23 19:35:50 +01:00
Carlos de Paula 79a732203d Add image build for ppc64le architecture
Signed-off-by: Carlos de Paula <me@carlosedp.com>
2020-04-06 18:03:58 -03:00
Simon Pasquier 3297ae2169 Revert "Add armv6 docker image (#6605)"
This reverts commit 6ba8565619.

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2020-02-05 14:13:14 +01:00
Mark Hansen 6ba8565619
Add armv6 docker image (#6605)
This follows the approach used to generate armv7 images.

It was all so nicely factored already that I just had to update two
parts of the code.

Signed-off-by: Mark Hansen <mark@markhansen.co.nz>
2020-02-05 09:16:52 +01:00
vitt-bagal e3239c1093 Added support for s390x image (#6486)
Signed-off-by: Vitthal Bagal <vitthalb@us.ibm.com>
2020-01-13 14:54:07 +01:00
Josh Soref 91d76c8023 Spelling (#6517)
* spelling: alertmanager

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: attributes

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: autocomplete

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: bootstrap

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: caught

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: chunkenc

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: compaction

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: corrupted

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: deletable

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: expected

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: fine-grained

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: initialized

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: iteration

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: javascript

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: multiple

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: number

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: overlapping

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: possible

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: postings

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: procedure

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: programmatic

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: queuing

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: querier

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: repairing

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: received

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: reproducible

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: retention

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: sample

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: segements

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: semantic

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: software [LICENSE]

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: staging

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: timestamp

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: unfortunately

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: uvarint

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: subsequently

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: ressamples

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2020-01-02 15:54:09 +01:00
Simon Pasquier f174ae1f09 Revert "Added s390x support for docker image (#6307)" (#6478)
This reverts commit f9bf8e4e4c.

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-12-18 13:31:42 +00:00
vitt-bagal f9bf8e4e4c Added s390x support for docker image (#6307)
Signed-off-by: Vitthal Bagal <vitthalb@us.ibm.com>
2019-12-18 11:21:03 +01:00
Dustin Hooten e0443e6fa3 Add unit tests for react-app (#6234)
* Add MetricFormat unit tests

Signed-off-by: Dustin Hooten <dhooten@splunk.com>

* Add App unit tests; Add debug script

Signed-off-by: Dustin Hooten <dhooten@splunk.com>

* Add Checkbox unit tests

Signed-off-by: Dustin Hooten <dhooten@splunk.com>

* Add SeriesName unit tests

Signed-off-by: Dustin Hooten <dhooten@splunk.com>

* Add QueryStatsView unit test

Signed-off-by: Dustin Hooten <dhooten@splunk.com>

* Add Legend unit tests

Signed-off-by: Dustin Hooten <dhooten@splunk.com>

* Remove unused utils/func

Signed-off-by: Dustin Hooten <dhooten@splunk.com>

* Add utils/urlParams unit test

Signed-off-by: Dustin Hooten <dhooten@splunk.com>

* Add utils/timeFormat unit test

Signed-off-by: Dustin Hooten <dhooten@splunk.com>

* Add ExpressionInput unit tests

Signed-off-by: Dustin Hooten <dhooten@splunk.com>

* Add GraphControls unit test

Signed-off-by: Dustin Hooten <dhooten@splunk.com>

* Add TimeInput unit test

Signed-off-by: Dustin Hooten <dhooten@splunk.com>

* Add DataTable unit test

Signed-off-by: Dustin Hooten <dhooten@splunk.com>

* Add SanitizeHTML unit test

Signed-off-by: Dustin Hooten <dhooten@splunk.com>

* Add Graph unit test

Signed-off-by: Dustin Hooten <dhooten@splunk.com>

* Extract utils/html

Signed-off-by: Dustin Hooten <dhooten@splunk.com>

* Add PanelList unit test

Signed-off-by: Dustin Hooten <dhooten@splunk.com>

* Add Panel unit test

Signed-off-by: Dustin Hooten <dhooten@splunk.com>

* Add react-ui test coverage report to CI

Signed-off-by: Dustin Hooten <dhooten@splunk.com>
2019-10-28 18:09:48 +01:00
CSTDev 3b39f6ae45 WIP: React UI Linting rules (#6206)
* Initial react-ui linting rules

Signed-off-by: cstdev <pietomb00@hotmail.com>

* Add react linting to build process

Move eslint config to its own file to keep package.json clearer.

Signed-off-by: cstdev <pietomb00@hotmail.com>

* Linting changes from master

Signed-off-by: cstdev <pietomb00@hotmail.com>

* Move CI linting to makefile and travis

Also add trailing comma to multiline imports.

Signed-off-by: cstdev <pietomb00@hotmail.com>

* Add lint fix target to makefile

Signed-off-by: cstdev <pietomb00@hotmail.com>

* Lint latest master

Signed-off-by: cstdev <pietomb00@hotmail.com>
2019-10-28 15:02:42 +01:00