-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve front-end build process #792
Conversation
So if we want to compile AM, even if we don't change anything about the UI, we have to have the docker daemon running and build the container and download its deps, then compile the UI, before we can proceed building the Go binary? |
@fabxc Yes, the first time compiling Alertmanager one has to have the docker daemon running. From there on only if the underlying |
I don't think it's at all reasonable to have Docker installed and running to compile our binaries. |
I agree with @brian-brazil, I don't think docker should be a hard requirement. But, I do think it's reasonable to expect that if you want to compile alertmanager, you compile all of alertmanager (which includes the ui). I would propose:
Thoughts? |
Which means it will be a hard requirement :) I think it's a rather contentious point. What exactly are the drawbacks and complications of including the compiled data that make it worth removing this here? From what I understood the |
@fabxc It just adds an extra layer of complexity during frontend development and in addition is a frequent reason for merge conflicts. For me it is worth the dependency, but that's of course very biased as I have to have it installed anyways. Just thought it would be a nice improvement. It is not very important to me, if you guys prefer we stick with the existing process. |
@fabxc @stuartnelson3 @brian-brazil Another suggestion: We check in the |
That's fine from a backend standpoint. I think it's still unreasonable to require Docker for anyone making frontend changes. |
@brian-brazil Ok, with |
My point with using |
I am highly against the manual bindata step. Quite often I run into an issue, when it does not produce the same file as CI. Both steps - the Elm compilation and bindata compilation should be automated. |
I have updated the PR accordingly. Instead of checking in binaries like When one makes changes to the front-end and runs the single command
For folks that only want to make back-end changes I think this is a good compromise for both front-end and back-end developers. @brian-brazil @fabxc @brancz Can one of you try out @brian-brazil Let me know what you think! |
Cool, that sounds like a good approach 👍 |
I will take care of the circle-ci builds once we have settled on a build process. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds good to me. Thanks!
ui/app/CONTRIBUTING.md
Outdated
to set the environment flag `NO_DOCKER` to `true` and have the following | ||
dependencies installed: | ||
|
||
- [Elm ](https://guide.elm-lang.org/install.html#install) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra space
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the hint. Fixed.
Having to commit
|
@w0rm Yes, it is not perfect from a front-end perspective, but it is a compromise for back-end developers, because otherwise we force back-end developers to either have docker or all the Elm dependencies installed to be able to build Alertmanager. I am happy for alternative solutions! But I think forcing these dependencies on back-end developers is not an option (See conversations above). |
|
@mxinden what about recompiling the |
@w0rm I don't understand what that would solve. Sorry. Whenever the back-end depends on changes in the front-end those changes would only be visible on every release, right. Not keeping the front-end in sync with the back-end sounds dangerous to me. |
@mxinden it would solve two issues that I mentioned before. We can recompile |
f1c5c06
to
ba47527
Compare
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.
Gnu make uses file timestamps in order to determine whether a target should be rebuild or not depending on its prerequisites. This is great in day to day work, but not if you freshly check out the project. Then every file has the same timestamp and everything has to be rebuild. This forced me to make the following changes:
I am sorry for all the back and forth around such a small problem. I would like to get this merged and solve any further improvements in a new PR. |
👍 |
@stuartnelson3 @w0rm Whenever you build something for the front-end you can now run |
* Fix smartmon.sh info label consistency. * Fix parsing of SMART-ID attributes <= 99.
Instead of checking in binaries like
ui/bindata.go
andtemplate/internal/deftmpl/bindata.go
into git, we generate themwhenever
make build
is run. If they already exist, we only regeneratethem if they are outdated.
For folks that only want to make back-end changes
ui/app/script.js
ischecked in, so they do not have to build the front-end.
make build
will use Docker to build the front-end. If someone prefersto install all the dev dependencies on their local machine instead, one
can add the
NO_DOCKER=true
flag.Happy for any feedback, especially
GNU Make
specific.I will rebase this PR once #789 is merged into Master.