stable
Clone or download
The WASM module that is called when the git:pre-receive command is used will now have access to a read-only copy of the git repository that it is checking commits for. This is done to enable more complex checks inside WASM modules. The WASM module now receives JSON of the following form: { "updated_references": { "refs\/heads\/tuleap-master": { "old_value": "c8ee0a8bcf3f185a272a04d6493456b3562f5050", "new_value": "e6ecbb16e4e9792fa8c5824204e1a58f2007dc31" }, "refs\/heads\/tuleap-hello": { "old_value": "0000000000000000000000000000000000000000", "new_value": "0066b8447a411086ecd19210dd3f5df818056f47" } }, "pre_opened_dir":"\/repo-git-7331" } In this case, the module can access the read-only copy of the repository under the directory "/repo-git-7331". Development note: - Since this feature might not be always usefull in the feature, if you send an empty string ("") as the 'read_only_directory_path_ptr' argument of wasmtime-wrapper-lib, no directory will be opened and you do not have to include the "pre_opened_dir" field in the JSON that you give as input to the WASM module. How to test: - tuleap config-set feature_flag_pre_receive_ignored_repos_ids 0 (verify that no repos that have a wasm module present are ignored) - nix-build ./src/additional-packages/tuleap-wasmtime-wrapper-lib.nix (build and redeploy the package) - systemctl restart tuleap - The wasmtime-wrapper-lib tests must pass and your module must be able to read content inside the git repository Part of story #32630: create WebAssembly modules that have access to a preopened read-only copy of the git repository I am configuring Change-Id: Icc0a730671bc119985e1e6d3c4a5d5575e7bd033
Modified Files
Name | ||||
---|---|---|---|---|
M | plugins/git/include/Hook/PreReceive/PreReceiveAction.php | +4 | −4 | Go to diff View file |
M | plugins/git/include/Hook/PreReceive/PreReceiveHookData.php | +3 | −3 | Go to diff View file |
M | plugins/git/include/Hook/PreReceive/PreReceiveHookDataWithoutTechnicalReference.php | +2 | −2 | Go to diff View file |
M | plugins/git/tests/unit/Hook/PreReceive/PreReceiveHookDataTest.php | +7 | −3 | Go to diff View file |
M | plugins/git/tests/unit/Hook/PreReceive/PreReceiveHookDataWithoutTechnicalReferenceTest.php | +7 | −3 | Go to diff View file |
M | src/additional-packages/wasmtime-wrapper-lib/Cargo.lock | +25 | −22 | Go to diff View file |
M | src/additional-packages/wasmtime-wrapper-lib/Cargo.toml | +3 | −0 | Go to diff View file |
M | src/additional-packages/wasmtime-wrapper-lib/src/lib.rs | +195 | −28 | Go to diff View file |
A | src/additional-packages/wasmtime-wrapper-lib/src/preview1.rs | +230 | −0 | Go to diff View file |
M | src/additional-packages/wasmtime-wrapper-lib/src/wire.rs | +1 | −1 | Go to diff View file |
M | src/additional-packages/wasmtime-wrapper-lib/test-wasm-modules/Cargo.toml | +9 | −1 | Go to diff View file |
A | src/additional-packages/wasmtime-wrapper-lib/test-wasm-modules/TryToReadWriteHere/ReadTest.txt | +1 | −0 | Go to diff View file |
A | src/additional-packages/wasmtime-wrapper-lib/test-wasm-modules/src/read-from-preopened-dir/main.rs | +28 | −0 | Go to diff View file |
A | src/additional-packages/wasmtime-wrapper-lib/test-wasm-modules/src/write-to-preopened-dir/main.rs | +36 | −0 | Go to diff View file |
M | src/common/WebAssembly/EmptyWASMCaller.php | +1 | −1 | Go to diff View file |
M | src/common/WebAssembly/FFIWASMCaller.php | +2 | −2 | Go to diff View file |
M | src/common/WebAssembly/FFIWASMCallerStub.php | +1 | −1 | Go to diff View file |
M | src/common/WebAssembly/WASMCaller.php | +1 | −1 | Go to diff View file |
M | tests/unit/common/WebAssembly/WASMCallerStub.php | +1 | −1 | Go to diff View file |