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

Fix Helm Rendering of Values #8

Merged
merged 2 commits into from
Oct 1, 2022
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
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