Skip to content

Commit d9c6617

Browse files
committed
Just re-use result of the Pulumi Up result instead of loading it
1 parent 0df44d5 commit d9c6617

File tree

1 file changed

+7
-8
lines changed
  • update-conference-prague-2024/demo-code-feedback-system/deploy/deploy

1 file changed

+7
-8
lines changed

update-conference-prague-2024/demo-code-feedback-system/deploy/deploy/Program.cs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ public class BuildContext : FrostingContext
3535
public string ReleaseArtifactsDownloadDir { get; }
3636
public string UnzippedArtifactsDir { get; }
3737

38+
public UpResult? PulumiUpResult { get; set; }
39+
3840
public BuildContext(ICakeContext context)
3941
: base(context)
4042
{
@@ -139,9 +141,9 @@ public override async Task RunAsync(BuildContext context)
139141

140142
context.Log.Information($"Pulumi Up starting...");
141143

142-
var result = await pulumiStack.UpAsync();
144+
context.PulumiUpResult = await pulumiStack.UpAsync();
143145
context.Log.Information($"Pulumi Up completed");
144-
Utilities.LogPulumiResult(context, result);
146+
Utilities.LogPulumiResult(context, context.PulumiUpResult);
145147
}
146148
}
147149

@@ -151,7 +153,7 @@ public sealed class RunSeleniumTestsTask : AsyncFrostingTask<BuildContext>
151153
{
152154
public override async Task RunAsync(BuildContext context)
153155
{
154-
await WriteConfigAsync(context);
156+
WriteConfig(context);
155157
await RunTestsAsync(context);
156158
}
157159

@@ -171,18 +173,15 @@ private async Task RunTestsAsync(BuildContext context)
171173
await Task.CompletedTask;
172174
}
173175

174-
private async ValueTask WriteConfigAsync(BuildContext context)
176+
private void WriteConfig(BuildContext context)
175177
{
176178
var fullStackName = $"ProgrammerAL/{context.PulumiStackName}";
177179

178180
context.Log.Information($"Loading stack {fullStackName} from path '{context.PulumiPath}' to get outputs");
179181

180-
var stackArgs = new LocalProgramArgs(fullStackName, context.PulumiPath);
181-
var pulumiStack = await LocalWorkspace.SelectStackAsync(stackArgs);
182-
var stackOutputs = await pulumiStack.GetOutputsAsync();
182+
var stackOutputs = context.PulumiUpResult!.Outputs;
183183
var staticSiteEndpoint = stackOutputs["StaticSiteHttpsEndpoint"].Value.ToString() ?? throw new Exception($"Pulumi output 'StaticSiteHttpsEndpoint' is null for stack '{fullStackName}'");
184184

185-
186185
// Write the config file
187186
var filePath = $"{context.PlaywrightTestsPath}/.runsettings";
188187
var runsettingsXml = XElement.Load(filePath);

0 commit comments

Comments
 (0)