-
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
Isolate react-app package #3589
Conversation
Signed-off-by: Alex Weaver <[email protected]>
@@ -0,0 +1,51 @@ | |||
package reactApp |
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.
All code in this file is purely extracted from the old ui/web.go
. No substantive changes.
Signed-off-by: Alex Weaver <[email protected]>
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.
LGTM - this seems sensible.
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package reactApp |
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.
For the sake of simplcity, let's call this package reactUI
and name the file accordingly.
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.
nvm, as you explained offline there's benefits to this approach - downstream consumers don't have to adopt the react-ui until it's ready. I'm good with that.
There's one more thing I think we should do here - let's make sure we version control the react-generated, and we also need a CI step that aborts if there's a difference between what we have and what is generated. Otherwise, we don't have visibility when changes are made. |
551188e
to
3adf7b4
Compare
4e62c4c
to
57fedd3
Compare
Signed-off-by: Alex Weaver <[email protected]>
…ated Signed-off-by: Alex Weaver <[email protected]>
Signed-off-by: Alex Weaver <[email protected]>
72bcb9f
to
a5339f5
Compare
Signed-off-by: Alex Weaver <[email protected]>
Signed-off-by: Alex Weaver <[email protected]>
Signed-off-by: Alex Weaver <[email protected]>
Signed-off-by: Alex Weaver <[email protected]>
Signed-off-by: Alex Weaver <[email protected]>
Signed-off-by: Alex Weaver <[email protected]>
Signed-off-by: Alex Weaver <[email protected]>
Signed-off-by: Alex Weaver <[email protected]>
… not synced Signed-off-by: Alex Weaver <[email protected]>
Signed-off-by: Alex Weaver <[email protected]>
3168c5d
to
7c53ef7
Compare
Signed-off-by: Alex Weaver <[email protected]>
Signed-off-by: Alex Weaver <[email protected]>
Signed-off-by: Alex Weaver <[email protected]>
Signed-off-by: Alex Weaver <[email protected]>
Signed-off-by: Alex Weaver <[email protected]>
This test has flaked out more than once: issue filed. #3593 Another was CircleCI failing to talk to NPM to download a dependency. This one seemed like a one-off. |
Signed-off-by: Alex Weaver <[email protected]>
@@ -334,7 +334,7 @@ func testTLSConnection(t *testing.T) { | |||
) | |||
require.NoError(t, err) | |||
go p2.Settle(context.Background(), 0*time.Second) | |||
|
|||
p2.WaitReady(context.Background()) |
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.
Drive-by fix; this test flaked a couple times. #3593
The go Settle
and following assert race each other. Other tests, including further up in this same test, use a WaitReady
- it seems to be missing here.
@@ -7,9 +7,9 @@ set -euo pipefail | |||
cd ui/react-app | |||
cp embed.go.tmpl embed.go | |||
|
|||
GZIP_OPTS="-fk" | |||
GZIP_OPTS="-fkn" |
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.
-n
means to avoid including file naming information.
This also happens to exclude file timestamp info, which keeps the built artifacts reproducible. Otherwise, you get diff in the compressed files every time they're rebuilt.
@@ -43,3 +43,4 @@ jobs: | |||
- uses: prometheus/[email protected] | |||
- uses: ./.github/promci/actions/setup_environment | |||
- run: make | |||
- run: git diff --exit-code |
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.
This step will fail if the artifacts are not updated. The resulting behavior is the same as the legacy UI.
Tested as part of this PR, the test is visible in this PR's commit history.
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.
Beautiful! Thanks very much for your contribution.
# gzip option '-k' may not always exist in the latest gzip available on different distros. | ||
if ! gzip -k -h &>/dev/null; then GZIP_OPTS="-f"; fi | ||
if ! gzip -k -h &>/dev/null; then GZIP_OPTS="-fn"; fi |
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.
I don't mind the UI package not dragging along more dependencies than needed, but checking in the entire build output for the React app seems a bit unusual to me - it's almost like checking in a compiled binary, and now you'll have commit it again for every little change in the source. In Prometheus we circumvent this problem in a different way: the |
* Isolate react-app package Signed-off-by: Alex Weaver <[email protected]> --------- Signed-off-by: Alex Weaver <[email protected]>
This PR changes the package dependency hierarchy such that
ui
no longer depends onui/react-app
:What was once this:
Now becomes:
i.e. the
react-app
endpoints are now registered separately.This has a few benefits: