Skip to content

Commit

Permalink
Merge pull request #10 from SimCubeLtd/dev
Browse files Browse the repository at this point in the history
maybe expansion will work under bash
  • Loading branch information
prom3theu5 committed Oct 1, 2022
2 parents 15bb62f + 00b9769 commit d07017f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 20 deletions.
1 change: 0 additions & 1 deletion src/SimCube.PulumiDeployments/GlobalUsings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
global using System.Text.Json;
global using System.Text.Json.Serialization;
global using Ardalis.GuardClauses;
global using CliWrap;
global using FluentValidation;
global using FluentValidation.Results;
global using Pulumi;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
public abstract class BaseHelmChartResource : ComponentResource
{
protected readonly CustomResourceOptions CustomResourceOptions;

private const string EnvSubstituteCommand = "envsubst";
private const string MoveCommand = "mv";
public const string HelmValuesFolder = "HelmValues";

protected BaseHelmChartResource(
Expand All @@ -31,21 +28,15 @@ protected string RenderYamlValues(Dictionary<string, string?> environmentalVaria
{
var helmValuesFile = GetHelmValuesFilePath();

Cli.Wrap(EnvSubstituteCommand)
.WithArguments($"< {helmValuesFile} > {helmValuesFile}.new")
.WithEnvironmentVariables(environmentalVariables)
.WithValidation(CommandResultValidation.ZeroExitCode)
.ExecuteAsync()
.GetAwaiter()
.GetResult();

Cli.Wrap(MoveCommand)
.WithArguments($"{helmValuesFile}.new {helmValuesFile}")
.WithEnvironmentVariables(environmentalVariables)
.WithValidation(CommandResultValidation.ZeroExitCode)
.ExecuteAsync()
.GetAwaiter()
.GetResult();
foreach (var environmentalVariable in environmentalVariables)
{
Environment.SetEnvironmentVariable(environmentalVariable.Key, environmentalVariable.Value);
}

var origin = File.ReadAllText(helmValuesFile);
var output = Environment.ExpandEnvironmentVariables(origin);

File.WriteAllText(helmValuesFile, output);

return helmValuesFile;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

<ItemGroup>
<PackageReference Include="Ardalis.GuardClauses" Version="4.0.1" />
<PackageReference Include="CliWrap" Version="3.5.0" />
<PackageReference Include="FluentValidation" Version="11.2.2" />
<PackageReference Include="Pulumi.Kubernetes" Version="3.21.4" />
<PackageReference Include="Pulumi.Command" Version="4.5.0" />
Expand Down

0 comments on commit d07017f

Please sign in to comment.