-
Notifications
You must be signed in to change notification settings - Fork 860
Add AKS deployment tests using aspire deploy pipeline (C# + TypeScript) #16077
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
base: main
Are you sure you want to change the base?
Changes from all commits
ce8fd71
24901b5
94fad2a
0d64063
cc5ea68
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -111,4 +111,43 @@ internal static async Task SourceAspireBundleEnvironmentAsync( | |||||||||||||||||||||||||||||||||||||||||||||||
| await auto.EnterAsync(); | ||||||||||||||||||||||||||||||||||||||||||||||||
| await auto.WaitForSuccessPromptAsync(counter); | ||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| /// <summary> | ||||||||||||||||||||||||||||||||||||||||||||||||
| /// Runs <c>aspire deploy</c> interactively, answering parameter prompts via terminal automation. | ||||||||||||||||||||||||||||||||||||||||||||||||
| /// The deploy pipeline handles image building, pushing, Helm chart generation, and deployment. | ||||||||||||||||||||||||||||||||||||||||||||||||
| /// </summary> | ||||||||||||||||||||||||||||||||||||||||||||||||
| /// <param name="auto">The terminal automator.</param> | ||||||||||||||||||||||||||||||||||||||||||||||||
| /// <param name="counter">Sequence counter for prompt tracking.</param> | ||||||||||||||||||||||||||||||||||||||||||||||||
| /// <param name="parameterResponses"> | ||||||||||||||||||||||||||||||||||||||||||||||||
| /// Ordered list of (promptSubstring, valueToType) tuples. | ||||||||||||||||||||||||||||||||||||||||||||||||
| /// Each entry matches by the parameter name appearing in the prompt text. | ||||||||||||||||||||||||||||||||||||||||||||||||
| /// Entries are consumed in order — first match wins. | ||||||||||||||||||||||||||||||||||||||||||||||||
| /// </param> | ||||||||||||||||||||||||||||||||||||||||||||||||
| /// <param name="pipelineTimeout">Timeout for the entire deploy pipeline. Defaults to 15 minutes.</param> | ||||||||||||||||||||||||||||||||||||||||||||||||
| internal static async Task AspireDeployInteractiveAsync( | ||||||||||||||||||||||||||||||||||||||||||||||||
| this Hex1bTerminalAutomator auto, | ||||||||||||||||||||||||||||||||||||||||||||||||
| SequenceCounter counter, | ||||||||||||||||||||||||||||||||||||||||||||||||
| IReadOnlyList<(string PromptText, string Value)> parameterResponses, | ||||||||||||||||||||||||||||||||||||||||||||||||
| TimeSpan? pipelineTimeout = null) | ||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+115
to
+132
|
||||||||||||||||||||||||||||||||||||||||||||||||
| var timeout = pipelineTimeout ?? TimeSpan.FromMinutes(15); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| await auto.TypeAsync("aspire deploy"); | ||||||||||||||||||||||||||||||||||||||||||||||||
| await auto.EnterAsync(); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| // Answer each parameter prompt in order. | ||||||||||||||||||||||||||||||||||||||||||||||||
| // The CLI shows parameter prompts via Spectre.Console TextPrompt with the parameter name as the label. | ||||||||||||||||||||||||||||||||||||||||||||||||
| for (var i = 0; i < parameterResponses.Count; i++) | ||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||
| var (promptText, value) = parameterResponses[i]; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| await auto.WaitUntilTextAsync(promptText, timeout: TimeSpan.FromMinutes(5)); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 5 mins?? |
||||||||||||||||||||||||||||||||||||||||||||||||
| await auto.TypeAsync(value); | ||||||||||||||||||||||||||||||||||||||||||||||||
| await auto.EnterAsync(); | ||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| // Wait for pipeline completion | ||||||||||||||||||||||||||||||||||||||||||||||||
| await auto.WaitUntilTextAsync("PIPELINE SUCCEEDED", timeout: timeout); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||
| await auto.WaitUntilTextAsync("PIPELINE SUCCEEDED", timeout: timeout); | |
| var pipelineSucceededPattern = new CellPatternSearcher().Find("PIPELINE SUCCEEDED"); | |
| var pipelineFailedPattern = new CellPatternSearcher().Find("PIPELINE FAILED"); | |
| var pipelineFailed = false; | |
| await auto.WaitUntilAsync( | |
| s => | |
| { | |
| if (pipelineFailedPattern.Search(s).Count > 0) | |
| { | |
| pipelineFailed = true; | |
| return true; | |
| } | |
| return pipelineSucceededPattern.Search(s).Count > 0; | |
| }, | |
| timeout: timeout, | |
| description: "pipeline completion"); | |
| if (pipelineFailed) | |
| { | |
| throw new InvalidOperationException("Deployment pipeline failed."); | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
WaitUntilmatches on either the agent init prompt or the success prompt. But.Wait(500).Type("n").Enter()runs unconditionally. Ifaspire newcompletes without showing the agent init prompt (success prompt matches instead), typing"n"+ Enter at the shell runsnas a command (exit code 127 /ERR), causingWaitForSuccessPromptto time out.This needs to check which condition was actually matched and only type
"n"when the agent init prompt was seen.