Commit Graph

70 Commits

Author SHA1 Message Date
Jan Fajerski b517645d95
Github actions (#3299)
* Move CI to github actions

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

* Skip email test in github action

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

* build before lint

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

---------

Signed-off-by: Jan Fajerski <jfajersk@redhat.com>
2023-09-21 17:22:17 +01:00
Augustin Husson f334232b85 override lint makefile directive
Signed-off-by: Augustin Husson <augustin.husson@amadeus.com>
2023-08-16 09:37:10 +02:00
Augustin Husson 4b86e08028 Merge branch 'main' into nexucis/react-app 2023-08-16 09:20:52 +02:00
Simon Pasquier 84f8f4e620
Update email assets after #3420 (#3440)
* Add template/email.tmpl to the clean target

The change ensures that all assets can be regenerated from scratch in
the CI.

Signed-off-by: Simon Pasquier <spasquie@redhat.com>

* Update email assets after #3420

Signed-off-by: Simon Pasquier <spasquie@redhat.com>

---------

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2023-08-04 14:42:18 +01:00
Augustin Husson 25d1f32138 inject react-app in binary
Signed-off-by: Augustin Husson <augustin.husson@amadeus.com>
2023-02-28 12:57:49 +01:00
Ben Kochie 432ee01c8c
Update Go to 1.19 (#3150)
* Update Go to 1.19

* Update Go.
* Update some Go modules.
* Update Swagger to the latest for Go 1.19 compatibility.
* api/v2: regenerate
* Accommodate to the changes in the client package
* asset/assets_vfsdata.go: regenerate

Signed-off-by: SuperQ <superq@gmail.com>
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
Co-authored-by: Simon Pasquier <spasquie@redhat.com>
2022-11-30 17:06:57 +01:00
Julien Pivotto 74ebd3d175
Package and ship frontend independenlty (#2893)
Enable frontend consumption by downstreams, like debian and nixos

Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2022-04-22 12:07:11 +02:00
Brad Ison c0a7b75c9c
Automate CSS-inlining for default HTML email template (#2798)
* Automate CSS-inlining for default HTML email template

The original HTML email template was added in `template/email.html`.
It looks like the CSS was manually inlined.  Most likely using the
premailer.dialect.ca web form, which is mentioned in the README for
the Mailgun transactional-email-templates project.  The resulting HTML
with inlined CSS was then copied into `template/default.tmpl`.  This
has resulted in `email.html` and `default.tmpl` diverging at times.

This commit adds build automation to inline the CSS automatically
using [juice][1].  The Go template containing the resulting HTML has
been moved into its own file to avoid the script that performs the CSS
inlining having to parse the `default.tmpl` file to insert it there.

Fixes #1939.

[1]: https://www.npmjs.com/package/juice

Signed-off-by: Brad Ison <bison@xvdf.io>

* Update asset/assets_vfsdata.go

Signed-off-by: Brad Ison <bison@xvdf.io>
2022-01-03 17:33:53 +01:00
Goutham Veeramachaneni e26425473c
Update go-openapi to latest
go-swagger 0.25.0+ are failing though :/

Signed-off-by: Goutham Veeramachaneni <gouthamve@gmail.com>
2021-03-10 19:00:22 +01:00
vitt-bagal ce5d523596
Add image build for s390x architecture (#2289)
* Add suport for s390x

Signed-off-by: Nayana <nthorat@us.ibm.com>

* Added s390x support to docker image

Signed-off-by: vitthalb@us.ibm.com <vitthalb@us.ibm.com>

Co-authored-by: Nayana <nthorat@us.ibm.com>
2020-06-09 16:30:55 +02:00
Carlos Eduardo 071818bdac
Add image build for ppc64le architecture (#2219)
Signed-off-by: Carlos de Paula <me@carlosedp.com>
2020-03-30 16:56:23 +02:00
Simon Pasquier d5f6f88928
*: bump Open API dependencies (#2024)
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-09-09 10:57:38 +02:00
Simon Pasquier b11dc2ebc0
Remove Travis CI (#2005)
This change moves the continuous integration to Circle CI only as
maintaining 2 systems has a cost.

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-08-26 11:15:28 +02:00
Simon Pasquier f32ad1dd8b *: enable default linters (#1861)
* *: enable default linters

* Remove direct usage of errcheck

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-04-29 10:54:40 +02:00
Simon Pasquier 9f5447bf46 Build container images for ARM32v7 and ARM64v8
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-04-16 14:41:18 +02:00
Simon Pasquier ad71e1c0f3 Makefile: remove bzr check
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-03-18 09:55:12 +01:00
Paul Gier 8688c7b9ad api/v2: move generated client code from test to api/v2 (#1792)
- Move the generated api/v2 client code out of the test directory
and into the api/v2 directory with models and restapi.
- Remove duplicate models directory
- Update tests to use api/v2 package for models and client

Signed-off-by: Paul Gier <pgier@redhat.com>
2019-03-12 17:11:23 +01:00
Paul Gier 458f1d646b Makefile improvements
- make clean shouldn't print errors when files/directories have already
been removed
- add copyright header to generated api files to pass license check

Signed-off-by: Paul Gier <pgier@redhat.com>
2019-03-11 10:45:45 -05:00
Simon Pasquier a4412270ef Switch to Go 1.12
It also pins errcheck to the latest stable release and simplifies how it
gets installed.

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-03-04 16:33:32 +01:00
beorn7 15ed7be846 Remove `-u` from `go get` for `errcheck`
Without the `-u`, it will load what's required in the `go.mod`
file. But with the `-u`, it will load new stuff once it's available,
which makes the build non-reproducible. (Without any change in the
`errcheck` repo, other things will happen.)

Signed-off-by: beorn7 <beorn@soundcloud.com>
2019-02-28 14:27:21 +01:00
Simon Pasquier c7de536129
*: use stdlib context (#1768)
This changes removes all usage of golang.org/x/net/context in the code
base. It also bumps a few dependencies for the same reason:
- github.com/gogo/protobuf
- go-openapi/*

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-02-26 12:18:57 +01:00
beorn7 6f0e911dd1 Fix the assets make target
Presumable, it broke with the introduction of Go modules

Signed-off-by: beorn7 <beorn@soundcloud.com>
2019-02-07 15:11:13 +01:00
Simon Pasquier b676fa79c0 *: update Makefile.common with new staticcheck (#1692)
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-01-04 15:37:33 +01:00
Max Inden 37e019017b
Merge pull request #1630 from simonpasquier/go-modules
*: support Go modules
2018-11-27 15:32:13 +01:00
Max Leonard Inden f504f953c1
ui: Move /alerts to API v2
Signed-off-by: Max Leonard Inden <IndenML@gmail.com>
2018-11-23 12:53:48 +01:00
Simon Pasquier d2bc742474 *: support Go modules
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2018-11-20 16:09:40 +01:00
Max Leonard Inden e4e053b18e
ui: Move /status & /silences to API v2
This patch makes the Alertmanager UI (/status & /silences) use the
api/v2 endpoint. In addition it adds logic to generate the elm side data
model based on the OpenAPI specification.

Signed-off-by: Max Leonard Inden <IndenML@gmail.com>
2018-11-15 13:24:26 +01:00
Simon Pasquier 3558e6fd9e Migrate from go-bindata to vfsgen (#1532)
* Migrate from go-bindata to vfsgen

Signed-off-by: Simon Pasquier <spasquie@redhat.com>

* Ensure idempotent generation for vfsgen

Signed-off-by: Simon Pasquier <spasquie@redhat.com>

* asset: update generated files

Signed-off-by: Simon Pasquier <spasquie@redhat.com>

* Fix asset paths for Windows platforms

Signed-off-by: Simon Pasquier <spasquie@redhat.com>

* Regenerate assets

Signed-off-by: Simon Pasquier <spasquie@redhat.com>

* Add vfs wrapper that returns constant mod time

This is identical to what we had with go-bindata and avoids the extra
step of storing the identity of the complete file system in another
location.

Signed-off-by: Simon Pasquier <spasquie@redhat.com>

* Additional cleanup

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2018-09-24 15:12:40 +02:00
Max Leonard Inden f1b920bcc9
api: Implement OpenAPI generated Alertmanager API V2
The current Alertmanager API v1 is undocumented and written by hand.
This patch introduces a new Alertmanager API - v2. The API is fully
generated via an OpenAPI 2.0 [1] specification (see
`api/v2/openapi.yaml`) with the exception of the http handlers itself.

Pros:
- Generated server code
- Ability to generate clients in all major languages
  (Go, Java, JS, Python, Ruby, Haskell, *elm* [3] ...)
    - Strict contract (OpenAPI spec) between server and clients.
    - Instant feedback on frontend-breaking changes, due to strictly
      typed frontend language elm.
- Generated documentation (See Alertmanager online Swagger UI [4])

Cons:
- Dependency on open api ecosystem including go-swagger [2]

In addition this patch includes the following changes.

- README.md: Add API section

- test: Duplicate acceptance test to API v1 & API v2 version

  The Alertmanager acceptance test framework has a decent test coverage
  on the Alertmanager API. Introducing the Alertmanager API v2 does not go
  hand in hand with deprecating API v1. They should live alongside each
  other for a couple of minor Alertmanager versions.

  Instead of porting the acceptance test framework to use the new API v2,
  this patch duplicates the acceptance tests, one using the API v1, the
  other API v2.

  Once API v1 is removed we can simply remove `test/with_api_v1` and bring
  `test/with_api_v2` to `test/`.

[1]
https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md

[2] https://github.com/go-swagger/go-swagger/

[3] https://github.com/ahultgren/swagger-elm

[4]
http://petstore.swagger.io/?url=https://raw.githubusercontent.com/mxinden/alertmanager/apiv2/api/v2/openapi.yaml

Signed-off-by: Max Leonard Inden <IndenML@gmail.com>
2018-09-04 13:38:34 +02:00
Max Leonard Inden 1219541184
*.go: Introduce errcheck enforcing error handling
Errcheck [1] enforces error handling accross all go files. Functions can
be excluded via `scripts/errcheck_excludes.txt`.

This patch adds errcheck to the `test` Make target.

[1] https://github.com/kisielk/errcheck

Signed-off-by: Max Leonard Inden <IndenML@gmail.com>
2018-08-30 15:47:13 +02:00
Simon Pasquier 0c512998ee Use Makefile.common from Prometheus (#1396)
* Include Makefile.common
* Fix the bindata.go files to make the style target happy
* Inline `.PHONY` statements

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2018-06-13 14:41:52 +02:00
Simon Pasquier b95b32821f ui: replace deprecated InstrumentHandler() (#1302)
This change replaces the deprecated InstrumentHandler function by
the equivalent functions from the promhttp package.

The following metrics are removed:

* http_request_duration_microseconds (Summary).
* http_request_size_bytes (Summary).
* http_requests_total (Counter).

And the following metrics are added instead:

* alertmanager_http_request_duration_seconds (Histogram).
* alertmanager_http_response_size_bytes (Histogram).
* promhttp_metric_handler_requests_in_flight (Gauge).
* promhttp_metric_handler_requests_total (Counter).
2018-03-28 15:28:38 +02:00
pasquier-s e8a92f65ef Run staticcheck as part of the build process (#1264)
This change also fixes potential issues highlighted by running
staticcheck.
2018-02-28 17:42:32 +01:00
pasquier-s c39a913f8a test: enable race detection (#1262)
This change enables race detection when running the tests. It also fixes
a couple of existing race conditions.
2018-02-27 18:18:53 +01:00
Andrey Kuzmin f9e96fce3d
Use elm reactor for dev assets (#1133)
* Serve assets from elm reactor

* Update bindata.go
2017-12-10 21:59:15 +01:00
Callum Styan ad27f483dd allow a binary name to be passed to make build, rather than only allowing build to build all binaries from .promu.yml 2017-09-10 14:30:55 -07:00
Max Leonard Inden b3f3ecf803
Improve front-end build process
We generate binaries whenever `make build-all` is run. If they already
exist, we only regenerate them if they are outdated.

When one makes changes to the front-end and runs the single command
`make build-all` on the root level Makefile, the front-end is rebuild
accordingly.

`make build-all` will use Docker to build the front-end. If someone prefers
to install all the dev dependencies on their local machine instead, one
can add the `NO_DOCKER=true` flag.

For folks that only want to make back-end changes `ui/bindata.go` is
checked in, so they do not have to build the front-end. They still use
the `make build` command as before.
2017-07-06 13:43:10 +02:00
Max Leonard Inden dd7ffe0515
Serve FontAwesome & Bootstrap ourself
Instead of using external CDNs for Bootstrap and FontAwesome, this patch
makes Alertmanager serve these libraries itself.
2017-06-07 22:40:18 +02:00
stuart nelson 2cf38e4c2e Fix external web url (#836)
Infer path from Navigation.Location

Build uses template, local dev uses elm-reactor

Remove unneeded local dev go server

Add script.js make target

Compiles and uglifies script.js

Before:
~570kb

After:
~170kb

Bootstrap loading state

Add trailing slash via JS & add routePrefix console param

Add Javascript script tag to `index.html` which adds a trailing slash to
the url pathname if none is present. This is done to ensure assets like
`script.js` are loaded properly.

Example without patch:
If the pathname is "mxinden.com/alertmanager" the browser will try to
download the `script.js` asset from "mxinden.com/script.js". This
request will fail.

Example with patch:
If the pathname is "mxinden.com/alertmanager", Javascript redirects the
browser to "mxinden.com/alertmanager/" and then the `script.js` asset
will be downloaded from "mxinden.com/alertmanager/script.js". This
request will succeed.

Add `-web.route-prefix` as a console parameter. This configures a
Prefix for the internal routes of web endpoints. Defaults to path of
-web.external-url like in *Prometheus*.

Trim slashes off of route prefix and add one slash at the beginning.
Make sure route prefix is not empty or just a slash before prefixing
router.
2017-06-07 22:38:39 +02:00
Andrey Kuzmin 3f60d01592 Add favicon (#839)
* Add favicon

* Fix the node version

* Update bindata.go
2017-06-01 10:13:20 +02:00
Max Inden 37bbc4c439 Merge pull request #736 from prometheus/ui-rewrite-merge-master
Update ui-rewrite with master branch
2017-04-25 17:36:55 +02:00
Max Leonard Inden 0d2b0b6bd6
Merge branch 'master' into ui-rewrite 2017-04-25 15:47:57 +02:00
Max Leonard Inden e2898f8f4d
Exclude /ui folder from go tests 2017-04-25 15:01:07 +02:00
Max Leonard Inden a8d7f92c66 test: Ensure bindata.go is always up to date
This adds three more steps to the Travis tests.
1. Compile Elm -> script.js
2. Bundle html.index & script.js -> bindata.go
3. Check if bindata.go hasn't changed
2017-04-25 11:33:57 +02:00
Fabian Reinartz 309c6af4b2
nflog: use alert set instead of hash for deduplication
Building a hash over an entire set of alerts causes problems, because
the hash differs, on any change, whereas we only want to send
notifications if the alert and it's state have changed. Therefore this
introduces a list of alerts that are active and a list of alerts that
are resolved. If the currently active alerts of a group are a subset of
the ones that have been notified about before then they are
deduplicated. The resolved notifications work the same way, with a
separate list of resolved notifications that have already been sent.
2017-04-13 15:13:47 +02:00
Max Leonard Inden c3850708c1 Make assets generation deterministic
By passing "-modtime 1" flag into go-bindata command it uses the same
unix timestamp (1) for every file in the fake filesystem. Thereby every
execution of "make assets" results in the same asset outputs if the
inputs were the same. This forces us to set the "Cache-Control"
attribute to "no-cache".
2017-04-10 13:47:13 +02:00
Max Leonard Inden 0faf0f531f
Add Elm UI rewrite from github.com/stuartnelson3/am-ui with history
* Including glue between Alertmanager server and Elm UI.
* Rebuilding assets (ui/bindata.go).
* Exact commit: 'bd78de6b16bcefaacf4229304d439b33aa09cc72'
* Subdirectory: ui/app
2017-03-24 17:48:50 +01:00
stuart nelson 7987e9d5df Update format to find all .elm files 2017-01-04 18:02:49 -05:00
stuart nelson e4d7663cb8 Add format make target 2016-11-06 21:07:17 +01:00
Steve Durrheimer 9d4dccae7c
New release process using docker, circleci and a centralized
building tool
2016-04-22 21:46:53 +02:00