flowey_lib_common/
ado_task_nuget_tool_installer.rs

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