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

Autoupdate static assets (jquery, xterm) #4286

Open
nitrocode opened this issue Feb 25, 2024 · 0 comments
Open

Autoupdate static assets (jquery, xterm) #4286

nitrocode opened this issue Feb 25, 2024 · 0 comments
Labels
bug Something isn't working Stale

Comments

@nitrocode
Copy link
Member

nitrocode commented Feb 25, 2024

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request. Searching for pre-existing feature requests helps us consolidate datapoints for identical requirements into a single place, thank you!
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Overview of the Issue

We currently have static versioned web assets used by the internal site. These static assets are committed to the code and manually updated.

The reference in the code looks like

<script src="{{ .CleanedBasePath }}/static/js/jquery-3.5.1.min.js"></script>
<script src="{{ .CleanedBasePath }}/static/js/xterm-4.9.0.js"></script>
<script src="{{ .CleanedBasePath }}/static/js/xterm-addon-attach-0.6.0.js"></script>
<script src="{{ .CleanedBasePath }}/static/js/xterm-addon-fit-0.4.0.js"></script>
<script src="{{ .CleanedBasePath }}/static/js/xterm-addon-search-0.7.0.js"></script>
<script src="{{ .CleanedBasePath }}/static/js/xterm-addon-search-bar.js"></script>

https://github.com/runatlantis/atlantis/tree/main/server/static/js

This is handy to keep the build consistent however it doesn't allow for an automatable upgrade path.

To make it upgradeable, we can do the following

  • manage the static dependencies in a file like package.json
    • this will automatically get picked up by renovate bot
    • webpack or similar could be used as well for bundling
  • pin the dependencies there
  • run package manager commands to download the assets in the beginning of the build process
  • remove the committed static js assets

Another task that may be needed is

  • to move all the inline html code into separate template files like we do with the github pr and comment templates

    var ProjectJobsTemplate = template.Must(template.New("blank.html.tmpl").Parse(`
    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="utf-8">

Additional Context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Stale
Projects
None yet
Development

No branches or pull requests

1 participant