Граф коммитов

7578 Коммитов

Автор SHA1 Сообщение Дата
Jonathan French 7c20363e48 Switch to ES6 arrow functions in more places (#3169) 2018-01-25 18:21:52 +00:00
Jonathan French 247e1b980c Bug 1053203 - Remove builds and tests tables from user guide (#3164) 2018-01-25 11:54:59 +00:00
pyup.io bot 8e63c711e4 Update typing from 3.6.2 to 3.6.4 (#3165) 2018-01-25 02:20:00 +00:00
Ed Morley a60bab5e78 Bug 1364894 - Whitelist rather than blacklist files copied to dist/
With the changes in previous commits, all of the assets that were
originally manually copied to `dist/img/` are now correctly handled
by webpack as dependencies (and so emitted to `dist/` automatically).

As such, this leaves only three files that need copying from `src/`,
so they are now listed explicitly to avoid having to continually
update `ignore` to prevent extra files from sneaking in:
https://webpack.js.org/plugins/copy-webpack-plugin/

As a result of this change, the following assets are no longer
needlessly created under `dist/` as part of `yarn build`:
```
img/dancing_cat.gif
img/line_chart.png
img/logviewerIcon.png
img/logviewerIcon.svg
img/logviewerIconHelp.svg
img/tip.png
img/tip-locked.png
img/tree.xcf
img/tree_closed.png
img/tree_open.png
img/treeherder-logo.png
```

To confirm that this would not break anything, the JS and HTML files
under `dist/` were grepped for the string `img/`, and there are no
references remaining.
2018-01-24 23:43:58 +00:00
Ed Morley dd3de28f4d Bug 1364894 - Ensure revision.txt exists in development too
Currently `revision.txt` only exists on Heroku, since it's generated
by the Heroku-only `post_compile` script, just prior to `yarn build`.

However this means:
* HTTP 404s of `revision.txt` are seen in the browser console when
  developing locally, which gives the appearance of something being
  broken, even though it's not.
* when we convert the wildcard `CopyPlugin` rule to an explicit list
  of files to copy (in a later commit), it will cause errors when
  building locally, since `CopyPlugin` expects all declared files
  to exist.

Adding a placeholder file prevents both of the above.
2018-01-24 23:43:58 +00:00
Ed Morley 9bc2752c96 Bug 1364894 - Use imports for images in thFavicons
This ensures that webpack knows they are a dependency, meaning:
* no need to manually copy them to `dist/img/` using `CopyPlugin`
  (the wildcard copy rules will be cleaned up in a later commit)
* they are inlined as a base64 encoded data URI by `url-loader`.

The changes to `thFaviconLink` are required to prevent:
```
Error: [$interpolate:interr] Can't interpolate: {{favicon}}
Error: [$sce:insecurl] Blocked loading resource from url not allowed
by $sceDelegate policy.  URL: data:image/png;base64,...
```

Which are due to AngularJS not trusting data URIs by default. See:
https://docs.angularjs.org/error/$sce/insecurl
2018-01-24 23:43:58 +00:00
Ed Morley bf5ce96e23 Bug 1364894 - Make html-loader treat favicons as dependencies too
Previously `html-loader` only parsed `<img src="...">` tags when
looking for assets/dependencies. Now the `<link href="...">` tags
for favicons are processed too, which means `img/tree_open.png`
and friends will be included in the webpack build and not need to
be manually copied into `dist/img/`:
https://webpack.js.org/loaders/html-loader/

This does not visible change the number of hashed images output to
`dist/`, since the favicons are small enough that `url-loader` inlines
them in the HTML as base64 encoded data URIs (this is adjustable if
not desired later):
https://webpack.js.org/loaders/url-loader/
2018-01-24 23:43:58 +00:00
Ed Morley 49339088f6 Bug 1364894 - Load HTML with html-loader not raw-loader
Neutrino 4 configures `file-loader` as the loader for HTML (rather than
the more usual `html-loader`), which means the HTML is not parsed to
look for further dependencies such as `<img src="...">` tags. Our
custom Neutrino config overrode that to `raw-loader` (presumably to
work around bugs caused by the use of `file-loader`), which doesn't
parse HTML either.

Instead, these assets were being manually copied to `dist/img/` by
`neutrino-custom/production.js`'s `CopyPlugin` rule, effectively
circumventing the webpack build process.

Newer Neutrino correctly uses `html-loader`, causing our HTML to be
parsed during the webpack build for the first time. However now that
the images are being resolved at build time rather than runtime, the
relative paths need to be updated to account for the directory layout
differences between `src/` and `dist/`, to prevent build errors.

A significant benefit of this change is that images referenced from
HTML will now be output with hashed filenames, meaning they get given
long-lived `Cache-Control` headers by WhiteNoise.

See:
https://webpack.js.org/loaders/file-loader/
https://webpack.js.org/loaders/raw-loader/
https://webpack.js.org/loaders/html-loader/
2018-01-24 23:43:58 +00:00
Ed Morley ab3b767ba4 Bug 1364894 - Override Neutrino 4's broken SVG mimetype
Neutrino 4 configured the SVG mimetype as `application/svg+xml`, which
Firefox doesn't appear to like. Neutrino 8 instead doesn't specify a
mimetype directly, allowing `url-loader` to autodetect via the NPM
`mime` package (which returns `image/svg+xml` for SVGs).

This switches to the Neutrino 8 approach, to prevent the job detail
panel's log viewer icon breaking in later commits when we start
parsing HTML properly (which causes url-loader to embed the icon as
a base64 encoded data URI rather than a URL to a file).
2018-01-24 23:43:58 +00:00
Ed Morley 3aba4223a0 Bug 1364894 - Add missing image file extensions to url-loader
Neutrino 4 only configured `url-loader` for use with `.png` and `.jpg`.
This means that once we start parsing HTML properly in later commits,
we would otherwise get the following error:

```
ERROR in ./ui/img/dancing_cat.gif
Module parse failed: C:\Users\Ed\src\treeherder\ui\img\dancing_cat.gif Unexpected character '�' (1:6)
You may need an appropriate loader to handle this file type.
(Source code omitted for this binary file)
 @ ./ui/partials/perf/comparectrl.html 1:214-250
 @ ./ui/partials \.html$
 @ ./ui/js/cache-templates.js
 @ ./ui/js/perfapp.js
 @ ./ui/entry-perf.js
 @ multi ./ui/entry-perf.js
```
2018-01-24 23:43:58 +00:00
Ed Morley 1379746345 Bug 1364894 - Remove unused support for .tmpl partials
The last `.tmpl` file was removed in #2786. The `test` regex in
`neutrino-custom/base.js` has been removed entirely, since without
the `.tmpl` extension it would be no different from the default:
https://github.com/mozilla-neutrino/neutrino-dev/blob/v4.2.0/packages/neutrino-preset-web/src/index.js#L66
2018-01-24 23:43:58 +00:00
Cameron Dawson 4d906bbead Fix benign JS exception when filtering 2018-01-24 08:47:59 -08:00
Rob Wood 14bf8c4c8e
Bug 1431427 - Update buildbot etl for new talos profiling suite (#3162) 2018-01-23 15:58:51 -05:00
Vincenzo Scalzi bcb4011bb9 1413156 - Transfer lodash functions to ES6: includes, indexOf & compact
- includes -> indexOf === -1
- indexOf -> indexOf
- compact -> filter(v => v)
2018-01-22 17:19:13 -08:00
Jonathan French 2b826994ea Bug 1429922 - Return tooltip to backfill menu 2018-01-22 13:25:23 -08:00
Hassan Ali 0acc243fc0 Link machine ID to worker explorer
Presently, when the build system of a job is buildbot, there is a hyper
link on the machine name that takes a user to the slave health
dashboard. When a job runs outside of buildbot, there is a worker
explorer. A worker explorer shows information like most recent task IDs
claimed. Also, a user can perform actions on the machine if they own the
required scopes (e.g., quarantine & terminate instance). This commit
provides a shortcut to the worker explorer when the build system is not
buildbot.
2018-01-22 12:13:39 -08:00
renovate[bot] 28a2ff5cb8 Update lock file (#3158) 2018-01-22 12:00:40 +00:00
Dave Hunt 970f8aaa73 Migrate test_filter_jobs_by_result_status to Travis suite 2018-01-22 10:11:54 +00:00
renovate[bot] 4ed5e3c779 Update dependency jquery to v3.3.1 (#3156) 2018-01-22 01:26:27 +00:00
Ed Morley 4d45f3cf55 Bug 1384518 - Vagrant: Remove memcached server and libraries
Since memcached server and the client headers are now unused.

Whilst the `zlib1g-dev` package is no longer needed by pylibmc, it's
still required as a sub-dependency of `libmysqlclient-dev`, so has
deliberately not been added to the `apt-get purge` cleanup step.
2018-01-21 14:41:35 +00:00
Ed Morley deb1fc86b7 Bug 1384518 - Switch from Memcached to Redis
Since:
* Redis has additional features we need (eg for bug 1409679)
* the Redis server, python client and Django backend are more
  actively maintained (so have persistent connections/pooling that
  actually works, which gives a big perf win)
* we can use Heroku's own Redis addon rather than relying on a
  third-party's (to hopefully prevent a repeat of the certificate
  expiration downtime)

This commit:
* Switches pylibmc/django-pylibmc to redis-py/django-redis, and
  configures the new backend according to:
  http://niwinz.github.io/django-redis/latest/
  https://github.com/andymccurdy/redis-py
* Uses redis-py's native support for TLS to connect to the Heroku
  Redis server's stunnel port directly, avoiding the complexity of
  using a buildpack to create an stunnel between the dyno and server:
  https://devcenter.heroku.com/articles/securing-heroku-redis#connecting-directly-to-stunnel
* Uses explicit `REDIS_URL` values on Travis/Vagrant rather than
  relying on the django-environ `default` value (for parity with
  how we configure `DATABASE_URL` and others).
* Removes the pylibmc connection-closing workaround from `wsgi.py`.

Note: Whilst the Heroku docs suggest using `django-redis-cache`, it's
not as actively maintained, so we're using `django-redis` instead:
https://devcenter.heroku.com/articles/heroku-redis
https://github.com/niwinz/django-redis
https://github.com/sebleier/django-redis-cache

Before this is merged, Heroku Redis instances will need to be created
for stage/production (prototype done) - likely on plan `premium-3`:
https://elements.heroku.com/addons/heroku-redis

We'll also need to pick an eviction policy:
https://devcenter.heroku.com/articles/heroku-redis#maxmemory-policy

Once deployed, the `memcachier-tls-buildpack` buildpack will no longer
be required and can be removed from prototype/stage/prod, along with
the `TREEHERDER_MEMCACHED` environment variable and Memcachier addon.
2018-01-21 14:41:35 +00:00
Ed Morley d9909d5fa2 Bug 1384518 - Add a Redis server instance to Vagrant/Travis
In preparation for later commits, this installs `redis-server` in
the Vagrant environment, and starts the pre-installed (but stopped
by default) `redis-server` on Travis:
https://docs.travis-ci.com/user/database-setup/#Redis

Production/stage/prototype will use Heroku's own Redis add-on:
https://elements.heroku.com/addons/heroku-redis
2018-01-21 14:41:35 +00:00
Ed Morley c36408c1f1 Bug 1384518 - Remove Django cache prefix
The prefix is unnecessary since prod/stage/prototype don't share cache
instances, and the tests now set their own prefix, so won't overlap
with values set during local data ingestion. Django's default prefix
is the empty string:
https://docs.djangoproject.com/en/1.11/ref/settings/#std:setting-CACHES-KEY_PREFIX
2018-01-21 14:41:35 +00:00
renovate[bot] c45f92330f Update dependency jasmine-core to v2.9.1 (#3152) 2018-01-21 12:14:02 +00:00
pyup.io bot 814267f6dd Update aiohttp from 2.3.8 to 2.3.9 (#3155) 2018-01-21 12:06:16 +00:00
pyup.io bot 2a002d1792 Update yarl from 1.0.0 to 1.1.0 (#3153) 2018-01-21 11:48:40 +00:00
Dave Hunt bf0d462735 Migrate test_range to Travis suite 2018-01-19 09:58:23 +00:00
renovate[bot] e8cc1fe515 Update dependency jasmine-core to v2.9.0 (#3149) 2018-01-19 09:50:29 +00:00
pyup.io bot 9f113b92b1 Update certifi from 2017.11.5 to 2018.1.18 (#3148) 2018-01-18 22:27:00 +00:00
Dave Hunt a97a330b9e Improve the stability of the test_select_unclassified_job tests 2018-01-18 16:49:35 +00:00
Ed Morley a429764dec Bug 1384518 - Use finite cache timeouts everywhere
Previously the `cache.set()` calls made by buildapi and pushlog
ingestion did not pass a timeout argument, so used the `settings.py`
global default of `None` (which means never expire).

There are a few disadvantages with this approach:
1) The `cache.set()` calls can't be fully interpreted on their own.
2) Never expiring means stale keys could be left behind (for example
   the last push ID key, when a repository is removed).
3) If Django core functionality or third-party packages use the cache
   but don't set their own timeout, they may be expecting the Django
   default timeout of 5 minutes (or at least a finite timeout).

Now all cache writes in Treeherder explicitly set a timeout, and the
global timeout is restored to the Django default of 5 minutes:
https://docs.djangoproject.com/en/1.11/ref/settings/#timeout
2018-01-17 11:08:39 +00:00
Ed Morley 613dfdc123 Bug 1384518 - Factor out last push ID cache key name
Reduces duplication and chance of the get/set key names not matching.
2018-01-17 11:08:39 +00:00
Ed Morley 009e6e2354 Bug 1384518 - Remove explicit cache VERSION
We've never had a need to adjust it so far, and the default version
is already `1`, so there's no need to manually specify it:
https://docs.djangoproject.com/en/1.11/ref/settings/#version
2018-01-17 11:08:39 +00:00
Ed Morley 525eaeb1c1 Bug 1384518 - Add a utils.py helper for hostname parsing 2018-01-17 11:08:39 +00:00
Ed Morley 12ec94eb6a Bug 1384518 - Move server_supports_tls() out of settings.py
Since we'll soon have move settings utility functions to go alongside
it. Also renames it to `connection_should_use_tls()`.
2018-01-17 11:08:39 +00:00
Ed Morley 56697adb1f Bug 1384518 - Vagrant: Simplify .profile helper functions
Uses our custom `clear_cache` Django management command instead of
restarting memcached, since (a) for memcached has the same effect,
(b) will continue to work even after we switch to Redis (which instead
persists cache contents across server restarts).

Removes the `threstartmemcached` command since IMO it's no simpler
than just running `./manage.py clear_cache` on its own.
2018-01-17 11:08:39 +00:00
Ed Morley 03027d8ba9 Bug 1384518 - Tests: Use a cache key prefix when running tests
To prevent them clashing with keys created by running data ingestion
locally in Vagrant.
2018-01-17 11:08:39 +00:00
Ed Morley f8a8188d26 Bug 1384518 - Tests: Clean up cache testing in test_setup.py
* Adjusts the test name and docstring, since there is nothing
  memcached-specific about the test.
* Overrides the default timeout of never to 10 seconds, to prevent
  previous test run values persisting.
2018-01-17 11:08:39 +00:00
Dave Hunt 578e186fe9 Migrate test_select_next_unclassified_job to Travis suite 2018-01-17 08:10:44 +00:00
Kartikaya Gupta 6a10bdf674 Bug 1430171 - Allow scrolling the shortcut table when viewing on smaller screens 2018-01-16 17:07:26 -08:00
pyup.io bot f55bdc03a7 Update aiohttp from 2.3.7 to 2.3.8 (#3142) 2018-01-16 17:01:01 +00:00
pyup.io bot b88929a33b Update elasticsearch from 5.4.0 to 5.5.2 (#3140) 2018-01-16 16:32:15 +00:00
renovate[bot] 59dd088a86 Update lock file (#3134) 2018-01-16 10:54:16 +00:00
pyup.io bot f495f16d0d Update pytest-variables from 1.7.0 to 1.7.1 (#3138) 2018-01-15 15:54:50 +00:00
pyup.io bot 95cf965c6d Update yarl from 0.18.0 to 1.0.0 (#3137) 2018-01-15 15:42:28 +00:00
pyup.io bot 2efcc42a2b Update multidict from 3.3.2 to 4.0.0 (#3136) 2018-01-15 15:35:19 +00:00
renovate[bot] 15066ececb Update dependency ajv to v6.0.1 (#3130) 2018-01-12 22:46:58 +00:00
pyup.io bot 36ebe5cedf Update pytest-selenium from 1.11.3 to 1.11.4 (#3124) 2018-01-11 11:44:12 +00:00
Ed Morley f7ac7ba3f5
Vagrant: Remove no longer needed g++ package (#3125)
Since Brotli now ships as a wheel, so doesn't need g++ to build.
2018-01-11 11:43:36 +00:00
Ed Morley 75606492dd
Remove references to previously removed .profile helper aliases (#3123)
The `tabname` and `thlogsdelete` functions were removed in #1995.
2018-01-11 11:21:41 +00:00