Commit Graph

10 Commits

Author SHA1 Message Date
Tobias Henkel b6f3167b9c
Revert "Revert "Create zuul/web/static on demand""
The js content tarball creation was broken. Instead of leaving the
symlink to a non-existing directory which gets created during python
setup we should just remove that symlink as well and create the
symlink and the static dir during the python setup. This way nothing
will be in the way of the javascript content generation.

This reverts commit eb7b18b38e.

Change-Id: I5f8bfa62cd2d4d9823b86dbcda14885230847a82
2020-07-07 19:53:33 +02:00
James E. Blair eb7b18b38e Revert "Create zuul/web/static on demand"
This reverts commit 64e2bc8ba8.

This appears to have broken js content tarball generation:
 http://zuul.openstack.org/build/f26dc90f339a4359a5cf93a3b0edb96f

Change-Id: I3d4928aeba8449702ba7484cb6b679433b10cbeb
2019-06-04 09:57:04 -07:00
Tobias Henkel 64e2bc8ba8
Create zuul/web/static on demand
We generate the static web build into zuul/web/static which gets
cleaned by yarn before the build. This directory must be existing
before running the yarn build. In order to guarantee that it exists we
currently have the file zuul/web/static/.keep under version
control. This problem with this is that every time the yarn build is
done (e.g. re-creating the tox environment) this file is deleted. This
file deletion is often added to commits accidentally. We can avoid
needing this file if we create the target dir on demand.

Change-Id: I6e94316a89373af1cbfc0abcfc403b54e33046a3
2019-05-26 20:58:46 +02:00
Monty Taylor 733623f328
Use zuul/web/static in setup_hook
The actual location of the files we want to put into the wheel are the
files at zuul/web static. web/build is just a symlink so that the
javascript build system in web/ puts files where we want them without
needing to do build config things.

There is no actual difference - python processes the symlinks just as
well as it processes the direct paths. But from a semantic perspective,
pointing to the paths as they will be in the wheel makes a little more
sense than pointing to paths through a convenience symlink, when trying
to sort out what's going on and why.

Change-Id: Ib93b0eb22f0096b33bcfdb862a47765e48be7203
2018-10-13 07:40:31 -05:00
Monty Taylor e5e3f5a8d4
Remove unneeded cruft from bdist_wheel fix attempts
We added __init__.py files in places, as well as code to generate them.
Turns out none of them are needed. Running sdist before bdist_wheel (or
running yarn build by itself) is the thing with the magic.

Depends-On: https://review.openstack.org/610142
Change-Id: I9610cb5dbaf10e432d824314275fb46e901a93c3
2018-10-12 14:06:53 -05:00
Tristan Cacqueray 68d1189871
Revert "Revert "web: rewrite interface in react""
This reverts commit 3dba813c64.

Change-Id: I233797a9b4e3485491c49675da2c2efbdba59449
2018-10-06 10:42:31 -05:00
Monty Taylor 6f0f36aab0
Make sure javascript output is in wheel
The bdist_wheel command isn't putting the javascript files in the
wheels because the files are neither in git nor are they a detected
python package. Add an __init__.py file so that wheel picks them up.

Change-Id: I46b08405a18cdebc81b81651838b83c3e34c0ad5
2018-10-06 10:41:41 -05:00
James E. Blair 3dba813c64 Revert "web: rewrite interface in react"
Revert "Fix publish-openstack-javascript-content"

This reverts commit ca199eb9db.
This reverts commit 1082faae95.

This appears to remove the tarball publishing system that we rely on.

Change-Id: Id746fb826dfc01b157c5b772adc1d2991ddcd93a
2018-09-29 11:51:43 -07:00
Tristan Cacqueray 1082faae95 web: rewrite interface in react
This change rewrites the web interface using React:
http://lists.zuul-ci.org/pipermail/zuul-discuss/2018-August/000528.html

Depends-On: https://review.openstack.org/591964
Change-Id: Ic6c33102ac3da69ebd0b8e9c6c8b431d51f3cfd4
Co-Authored-By: Monty Taylor <mordred@inaugust.com>
Co-Authored-By: James E. Blair <jeblair@redhat.com>
2018-09-27 02:14:46 +00:00
Monty Taylor 4a781a7f86
Use yarn and webpack to manage zuul-web javascript
yarn drives package and dependency management. webpack handles
bundling, minification and transpiling down to browser-acceptable
javascript but allows for more modern javascript like import statements.

There are some really neat things in the webpack dev server. CSS
changes, for instance, get applied immediately without a refresh. Other
things, like the jquery plugin do need a refresh, but it's handled just
on a file changing.

As a followup, we can also consider turning the majority of the status page
into a webpack library that other people can depend on as a mechanism
for direct use. Things like that haven't been touched because allowing
folks to poke at the existing known status page without too many changes
using the tools seems like a good way for people to learn/understand the
stack.

Move things so that the built content gets put
into zuul/web/static so that the built-in static serving from zuul-web
will/can serve the files.

Update MANIFEST.in so that if npm run build:dist is run before the
python setup.py sdist, the built html/javascript content will be
included in the source tarball.

Add a pbr hook so that if yarn is installed, javascript content will be
built before the tarball.

Add a zuul job with a success url that contains a source_url
pointing to the live v3 data.

This adds a framework for verifying that we can serve the web app
urls and their dependencies for all of the various ways we want to
support folks hosting zuul-web.

It includes a very simple reverse proxy server for approximating
what we do in openstack to "white label" the Zuul service -- that
is, hide the multitenancy aspect and present the single tenant
at the site root.

We can run similar tests without the proxy to ensure the default,
multi-tenant view works as well.

Add babel transpiling enabling use of ES6 features

ECMAScript6 has a bunch of nice things, like block scoped variables,
const, template strings and classes. Babel is a javascript transpiler
which webpack can use to allow us to write using modern javascript but
the resulting code to still work on older browsers.

Use the babel-plugin-angularjs-annotate so that angular's dependency
injection doesn't get borked by babel's transpiling things (which causes
variables to otherwise be renamed in a way that causes angular to not
find them)

While we're at it, replace our use of var with let (let is the new
block-scoped version of var) and toss in some use of const and template
strings for good measure.

Add StandardJS eslint config for linting

JavaScript Standard Style is a code style similar to pep8/flake8. It's
being added here not because of the pep8 part, but because the pyflakes
equivalent can catch real errors. This uses the babel-eslint parser
since we're using Babel to transpile already.

This auto-formats the existing code with:

  npm run format

Rather than using StandardJS directly through the 'standard' package,
use the standardjs eslint plugin so that we can ignore the camelCase
rule (and any other rule that might emerge in the future)

Many of under_score/camelCase were fixed in a previous version of the patch.
Since the prevailing zuul style is camelCase methods anyway, those fixes
were left. That warning has now been disabled.

Other things, such as == vs. === and ensuring template
strings are in backticks are fixed.

Ignore indentation errors for now - we'll fix them at the end of this
stack and then remove the exclusion.

Add a 'format' npm run target that will run the eslint command with
--fix for ease of fixing reported issues.

Add a 'lint' npm run target and a 'lint' environment that runs with
linting turned to errors. The next patch makes the lint environment more
broadly useful.

When we run lint, also run the BundleAnalyzerPlugin and set the
success-url to the report.

Add an angular controller for status and stream page

Wrap the status and stream page construction with an angular controller
so that all the javascripts can be bundled in a single file.

Building the files locally is wonderful and all, but what we really want
is to make a tarball that has the built code so that it can be deployed.

Put it in the root source dir so that it can be used with the zuul
fetch-javascript-tarball role.

Also, replace the custom npm job with the new build-javascript-content
job which naturally grabs the content we want.

Make a 'main.js' file that imports the other three so that we just have
a single bundle. Then, add a 'vendor' entry in the common webpack file
and use the CommonsChunkPlugin to extract dependencies into their own
bundle. A second CommonsChunkPlugin entry pulls out a little bit of
metadata that would otherwise cause the main and vendor chunks to change
even with no source change. Then add chunkhash into the filename. This
way the files themselves can be aggressively cached.

This all follows recommendations from https://webpack.js.org/guides/caching/
https://webpack.js.org/guides/code-splitting/ and
https://webpack.js.org/guides/output-management/

Change-Id: I2e1230783fe57f1bc3b7818460463df1e659936b
Co-Authored-By: Tristan Cacqueray <tdecacqu@redhat.com>
Co-Authored-By: James E. Blair <jeblair@redhat.com>
2018-03-04 07:20:40 -06:00