Commit Graph

13 Commits

Author SHA1 Message Date
Durham Goode
968e57735d configs: use zstd compression for remote config request
Summary:
The remote configs are non-minified json, so using some compression
should reduce their size tremendously.

Reviewed By: quark-zju

Differential Revision: D22336251

fbshipit-source-id: 77282aae57a8e37e3462f6379dedebd2978a4d0e
2020-07-02 09:02:15 -07:00
Durham Goode
b0f4136830 configs: limit how often we query the server for configs
Summary:
Since we are querying intern for remote configs, we don't want to spam
the servers with requests if they're down. Therefore let's implement some basic
rate limiting to prevent us from querying the server too often. The default
behavior is limiting it to once every 5 minutes.

We only generate new configs once every 15 minutes, so generally this rate limit
shouldn't have any effect, but if there are errors in the generation process
it's possible for generation to happen much more frequently, so this will guard
us from hitting the server too frequently.

Reviewed By: quark-zju

Differential Revision: D22243316

fbshipit-source-id: bbccaf63da95af1edc3128f4d2047a32f90e53ba
2020-06-30 09:50:44 -07:00
Durham Goode
3fbb5de94a configs: add an easy way to test config changes locally
Summary:
The HG_TEST_REMOTE_CONFIG environment variable was added to allow tests
to declare custom remote config values, but we can also use it to make canarying
easier.

With this change, users can do `HG_TEST_REMOTE_CONFIG=configerator hg
debugdynamicconfig` to test a change, after running arc build in their
configerator.

We might want to simplify this further in the future to some sort of hidden dev
command line flag, like `hg debugdynamicconfig --canary-remote`

Reviewed By: quark-zju

Differential Revision: D22081459

fbshipit-source-id: 07977097347af9d5872402beeda0ed9160176e7e
2020-06-30 09:50:44 -07:00
Durham Goode
ee51bf871f configs: apply remote configs during dynamic config generation
Summary: Now that we fetch remote configs, let's apply them locally.

Reviewed By: quark-zju

Differential Revision: D22079767

fbshipit-source-id: aafc9a2e1e6a60b7b6087eaf256dafce30ca5a1e
2020-06-30 09:50:44 -07:00
Durham Goode
977155ef99 configs: fetch remote configs during dynamic config generation
Summary:
Fetches configs from a remote endpoint and caches them locally. If the
remote endpoint fails to respond, we use the cached version.

Reviewed By: quark-zju

Differential Revision: D22010684

fbshipit-source-id: bd6d4349d185d7450a3d18f9db2709967edc2971
2020-06-30 09:50:44 -07:00
Durham Goode
0c5a19eaab configs: move Repo enum to fb/ module
Summary:
Let's hide the repo list in the fb/ module since we don't really want
to expose the whole repo list in our public repo.

Reviewed By: sfilipco

Differential Revision: D21731419

fbshipit-source-id: 22ca20a3a80637c852e313f1390849aac1fecbf4
2020-05-28 12:14:08 -07:00
Durham Goode
b922952589 configs: convert fbsource_overrides.rc
Summary: Converts fbsource_overrides.rs to our dynamic config generator

Reviewed By: quark-zju

Differential Revision: D21536497

fbshipit-source-id: 26d4cc656114bc7bd85c2bf09b149d78cc8eb08a
2020-05-14 10:27:43 -07:00
Durham Goode
f181eef520 configs: convert ovrsource_overrides.rc
Summary: Converts ovrsource_overrides.rs to our dynamic config generator

Reviewed By: quark-zju

Differential Revision: D21536498

fbshipit-source-id: 3f0021b7be90a82e5a517fa81fb3dad04b2837ed
2020-05-14 10:27:42 -07:00
Durham Goode
939ff6c956 configs: move repo names to a enum
Summary:
A number of repo names are used quite frequently. Let's use an enum to
prevent typos and make things cleaner.

Reviewed By: quark-zju

Differential Revision: D21365036

fbshipit-source-id: 1d3d681443df181e9076f5ee87029ae61124a486
2020-05-06 09:03:17 -07:00
Durham Goode
6e7f85b949 config: load .hg/hgrc.dynamic
Summary:
Adds .hg/hgrc.dynamic to the default load path, before .hg/hgrc though,
so it can be override.

Reviewed By: quark-zju

Differential Revision: D21310921

fbshipit-source-id: 288a2a2ba671943a9f8532489c29e819f9d891e1
2020-05-05 18:19:08 -07:00
Durham Goode
dc90e2ca04 configs: add domain, platform, and improve dynamicconfigs
Summary:
Adds dynamic config conditionals for domain, platform, and adds a few
useful helper functions.

Reviewed By: quark-zju

Differential Revision: D21310920

fbshipit-source-id: 58f35e52d6d7a4edae2b3aefff533ef2c021aa57
2020-05-05 18:19:08 -07:00
Durham Goode
3ac2be361a configs: move fbrules to a Facebook only part of the crate
Summary:
We'll be adding a bunch of Facebook specific configuration and values
here. Let's move it to someplace not open source.

Reviewed By: quark-zju

Differential Revision: D21241038

fbshipit-source-id: 2ac9cdce40b1b46f15f171d9d1f6b6692dcd29bf
2020-05-01 13:17:21 -07:00
Durham Goode
bfe0c8d7ab configs: add dynamic config generator
Summary:
We want Mercurial to become more responsible for it's own
configuration, instead of relying on chef and other means. To do so, let's
introduce a new `hg debugdynamicconfig` that can generate dynamic configs for
a given repository based on various states, like what tier it's in or what shard
that machine is in.  By default it generates to '.hg/hgrc.dynamic' for the given
repository.

Currently it just sets the hostgroup config.

Future diffs will make Mercurial consume this config, and possibly have Mercurial
call this command asynchronously when it notices the file is out-of-date.

Reviewed By: quark-zju

Differential Revision: D20828132

fbshipit-source-id: 6f5bf749f5b04e0a5989d6dc19ee788c2e47f88f
2020-04-14 21:22:26 -07:00