stable

Clone or download

Read-only

feat: Example WASM module check fields sum

Part of story #35093 execute custom code as artifact post action This example module look for fields `field_a` and `field_b` as integer field. Then field `field_sum` as text field. - If it cannot found these fields, it crash, the error appear on logs. - If sum of both field is odd, it returns a new comment on artifact: `Sum of field_a and field_b is odd -> {field_a_value} + {field_b_value} = {field_sum}` And write 'odd' in field_sum - If sum of both field is even, it returns a new comment on artifact: `Sum of field_a and field_b is not odd -> {field_a_value} + {field_b_value} = {field_sum}` And write 'even' in field_sum *Testing:* First you need to compile the module: - `cd plugins/tracker_cce/wasm_module/post-action-add-comment` - `nix-shell` - `cargo build --target wasm32-wasi --release` Then upload it to the server: - Move `target/wasm32-wasi/release/post-action-add-comment.wasm` to `/var/lib/tuleap/tracker_cce/<tracker_id>/post-action.wasm` Now go to Tracker <tracker_id>: - Create/Update one artifact Logs show the error message - Add fields `field_a` and `field_b` as integer field and `field_sum` as text field - Create/Update one artifact with an even sum of fields Logs show the valid even message - Create/Update one artifact with an odd sum of fields Logs show the valid odd message Change-Id: I306e5935a5efee4c686ae4d2e983dbf8113569ba

Modified Files

Name
M plugins/tracker/include/REST/v1/ArtifactValuesRepresentation.class.php +1 −0 Go to diff View file
M plugins/tracker_cce/include/TrackerCCE/WASM/CallWASMModule.php +11 −6 Go to diff View file
M plugins/tracker_cce/include/TrackerCCE/WASM/ProcessWASMResponse.php +3 −1 Go to diff View file
M plugins/tracker_cce/include/tracker_ccePlugin.php +11 −11 Go to diff View file
M plugins/tracker_cce/tests/unit/TrackerCCE/WASM/ProcessWASMResponseTest.php +9 −2 Go to diff View file
M plugins/tracker_cce/wasm_modules/post-action-add-comment/src/main.rs +74 −10 Go to diff View file