Skip to content

Commit

Permalink
Merge pull request #8 from SimCubeLtd/dev
Browse files Browse the repository at this point in the history
Fix Helm Rendering of Values
  • Loading branch information
prom3theu5 authored Oct 1, 2022
2 parents 9669832 + 9457b6b commit 5369dee
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pull-requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
with:
fetch-depth: 0

- uses: actions/setup-dotnet@v2
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'
include-prerelease: false
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
with:
fetch-depth: 0

- uses: actions/setup-dotnet@v2
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'
include-prerelease: false
Expand Down
4 changes: 3 additions & 1 deletion src/SimCube.PulumiDeployments/GlobalUsings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@
global using SimCube.PulumiDeployments.Helpers;
global using SimCube.PulumiDeployments.Literals;
global using SimCube.PulumiDeployments.Resources.Helm;
global using SimCube.PulumiDeployments.Resources.Kubernetes;
global using SimCube.PulumiDeployments.Resources.Kubernetes;
global using CliWrap;
global using CliWrap.Buffered;
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,16 @@ protected BaseHelmChartResource(

protected static string RenderCommandName(string chartName) => $"render-values-{chartName}";

protected Command RenderYamlValues(string commandName, string helmFile, InputMap<string> environment)
{
var createCommand = new Command(
commandName,
new()
{
Create = RenderCreateCommand(helmFile),
Environment = environment,
},
CustomResourceOptions);

CustomResourceOptions.DependsOn.Add(createCommand);

return createCommand;
}
protected static void RenderYamlValues(string helmFile, Dictionary<string, string?> environment) =>
Cli.Wrap(EnvSubstitute)
.WithArguments($"< {helmFile} > {helmFile}.new && mv {helmFile}.new {helmFile}")
.WithEnvironmentVariables(environment)
.WithValidation(CommandResultValidation.ZeroExitCode)
.ExecuteAsync()
.GetAwaiter()
.GetResult();

protected string GetHelmValuesFilePath() => Path.Combine(AppContext.BaseDirectory, HelmValuesFolder, HelmValuesFile);

private static string RenderCreateCommand(string helmValuePath) => $"{EnvSubstitute} < {helmValuePath} > {helmValuePath}.new && mv {helmValuePath}.new {helmValuePath}";
}
private static string RenderCreateCommand(string helmValuePath) => $"{EnvSubstitute} ";
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

<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 5369dee

Please sign in to comment.