Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport 1.x] Bump Proc from 0.6.2 to 0.8.0 #516

Merged
merged 1 commit into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Bumps `Bogus` from 34.0.2 to 35.3.0
- Bumps `Octokit` from 9.0.0 to 9.1.0
- Bumps `FSharp.Core` from 8.0.100 to 8.0.101
- Bumps `Proc` from 0.6.2 to 0.8.0

## [1.6.0]
### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,10 @@ protected static void WriteFileIfNotExist(string fileLocation, string contents)

protected static void ExecuteBinary(EphemeralClusterConfiguration config, IConsoleLineHandler writer,
string binary, string description, params string[] arguments) =>
ExecuteBinaryInternal(config, writer, binary, description, null, arguments);

protected static void ExecuteBinary(EphemeralClusterConfiguration config, IConsoleLineHandler writer,
string binary, string description, StartedHandler startedHandler, params string[] arguments) =>
ExecuteBinaryInternal(config, writer, binary, description, startedHandler, arguments);
ExecuteBinaryInternal(config, writer, binary, description, arguments);

private static void ExecuteBinaryInternal(EphemeralClusterConfiguration config, IConsoleLineHandler writer,
string binary, string description, StartedHandler startedHandler, params string[] arguments)
string binary, string description, params string[] arguments)
{
var command = $"{{{binary}}} {{{string.Join(" ", arguments)}}}";
writer?.WriteDiagnostic($"{{{nameof(ExecuteBinary)}}} starting process [{description}] {command}");
Expand All @@ -194,9 +190,7 @@ private static void ExecuteBinaryInternal(EphemeralClusterConfiguration config,
}
};

var result = startedHandler != null
? Proc.Start(processStartArguments, timeout, new ConsoleOutColorWriter(), startedHandler)
: Proc.Start(processStartArguments, timeout, new ConsoleOutColorWriter());
var result = Proc.Start(processStartArguments, timeout, new ConsoleOutColorWriter());

if (!result.Completed)
throw new Exception($"Timeout while executing {description} exceeded {timeout}");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public override void Run(IEphemeralCluster<EphemeralClusterConfiguration> cluste
cluster.Writer,
fs.PluginBinary,
$"install opensearch plugin: {plugin.SubProductName}",
"install --batch", GetPluginLocation(plugin, v));
"install", "--batch", GetPluginLocation(plugin, v));

CopyConfigDirectoryToHomeCacheConfigDirectory(cluster, plugin);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,15 @@ public void Add(string setting)
public void Add(string key, string value, string versionRange) =>
Add(new NodeSetting(key, value, versionRange));

public string[] ToCommandLineArguments(OpenSearchVersion version)
{
var settingArgument = "-E ";
return this
public string[] ToCommandLineArguments(OpenSearchVersion version) =>
this
//if a node setting is only applicable for a certain version make sure its filtered out
.Where(s => string.IsNullOrEmpty(s.VersionRange) || version.InRange(s.VersionRange))
//allow additional settings to take precedence over already DefaultNodeSettings
//without relying on opensearch to dedup
.GroupBy(setting => setting.Key)
.Select(g => g.Last())
.Select(s => s.Key.StartsWith(settingArgument) ? s.ToString() : $"{settingArgument}{s}")
.SelectMany(s => new[] { "-E", s.ToString() })
.ToArray();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

</PropertyGroup>
<ItemGroup>
<PackageReference Include="Proc" Version="0.6.2" />
<PackageReference Include="Proc" Version="0.8.0" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
</ItemGroup>
<ItemGroup>
Expand Down
23 changes: 12 additions & 11 deletions build/scripts/Building.fs
Original file line number Diff line number Diff line change
Expand Up @@ -124,29 +124,30 @@ module Build =
Shell.rm nuspec

deps
let rewriteLibFolder libFolder project nugetId dependencies =


let rewriteLibFolder libFolder project nugetId dependencies =
let info = DirectoryInfo libFolder
let tfm = info.Name
let fullPath = Path.GetFullPath libFolder
let mainDll = sprintf "%s.dll" (Path.Combine(fullPath, project))

let mainDll = sprintf "%s.dll" (Path.Combine(fullPath, project))
let renamedDll dll = dll |> String.replace ".dll" (sprintf "%i.dll" version.Full.Major)

printfn "dll: %s Nuget id: %s dependencies: %A" mainDll nugetId dependencies
let depAssemblies =
dependencies
|> Seq.map (fun d -> sprintf "%s.dll" (Path.Combine(Paths.InplaceBuildOutput project tfm, d)))
let dlls =
let args =
[mainDll]
|> Seq.append depAssemblies
|> Seq.map (fun dll ->
sprintf @"-i ""%s"" -o ""%s"" -k ""%s""" dll (renamedDll dll) keyFile
["-i"; dll; "-o"; renamedDll dll; "-k"; keyFile]
)

ReposTooling.Rewriter dlls

|> Seq.concat

ReposTooling.Rewriter args

Shell.rm mainDll
let mainPdb = sprintf "%s.pdb" (Path.Combine(fullPath, project))
if File.exists mainPdb then Shell.rm mainPdb
Expand Down
13 changes: 6 additions & 7 deletions build/scripts/ReposTooling.fs
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,16 @@ module ReposTooling =
let folder = Path.getDirectory (Paths.TestProjFile "Tests.YamlRunner")
let timeout = TimeSpan.FromMinutes(120.)
Tooling.DotNet.ExecInWithTimeout folder (["run"; "--" ] @ args) timeout |> ignore


let restoreOnce = lazy(Tooling.DotNet.Exec ["tool"; "restore"])

let private differ = "assembly-differ"
let Differ args =
restoreOnce.Force()

let args = args |> String.concat " "
let command = sprintf @"%s %s -o ../../%s" differ args Paths.BuildOutput
Tooling.DotNet.ExecIn Paths.TargetsFolder [command] |> ignore

let args = [differ] @ args @ ["-o"; $"../../{Paths.BuildOutput}"]
Tooling.DotNet.ExecIn Paths.TargetsFolder args

let private assemblyRewriter = "assembly-rewriter"
let Rewriter args =
Expand Down
2 changes: 1 addition & 1 deletion build/scripts/scripts.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />

<PackageReference Include="Octokit" Version="9.1.0" />
<PackageReference Include="Proc" Version="0.6.2" />
<PackageReference Include="Proc" Version="0.8.0" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion tests/Tests.Core/Tests.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@
<PackageReference Include="FluentAssertions" Version="6.12.0" />

<PackageReference Include="DiffPlex" Version="1.7.1" />
<PackageReference Include="Proc" Version="0.6.2" />
<PackageReference Include="Proc" Version="0.8.0" />
</ItemGroup>
</Project>
Loading