microsoft/openvmm
Publicmirrored fromhttps://github.com/microsoft/openvmmAvailable
flowey/flowey_lib_common/src/ado_task_nuget_tool_installer.rs
35lines · modecode
| 1 | // Copyright (C) Microsoft Corporation. All rights reserved. |
| 2 | |
| 3 | //! ADO Task Wrapper: `NuGetToolInstaller@1` |
| 4 | |
| 5 | use flowey::node::prelude::*; |
| 6 | |
| 7 | flowey_request! { |
| 8 | pub struct Request(pub WriteVar<SideEffect>); |
| 9 | } |
| 10 | |
| 11 | new_flow_node!(struct Node); |
| 12 | |
| 13 | impl FlowNode for Node { |
| 14 | type Request = Request; |
| 15 | |
| 16 | fn imports(_ctx: &mut ImportCtx<'_>) {} |
| 17 | |
| 18 | fn emit(requests: Vec<Self::Request>, ctx: &mut NodeCtx<'_>) -> anyhow::Result<()> { |
| 19 | ctx.emit_ado_step("Install nuget.exe", move |ctx| { |
| 20 | requests.into_iter().for_each(|x| { |
| 21 | x.0.claim(ctx); |
| 22 | }); |
| 23 | move |_| { |
| 24 | // tool is known flaky, so stick a hard-coded retry count on it |
| 25 | r#" |
| 26 | - task: NuGetToolInstaller@1 |
| 27 | retryCountOnTaskFailure: 3 |
| 28 | "# |
| 29 | .into() |
| 30 | } |
| 31 | }); |
| 32 | |
| 33 | Ok(()) |
| 34 | } |
| 35 | } |
| 36 | |