Commit Graph

368 Commits

Author SHA1 Message Date
Lukas Piatkowski
0f8e20df5b mononoke/integration tests: fix returning different output in OSS cases in tests (#60)
Summary:
Pull Request resolved: https://github.com/facebookexperimental/eden/pull/60

For the tests that output different data to stdout in OSS vs FB create helpers that remove the differences.

Reviewed By: farnz

Differential Revision: D23814134

fbshipit-source-id: c6656528021c9a90b98e3c89a9bbe8c5178c6919
2020-09-21 09:39:18 -07:00
Mark Thomas
2600860e69 scsc: implement land-stack and test stack landing via the service
Summary:
Add `scsc land-stack` to facilitate testing of stack landing via the source control service.
Use this to test that landing of stacks works.

Reviewed By: aslpavel

Differential Revision: D23813366

fbshipit-source-id: 1f7b682fa5e33a232cb1da5c702a703223658942
2020-09-21 08:39:13 -07:00
Mark Thomas
78b943019a mononoke_api: most bookmark movements errors are request errors
Summary:
Update the conversion of `BookmarkMovementError` to `MononokeError` to reflect
that most movement errors are caused by invalid requests.

Reviewed By: aslpavel

Differential Revision: D23814794

fbshipit-source-id: 48503353aaae7b3cd03e5221a8ad014eef2e9414
2020-09-21 08:39:12 -07:00
Lukasz Piatkowski
e8098beff0 mononoke/integration tests: fix issue with missing dulwich for hggit ext (#59)
Summary: Pull Request resolved: https://github.com/facebookexperimental/eden/pull/59

Reviewed By: farnz

Differential Revision: D23783095

Pulled By: lukaspiatkowski

fbshipit-source-id: cb6a72ae3d8856a92945c28e4162c1808539206a
2020-09-19 05:47:30 -07:00
Thomas Orozco
05e9fa3a29 mononoke/gotham_ext: remove Brotli support
Summary:
I saw this throw the LFS server into an infinite loop when I tested it. We're
not using this right now, so I'm not investing time into root-causing the
issue, and instead let's just take this out.

Reviewed By: StanislavGlebik

Differential Revision: D23782757

fbshipit-source-id: f320fc72c3ff279042c2fe9fcb9c4904e9e1bfdf
2020-09-18 05:39:38 -07:00
Lukas Piatkowski
78d30ad17f eden/edenapi and mononoke integration tests: add edenapi/tools to getdeps and use them in tests (#51)
Summary:
Pull Request resolved: https://github.com/facebookexperimental/eden/pull/51

This diff extends capabilities of CargoBuilder in getdeps so that individual manifests can be build even without workspaces. Thanks to that a build for edenapi/tools can be made and its artifacts can be used in mononoke integration tests.

Reviewed By: StanislavGlebik

Differential Revision: D23574887

fbshipit-source-id: 8a974a6b5235d36a44fe082aad55cd380d84dd09
2020-09-18 04:20:56 -07:00
Lukas Piatkowski
30aad29a1e mononoke/commitcloud_bookmarks_filler: make it public (#58)
Summary:
Pull Request resolved: https://github.com/facebookexperimental/eden/pull/58

This makes the test-bookmarks-filler.t pass. Additionally remove few tests from exclusion lists as they started to pass.

Reviewed By: ikostia

Differential Revision: D23757401

fbshipit-source-id: eddcda5fd1806d77d0046b6ced3695df6b3d775d
2020-09-17 07:38:53 -07:00
Lukasz Piatkowski
64da367e63 mononoke/integration CI: try to free up some space before running tests (#57)
Summary:
We are running out of space on integration tests runs on Linux. In order to avoid that this change is adding some cleanups.

1. Adding `docker rmi $(docker image ls -aq)` frees up 4 GB.
2. Cleaning up `eden_scm` build directory frees up 3 GB.
3. Cleaning up `mononoke` build directory frees up 1 GB.

This diff also includes a fix for run_tests_getdeps.py where we run all the "PASSING" tests when --rerun flag is passed instead of only the failed ones.

Pull Request resolved: https://github.com/facebookexperimental/eden/pull/57

Reviewed By: krallin

Differential Revision: D23742159

Pulled By: lukaspiatkowski

fbshipit-source-id: 3b5e89ad29c753d585c1a6f01a9a1d6c1e616fbf
2020-09-17 07:38:53 -07:00
Lukas Piatkowski
9d17ba2078 mononoke: fix OSS build after deprecating preamble in favor of metadata
Summary: fixes build and test errors on OSS introduced by D23596262 (deb57a25ed)

Reviewed By: ikostia

Differential Revision: D23757086

fbshipit-source-id: 7973ce36b3589cbe21590bd7e19a9828be72128f
2020-09-17 07:38:53 -07:00
Viet Hung Nguyen
c8b4a796ec mononoke/repo_import: add process recoverability
Summary: Since repo_import tool is automated, we need a way to recover the process when the tool break without restarting the whole process. To do this, I defined a new struct (RecoveryFields) that allows us to keep track of the state. The most important fields are the import_stage (ImportStage) we need for keeping track of the process and to indicate the first stage of recovery, and the cs_ids we use throughout the process. For each stage in importing, we save the state after we have finished that part. This way we can also recover from interrupts. To do process recovery, we only need to use `recover-process <file_path>` subcommand, where file_path stores the saved state of importing. For normal run we will use `import [<args>]` subcommand.

Reviewed By: krallin

Differential Revision: D23678367

fbshipit-source-id: c0e0b270ea2ccc499368e54f37550cfa58c03970
2020-09-17 05:58:08 -07:00
Durham Goode
d832ea7afa treemanifest: change local tree sending to depend on phases
Summary:
When sending trees and files we try to avoid sending trees that are
available from the main server. To do so, we currently check to see if the
tree/file is from the local store (i.e. .hg/store instead of $HGCACHE).

In a future diff we'll be moving trees to use the Rust store, which doesn't
expose the difference between shared and local stores. So we need to stop
depending on logic to test the local store.

Instead we can test if the commit is public or not, and only send the tree/file
is the commit is not public. This is technically a revert of the 2018 D7992502 (5e95b0e32e)
diff, which stopped depending on phases because we'd receive public commits from
svn there were not public on the server yet. Since svn is gone, I think it's
safe go back to that way.

This code was usually to help when the client was further ahead than another
client and in some commit cloud edge cases, but 1) we don't do much/any p2p
exchange anymore, and 2) we did some work this year to ensure clients have more
up-to-date remote bookmarks during exchange (as a way of making phases and
discovery more reliable), so hopefully we can rely on phases more now.

Reviewed By: quark-zju

Differential Revision: D23639017

fbshipit-source-id: 34c13aa2b5ef728ea53ffe692081ef443e7e57b8
2020-09-16 21:39:25 -07:00
Stanislau Hlebik
600e1a278c mononoke: update counter when entry was skipped
Summary:
There was a bug. If an entry was skipped then we haven't updated the counter.
That means we might skip the same entry over and over again.

Let's fix it

Reviewed By: ikostia

Differential Revision: D23728790

fbshipit-source-id: f323d14c4deba5736ceb8ada7cb7ee48a69c1272
2020-09-16 10:33:05 -07:00
Johan Schuijt-Li
deb57a25ed mononoke: deprecate preamble in favor of metadata
Summary:
In preparation of moving away from SSH as an intermediate entry point for
Mononoke, let Mononoke work with newly introduced Metadata. This removes any
assumptions we now make about how certain data is presented to us, making the
current "ssh preamble" no longer central.

Metadata is primarily based around identities and provides some
backwards-compatible entry points to make sure we can satisfy downstream
consumers of commits like hooks and logs.

Simarly we now do our own reverse DNS resolving instead of relying on what's
been provided by the client. This is done in an async matter and we don't rely
on the result, so Mononoke can keep functioning in case DNS is offline.

Reviewed By: farnz

Differential Revision: D23596262

fbshipit-source-id: 3a4e97a429b13bae76ae1cdf428de0246e684a27
2020-09-15 10:28:38 -07:00
Thomas Orozco
d7081f6aba lfs: add client support for received compressed responses
Summary:
As it says in the title, this adds support for receiving compressed responses
in the revisionstore LFS client. This is controlled by a flag, which I'll
roll out through dynamicconfig.

The hope is that this should greatly improve our throughput to corp, where
our bandwidth is fairly scarce.

Reviewed By: StanislavGlebik

Differential Revision: D23652306

fbshipit-source-id: 53bf86d194657564bc3bd532e1a62208d39666df
2020-09-15 07:59:53 -07:00
Thomas Orozco
acc0d428cc mononoke/lfs_server: add support for response compression
Summary:
This adds support for compressing responses in the LFS Server, based on what
the client sent in `Accept-Encoding`. The compression changes are fairly
simple. Most of the codes changes are around the fact that when we compress,
we don't send a Content-Length (because we don't know how long the content will
be).

Note that this is largely implemented in StreamBody. This means it can be used
for free by the EdenAPI server as well. The reason it's in there is because we
need to avoid setting the Content-Length when compression is going to be used
(`StreamBody` is what takes charge for doing this). This also exposes a
callback to get access to the stream post-compression, which also needs to be
exposed in `StreamBody`, since that's where compression happens.

Reviewed By: aslpavel

Differential Revision: D23652334

fbshipit-source-id: 8f462d69139991c3e1d37f392d448904206ec0d2
2020-09-15 07:59:53 -07:00
Stanislau Hlebik
cb0b332622 mononoke: add bookmark regex to mononoke_x_repo_sync_job
Summary:
This would let us allow only a certain bookmarks to be remapped from a small
repo to a large repo.

Reviewed By: krallin

Differential Revision: D23701341

fbshipit-source-id: cf17a1a21b7594a94c5fb117065f7d9298c8d1af
2020-09-15 04:23:05 -07:00
Pavel Aslanov
463acc581d use derived data infra to derive mercurial changesets
Summary:
This completely converts mercurial changeset to be an instance of derived data:
 - Custom lease logic is removed
 - Custom changeset traversal logic is removed

Naming scheme of keys for leases has been changed to conform with other derived data types. This might cause temporary spike of cpu usage during rollout.

Reviewed By: farnz

Differential Revision: D23575777

fbshipit-source-id: 8eb878b2b0a57312c69f865f4c5395d98df7141c
2020-09-11 07:23:11 -07:00
Lukas Piatkowski
e7ac59eae4 mononoke/integration runner: add flag to choose which tests to run (#56)
Summary:
Pull Request resolved: https://github.com/facebookexperimental/eden/pull/56

Additionally to adding a flag as in the commit title the "test-scs*" tests are being excluded via pattern rather than listed out. This will help in future when more tests using scs_server will be added as the author won't have to list it in exclusion list.

Reviewed By: farnz

Differential Revision: D23647298

fbshipit-source-id: f5c263b9f68c59f4abf9f672c7fe73b63fa74102
2020-09-11 06:03:16 -07:00
Stanislau Hlebik
d402b5880c mononoke: support _gitlookup lookup calls
Summary:
lookup has special support for requests that start with _gitlookup. It remaps
hg commit to git commit and vice versa. Let's support that in mononoke as well.

Reviewed By: krallin

Differential Revision: D23646778

fbshipit-source-id: fcde58500b5956201e718b0a609fc3fee1bbdd28
2020-09-11 04:30:24 -07:00
Lukasz Piatkowski
1d2340782a mononoke/integration: exclude the most flaky tests (#55)
Summary: Pull Request resolved: https://github.com/facebookexperimental/eden/pull/55

Reviewed By: farnz

Differential Revision: D23622449

Pulled By: lukaspiatkowski

fbshipit-source-id: 79e1895f2c6191a2968d0cff226a38ba47188431
2020-09-10 03:26:09 -07:00
Lukasz Piatkowski
c044f1669a mononoke/integration tests: deal with bash issues on tests (#50)
Summary:
One test was fixed earlier by switching MacOS to use modern version of bash, the other is fixed here by installing "nmap" and using "ncat" from within it on both linux and mac.

Pull Request resolved: https://github.com/facebookexperimental/eden/pull/50

Reviewed By: krallin

Differential Revision: D23599695

Pulled By: lukaspiatkowski

fbshipit-source-id: e2736cee62e82d1e9da6eaf16ef0f2c65d3d8930
2020-09-10 01:56:54 -07:00
Durham Goode
f5a2347fbb py3: fix Mononoke Python 3 test failures
Summary:
Fixes a few issues with Mononoke tests in Python 3.

1. We need to use different APIs to account for the unicode vs bytes difference
for path hash encoding.
2. We need to set the language environment for tests that create utf8 file
paths.
3. We need the redaction message and marker to be bytes.  Oddly this test still
fails with jq CLI errors, but it makes it past the original error.

Reviewed By: quark-zju

Differential Revision: D23582976

fbshipit-source-id: 44959903aedc5dc9c492ec09a17b9c8e3bdf9457
2020-09-09 18:31:04 -07:00
Lukasz Piatkowski
c983dc96fe mononoke/integration tests: fix using private certs during Mac tests with hg (#53)
Summary:
The Mac integration test workflow already installs a modern curl that fixes https://github.com/curl/curl/issues/4801, but it does so after "hg" is built, so "hg" uses the system curl libraries, which fails when used with a certificate not present in keychain.

Pull Request resolved: https://github.com/facebookexperimental/eden/pull/53

Reviewed By: krallin

Differential Revision: D23597285

Pulled By: lukaspiatkowski

fbshipit-source-id: a7b8b6ae55ce338bfb9946a852cbb6b929e73203
2020-09-09 07:28:09 -07:00
Simon Farnsworth
9b9607b02e Have manual_scrub continue on errors, writing out files to let you retry instead
Summary:
There are blobs that fail to scrub and terminate the process early for a variety of reasons; when this is running as a background task, it'd be nice to get the remaining keys scrubbed, so that you don't have a large number of keys to fix up later.

Instead of simply outputting to stdout, write keys to one of three files in the format accepted on stdin:

1. Success; you can use `sort` and `comm -3` to remove these keys from the input dat, thus ensuring that you can continue scrubbing.
2. Missing; you can look at these keys to determine which blobs are genuinely lost from all blobstores, and fix up.
3. Error; these will need running through scrub again to determine what's broken.

Reviewed By: krallin

Differential Revision: D23574855

fbshipit-source-id: a613e93a38dc7c3465550963c3b1c757b7371a3b
2020-09-09 07:25:13 -07:00
Lukasz Piatkowski
2b65fabc17 mononoke/integration tests: remove non-existent test-traffic-replay.t from exclusion list (#54)
Summary: Pull Request resolved: https://github.com/facebookexperimental/eden/pull/54

Reviewed By: ahornby

Differential Revision: D23597167

Pulled By: lukaspiatkowski

fbshipit-source-id: 1bc92ff32384a02ef019778a20c44634addadf25
2020-09-09 07:00:54 -07:00
Lukasz Piatkowski
c9bbf63cab mononoke/integration tests: handle case-sensitive related tests (#49)
Summary:
The test-blobimport.t creates few files that are conflicting in a case insensitive file system, so make them differ by changing number of underscores in one of the files.

test-pushrebase-block-casefolding.t is directly testing a feature of case sensitive file system, so it cannot be really tested on MacOS

Pull Request resolved: https://github.com/facebookexperimental/eden/pull/49

Reviewed By: farnz

Differential Revision: D23573165

Pulled By: lukaspiatkowski

fbshipit-source-id: fc16092d307005b6f0c8764c1ce80c81912c603b
2020-09-09 03:53:32 -07:00
Thomas Orozco
2948993c38 remotefilelog: add killswitch for client certs
Summary:
See D23538897 for context. This adds a killswitch so we can rollout client
certs gradually through dynamicconfig.

Reviewed By: StanislavGlebik

Differential Revision: D23563905

fbshipit-source-id: 52141365d89c3892ad749800db36af08b79c3d0c
2020-09-08 10:39:07 -07:00
Thomas Orozco
d1c4772da3 remotefilelog: use client certs when connecting to LFS
Summary:
Like it says in the title, this updates remotefilelog to present client
certificates when connecting to LFS (this was historically the case in the
previous LFs extension). This has a few upsides:

- It lets us understand who is connecting, which makes debugging easier;
- It lets us enforce ACLs.
- It lets us apply different rate limits to different use cases.

Config-wise, those certs were historically set up for Ovrsource, and the auth
mechanism will ignore them if not found, so this should be safe. That said, I'd
like to a killswitch for this nonetheless. I'll reach out to Durham to see if I
can use dynamic config for that

Also, while I was in there, I cleaned up few functions that were taking
ownership of things but didn't need it.

Reviewed By: DurhamG

Differential Revision: D23538897

fbshipit-source-id: 5658e7ae9f74d385fb134b88d40add0531b6fd10
2020-09-08 10:39:07 -07:00
Stanislau Hlebik
bf8a8c4cc9 mononoke: try to fix the test-redaction.t
Summary:
This test fail on sandcastle because the last two lines are not showing up.
I have a hunch that the last two lines just weren't flushed, and this diff
attempts to fix it.

Reviewed By: krallin

Differential Revision: D23570321

fbshipit-source-id: fd7a3315582c313a05e9f46b404e811384bd2a50
2020-09-08 04:29:33 -07:00
Lukas Piatkowski
fbfb856191 mononoke/integration test: make test-traffic-replay.t private
Reviewed By: StanislavGlebik

Differential Revision: D23565712

fbshipit-source-id: 7cb2d4a6c107ff513522e7343ffd5a8eea25879c
2020-09-07 10:35:39 -07:00
Lukasz Piatkowski
52bc18a728 mononoke/integration tests: fix up integration tests using hooks (#48)
Summary:
Hooks have been recently made public. Remove from list of excluded tests the ones that were blocked by missing hooks and fix them up.

Pull Request resolved: https://github.com/facebookexperimental/eden/pull/48

Reviewed By: farnz

Differential Revision: D23564883

Pulled By: lukaspiatkowski

fbshipit-source-id: 101dd093eb11003b8a4b4aa4c5ce242d9a9b9462
2020-09-07 08:42:39 -07:00
Jun Wu
89eb6520d2 scmutil: remove meaningfulparents
Summary:
The "meaningfulparents" concept is coupled with rev numbers.
Remove it. This changes default templates to not show parents, and `{parents}`
template to show parents.

Reviewed By: DurhamG

Differential Revision: D23408970

fbshipit-source-id: f1a8060122ee6655d9f64147b35a321af839266e
2020-09-05 15:06:44 -07:00
Lukasz Piatkowski
20b082ee6a mononoke/integration tests: blacklist 2 integration tests on OSS runs (#47)
Summary:
Those are new tests that use functionality not compatible yet with OSS.

Pull Request resolved: https://github.com/facebookexperimental/eden/pull/47

Reviewed By: chadaustin

Differential Revision: D23538921

Pulled By: lukaspiatkowski

fbshipit-source-id: c512a1b2359f9ff772d0e66d2e6a66f91e00f95c
2020-09-04 20:21:56 -07:00
Thomas Orozco
3ba2c2b429 mononoke/hg_sync: make it work on Mercurial Python 3
Summary:
A few things here:

- The heads must be bytes.
- The arguments to wireproto must be strings (we used to encode / decode them,
  but we shouldn't).
- The bookmark must be a string (otherwise it gets serialized as `"b\"foo\""`
  and then it deserializes to that instead of `foo`).

Reviewed By: StanislavGlebik

Differential Revision: D23499846

fbshipit-source-id: c8a657f24c161080c2d829eb214d17bc1c3d13ef
2020-09-04 11:56:44 -07:00
Thomas Orozco
747b355236 mononoke: make mononoke_hg_sync_job sendunbundlereplaybatch more debuggable
Summary:
Right now we get very little logging out of errors in here, which is making it
difficult to fix it on Py3 (where it currently is broken).

This diff doesn't fix anything, but at the very least, let's make the errors
better so we can make this easier to start debugging.

Reviewed By: ahornby

Differential Revision: D23499369

fbshipit-source-id: 7ee60b3f2a3be13f73b1f72dee062ca80cb8d8d9
2020-09-04 11:56:44 -07:00
Thomas Orozco
c8dd8ae4e3 mononoke: run tests using hg Python 3 as well
Summary:
The motivation for this is to surface potential regressions in hg Python 3 by
testing code paths that are exercised in Mononoke. The primary driver for this
were the regressions in the LFS extension that broke uploads, and for which we
have test coverage here in Mononoke.

To do this, I extracted the manifest generation (the manifest is the list of
binaries that the tests know about, which is passed to the hg test runner), and
moved it into its own function, then added a new target for the py3 tests.

Unfortunately, a number of tests are broken in Python 3 currently. We should
fix those. It looks like there are some errors in Mercurial when walking a
manifest with non-UTF-8 files, and the other problem is that the hg sync job is
in fact broken: https://fburl.com/testinfra/545af3p8.

Reviewed By: ahornby

Differential Revision: D23499370

fbshipit-source-id: 762764147f3b57b2493d017fb7e9d562a58d67ba
2020-09-04 11:56:44 -07:00
Stanislau Hlebik
7b323a4fd9 mononoke: add log-only mode in redaction
Summary:
Before redacting something it would be good to check that this file is not
accessed by anything. Having log-only mode would help with that.

Reviewed By: ikostia

Differential Revision: D23503666

fbshipit-source-id: ae492d4e0e6f2da792d36ee42a73f591e632dfa4
2020-09-04 07:37:15 -07:00
Stanislau Hlebik
0740f99f13 mononoke: allow logging censored scuba accesses to file
Summary:
In the next diff I'm going to add log-only mode to redaction, and it would be
good to have a way of testing it (i.e. testing that it actually logs accesses
to bad keys).

In this diff let's use a config option that allows logging censored scuba
accesses to file, and let's update redaction integration test to use it

Reviewed By: ikostia

Differential Revision: D23537797

fbshipit-source-id: 69af2f05b86bdc0ff6145979f211ddd4f43142d2
2020-09-04 07:37:14 -07:00
Viet Hung Nguyen
7c34b39ec8 mononoke/repo_import: add backsyncing to rewrite file paths, remove backup file
Summary:
add backsyncing to rewrite file paths:
After setting the variables for large repo (D23294833 (d6895d837d)), we try to import the git commits into large repo and rewrite the file paths.
Following this, repo import tool should back-sync the commits into small_repo.

next step: derive all the data types for both small and large repos. Currently, we only derive it for the large repo.

==============
remove backup file:
The backup file was a last-minute addition when trying to import a repo for the first time.
Removed it, because we shouldn't write to external files. Future plan is to include
better process recoverability across the whole tool and not just rewrite file paths functionality.

Reviewed By: StanislavGlebik

Differential Revision: D23452571

fbshipit-source-id: bda39694fa34788218be795319dbbfd014ba85ff
2020-09-03 06:43:08 -07:00
Stanislau Hlebik
29bbc0dc15 mononoke: check if content we are about to redact is not reachable
Summary:
That's one of the sev followups. Before redacting a file content let's check if
it exists in "main-bookmark" (which is be default master), and refuse to redact
if it actually exists.

If this check passes (i.e. the content we are about to redact is not reachable
from master) that doesn't mean that we are 100% safe. E.g. this comment can be
in ancestor of master, or in any other repo or it can be added in the next
commit.

This check is a best-effort check to prevent shooting ourselves in the foot.

Reviewed By: aslpavel

Differential Revision: D23476278

fbshipit-source-id: 5a4cd10964a65b8503ba9a6391f17319f0ce37d8
2020-09-03 01:30:14 -07:00
Stefan Filip
da4c33c67a tests: add commit-location-to-hash integration test
Summary: Exercise location-to-hash functionality in edenapi.

Reviewed By: kulshrax

Differential Revision: D23456214

fbshipit-source-id: 2ab22eb045517a5927c2de502d8cfc9898daecef
2020-09-02 17:20:43 -07:00
Thomas Orozco
b8e197fdb4 mononoke/lfs_server: allow enabling rate limits probabilistically
Summary:
If we exceed a rate limit, we probably don't want to just drop 100% of traffic.
This would create a sawtooth pattern where we allow a bunch of traffic, update
our counters, drop a bunch of traffic, update our counters again, allow a bunch
of traffic, etc.

To fix this, let's make limits probabilistic. This lets us say "beyond X GB/s,
drop Y% of traffic", which is closer to a sane rate limit.

It might also make sense to eventually change this to use ratelim. Initially,
we didn't do this because we needed our rate limiting decisions to be local to
a single host (because different hosts served different traffic), but now that
we spread the load for popular blobs across the whole tier, we should be able
to just delegate to ratelim.

For now, however, let's finish this bit of a functionality so we can turn it
on.

The corresponding Configerator change is here: D23472683

Reviewed By: aslpavel

Differential Revision: D23472945

fbshipit-source-id: f7d985fded3cdbbcea3bc8cef405224ff5426a25
2020-09-02 11:02:18 -07:00
Durham Goode
fe56f44ca0 treemanifest: prevent fetching nullid
Summary:
Mononoke throws an error if we request the nullid. In the long term we
want to get rid of the concept of the nullid entirely, so let's just add some
Python level blocks to prevent us from attempting to fetch it. This way we can
start to limit how much Rust has to know about these concepts.

Reviewed By: sfilipco

Differential Revision: D23332359

fbshipit-source-id: 8a67703ba1197ead00d4984411f7ae0325612605
2020-08-27 09:59:40 -07:00
Stefan Filip
902bdfd46a tests: set --noproxy localhost for all sslcurl calls
Summary:
Without the `--noproxy localhost` flag curl will obey the `https_proxy` env
variable but will not respect the `no_proxy` env variable or `curlrc`.
This means that tests running in a shell with `https_proxy` will likely fail.
The failures may vary in aspect based on what logic is running at the time.

Reviewed By: kulshrax

Differential Revision: D23360744

fbshipit-source-id: 0383a141e848bd2257438697e699f727d79dd5d2
2020-08-26 18:40:52 -07:00
Mark Thomas
dee916ec4c bookmarks_movement: handle services with all or no permitted paths
Summary:
If a service is configured with no permitted paths, ensure we deny any writes
that might affect any path.  This is not hugely useful, and probably means a
configuration error, but it's the safe choice.

In a similar vein, if a service is permitted to modify any path, there's not
much point in checking all the commits, so skip the path checks to save some
time.

Reviewed By: StanislavGlebik

Differential Revision: D23316392

fbshipit-source-id: 3d9bf034ce496540ddc4468b7128657e446059c6
2020-08-25 09:14:09 -07:00
Mark Thomas
eed7df1c52 bookmarks_movement: add integration test for bookmark modifications
Summary:
This tests creating, moving and deleting bookmarks using the source control
service, making sure that hooks and service write restrictions are applied
appropriately.

Reviewed By: StanislavGlebik

Differential Revision: D23287999

fbshipit-source-id: bd7e66ec3668400a617f496611e4f24f33f8083e
2020-08-25 09:14:09 -07:00
Mark Thomas
bd24c15579 repo_client: fix fast-forward failure falsehood
Summary:
The error message for fast-forward failure is wrong.  The correct way to allow
non-fast-forward moves is with the NON_FAST_FORWARD pushvar.

Reviewed By: StanislavGlebik

Differential Revision: D23243542

fbshipit-source-id: 554cdee078cd712f17441bd10bd7968b0674bbfe
2020-08-25 09:14:08 -07:00
Mark Thomas
61d45865de bookmarks_movement: prepare for running hooks on additional changesets
Summary:
When bookmarks are moved or created, work out what additional changesets
should have the hooks run on them.  This may apply to plain pushes,
force pushrebases, or bookmark only pushrebases.

At first, this will run in logging-only mode where we will count how many
changesets would have hooks run on them (up to a tunable limit).  We can
enable running of hooks with a tunable killswitch later on.

Reviewed By: StanislavGlebik

Differential Revision: D23194240

fbshipit-source-id: 8031fdc1634168308c7fe2ad3c22ae4389a04711
2020-08-25 09:14:08 -07:00
Mark Thomas
889e84f8d5 bookmarks_movement: move hook running into bookmarks_movement
Summary:
Move the running of hooks from in `repo_client` to in `bookmarks_movement`.

For pushrebase and plain push we still only run hooks on the new commits the client has sent.
Bookmark-only pushrebases, or moves where some commits were already known, do not run
the hooks on the omitted changesets.  That will be addressed next.

The push-redirector currently runs hooks in the large repo.  Since hook running has now been moved
to later on, they will automatically be run on the large repo, and instead the push-redirector runs them on
the small repo, to ensure they are run on both.

There's some additional complication with translating hook rejections in the push-redirector.  Since a
bookmark-only push can result in hook rejections for commits that are not translated, we fall back to
using the large-repo commit hash in those scenarios.

Reviewed By: StanislavGlebik

Differential Revision: D23077551

fbshipit-source-id: 07f66a96eaca4df08fc534e335e6d9f6b028730d
2020-08-25 09:14:07 -07:00
Egor Tkachenko
7fd2f22cc0 Fix bug with zero hash manifest
Summary:
If the imported commit has manifest id with all zeros (empty commit). Blobimport job can't find it in blobstore and returns error D23266254.
Add an early return when the manifest_id is NULL_HASH.

Reviewed By: StanislavGlebik

Differential Revision: D23266254

fbshipit-source-id: b8a3c47edfdfdc9d8cc8ea032fb96e27a04ef911
2020-08-24 07:34:29 -07:00