Skip to content
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

ui: add static images to asset build step #121380

Merged
merged 1 commit into from
Apr 19, 2024

Conversation

dhartunian
Copy link
Collaborator

During the genassets build + embed step, we were taking just the output of the db-console-ccl or db-console-oss step which is just a build.js file. This commit adds references to the image assets we want bundled as well. This includes favicon.ico and everything in ./ assets relative to the db-console build directory.

We disable content hashing in webpack in order to keep the filenames static, which bazel requires. The impact should be minimal as we rarely change these images so if they're cached forever, it's fine.

This change restores the favicon to the CRDB build and the nice image that shows up in the background of the email signup bar.

The size of the final zipped bundle only differs by around 1MB and is already 10MB in size.

Fixes: #117876
Epic: None

Release note (ui change): the favicon now renders properly for DB Console along with other image files.

@dhartunian dhartunian requested review from rickystewart and a team March 29, 2024 19:14
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@dhartunian dhartunian requested review from laurenbarker, a team and abarganier and removed request for a team March 29, 2024 19:14
@dhartunian dhartunian added backport-23.1.x Flags PRs that need to be backported to 23.1 backport-23.2.x Flags PRs that need to be backported to 23.2. backport-24.1.x Flags PRs that need to be backported to 24.1. labels Apr 3, 2024
Copy link
Contributor

@abarganier abarganier left a comment

Choose a reason for hiding this comment

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

LGTM, but I'll let Ricky and Lauren give the approval.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @dhartunian, @laurenbarker, and @rickystewart)


pkg/ui/workspaces/db-console/BUILD.bazel line 62 at r1 (raw file):

    outs = [
        "db-console-ccl/assets/bundle.js",
        "db-console-ccl/assets/favicon.ico",

Just curious, is there a reason we can't use wildcard patterns here for the assets dir?

@dhartunian dhartunian requested a review from abarganier April 4, 2024 17:52
Copy link
Collaborator Author

@dhartunian dhartunian left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @abarganier, @laurenbarker, and @rickystewart)


pkg/ui/workspaces/db-console/BUILD.bazel line 62 at r1 (raw file):

Previously, abarganier (Alex Barganier) wrote…

Just curious, is there a reason we can't use wildcard patterns here for the assets dir?

your question is the core of why UI builds with bazel are hard: bazel requires explicit definition of all outputs. hence you can't use wildcards, and you can't have webpack tell bazel what the names of the outputs are at runtime (if their names are hashes for instance).

@dhartunian
Copy link
Collaborator Author

@rickystewart friendly ping, any concerns about me adding some static assets to the UI build? I assume it wasn't previously done because it's problematic for maintenance reasons but I think the rate of change for these files is quite low.

Copy link
Contributor

@laurenbarker laurenbarker left a comment

Choose a reason for hiding this comment

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

This seems reasonable to me. LGTM

@dhartunian
Copy link
Collaborator Author

TFTR!

bors r=laurenbarker

@craig
Copy link
Contributor

craig bot commented Apr 5, 2024

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Apr 5, 2024

Build failed (retrying...):

@yuzefovich
Copy link
Member

CI seems to be red.

bors r-

@craig
Copy link
Contributor

craig bot commented Apr 5, 2024

Canceled.

@dhartunian
Copy link
Collaborator Author

thanks @yuzefovich I see the problem. my build config is not OSS-compatible. I will fix.

@dhartunian dhartunian force-pushed the fix-missing-favicon branch from 5f07491 to de7ad28 Compare April 17, 2024 21:27
@dhartunian dhartunian requested a review from a team as a code owner April 17, 2024 21:27
During the `genassets` build + embed step, we were taking just the
output of the `db-console-ccl` or `db-console-oss` step which is just
a build.js file. This commit adds references to the image assets we
want bundled as well. This includes favicon.ico and everything in `./
assets` relative to the db-console build directory.

We disable content hashing in webpack in order to keep the filenames
static, which bazel requires. The impact should be minimal as we
rarely change these images so if they're cached forever, it's fine.

This change restores the favicon to the CRDB build and the nice image
that shows up in the background of the email signup bar.

The size of the final zipped bundle only differs by around 1MB and is
already 10MB in size.

Fixes: cockroachdb#117876
Epic: None

Release note (ui change): the favicon now renders properly for DB
Console along with other image files.
@dhartunian dhartunian force-pushed the fix-missing-favicon branch from de7ad28 to 5245691 Compare April 18, 2024 13:37
@dhartunian
Copy link
Collaborator Author

bors r=laurenbarker

@craig
Copy link
Contributor

craig bot commented Apr 19, 2024

This PR was included in a batch that was canceled, it will be automatically retried

@rail
Copy link
Member

rail commented Apr 19, 2024

bors retry
(it crashed)

@craig
Copy link
Contributor

craig bot commented Apr 19, 2024

Build failed (retrying...):

@craig craig bot merged commit 50393fa into cockroachdb:master Apr 19, 2024
21 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-23.1.x Flags PRs that need to be backported to 23.1 backport-23.2.x Flags PRs that need to be backported to 23.2. backport-24.1.x Flags PRs that need to be backported to 24.1.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CockroachDB favicon does not render for DB Console running v23.1.13
6 participants