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

[v11] web: Ignore .swc directory when computing web SHA #29899

Closed
wants to merge 3 commits into from

Conversation

camscale
Copy link
Contributor

@camscale camscale commented Aug 2, 2023

Ignore any .swc directories when computing the SHA of SHAs to
determine if make ensure-webassets should rebuild the web UI. The
.swc directories are in the .gitignore file, so should also be
ignored when computing the SHA of the web files.

On a fresh checkout of teleport, running make ensure-webassets
causes a plugin to be build or downloaded into
web/packages/teleport/.swc/plugins/v4. As this is inside the directory
over which the SHA of SHAs is computed, if you re-run
make ensure-webassets, it ends up rebuilding the web UI for the same
result. It should not rebuild the web UI if it hasn't changed. The SHA
of SHAs generated from a fresh checkout of teleport should match another
fresh checkout. This fails as generating the enterprise webassets after
generating the OSS webassets includes the plugin as part of the SHA, and
that is not there on a fresh checkin.

This will make a difference if we want to build the web assets as a
separate step on CI so that the webassets directory can be copied into
other builds. This will allow a later version of node.js to be used to
build the web UI that what may be available on the OS we're building
Teleport on (I'm looking at you, Centos 7).

Fix a shellcheck-reported issue of quoting while we're here.

Also (partial) backport some previous PRs that made minor changes to
build.assets/build-webassets-if-changed.sh.

Issue: #21724
Backport: #29892
Backport: #21822
Backport: #22979 (partial)
Changelog: none

r0mant and others added 3 commits August 2, 2023 22:28
…orms

Signed-off-by: Roman Tkachenko <roman@goteleport.com>
Co-authored-by: Victor Sokolov <gzigzigzeo@gmail.com>
Partial backport of 42c472a, just
the `build.assets/build-webassets-if-changed.sh` script.
Ignore any `.swc` directories when computing the SHA of SHAs to
determine if `make ensure-webassets` should rebuild the web UI. The
`.swc` directories are in the `.gitignore` file, so should also be
ignored when computing the SHA of the web files.

On a fresh checkout of `teleport`, running `make ensure-webassets`
causes a plugin to be build or downloaded into
`web/packages/teleport/.swc/plugins/v4`. As this is inside the directory
over which the SHA of SHAs is computed, if you re-run
`make ensure-webassets`, it ends up rebuilding the web UI for the same
result. It should not rebuild the web UI if it hasn't changed. The SHA
of SHAs generated from a fresh checkout of teleport should match another
fresh checkout. This fails as generating the enterprise webassets after
generating the OSS webassets includes the plugin as part of the SHA, and
that is not there on a fresh checkin.

This will make a difference if we want to build the web assets as a
separate step on CI so that the `webassets` directory can be copied into
other builds. This will allow a later version of node.js to be used to
build the web UI that what may be available on the OS we're building
Teleport on (I'm looking at you, Centos 7).

Fix a shellcheck-reported issue of quoting while we're here.
@camscale
Copy link
Contributor Author

camscale commented Aug 2, 2023

v12 doesn't use Vite so the SWC directory doesn't get created (#29898 (comment))

Thanks for that. I wasn't sure, but I checked the .gitignore and saw it had the Vite section for .swc. I'll close this.
(I'm assuming if v12 does not use Vite, neither does v11).

@camscale camscale closed this Aug 2, 2023
@camscale camscale deleted the camh/v11/webassets-ignore-swc branch August 2, 2023 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants