Add CI test pipeline with Key Vault secrets and log redaction#165
Merged
rhurey merged 5 commits intoMar 10, 2026
Conversation
The Speech service may skip Translation.Hypothesis (Recognizing) events for short audio or under service load, jumping straight to the final Translation.Phrase (Recognized). Tests were treating these as mandatory, causing intermittent failures. Changes: - Buffer event channels (cap 1 for RecognizeOnce, cap 10 for continuous) - Wait for Recognized events first (guaranteed by the service) - Check Recognizing events non-fatally via default/drain pattern - Increase timeouts from 5s to 10-15s for service variability Verified stable: 29/29 tests PASS, 10/10 on -count=10 for previously flaky TestTranslationRecognizeOnce.
f310971 to
b3fd98b
Compare
rhurey
approved these changes
Mar 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR: Add CI Test Pipeline with Key Vault Secrets and Log Redaction
Summary
Adds an Azure DevOps CI pipeline step that runs Go tests against the Speech SDK, using subscription credentials securely fetched from Azure Key Vault. Implements multi-layered secret redaction to prevent credential leaks in CI build logs.
Motivation
The upstream Go SDK pipeline (
azure-pipelines.yml) builds the SDK but does not run any tests. This PR extends the pipeline to executego test ./speechwith live service credentials, following the same Key Vault and redaction patterns used by the JavaScript SDK CI.Architecture
Secret Flow
Redaction Layers
set +xguard+ export SPEECH_SUBSCRIPTION_KEY=...from appearing in logsglobal_redactpipe***redactSecrets()t.Log()Files Changed (8 files)
New Files
ci/generate-subscription-file.ymlCarbonSubscriptionsJsonfrom Key Vault and writes it tosecrets/test.subscriptions.regions.jsonci/load-build-secrets.shjq, exports env vars, definesredact_input_with(perl filter) andglobal_redactwrapperModified Files
ci/azure-pipelines.ymlgenerate-subscription-file.ymltemplate reference + "Run Go tests" step that sourcesload-build-secrets.shand pipes test output throughglobal_redactspeech/translation_recognizer_test.goredactSecrets(s string) stringhelper; used insetup()teardown to sanitize memory log output. Fixed flakyRecognizingevent assertions: buffered channels, non-fatal hypothesis checks, increased timeoutsspeech/conversation_transcriber_test.goredactSecrets()insetupConversation()teardown; trailing whitespace normalizationspeech/speech_recognizer_test.goRecognizingevent assertions: buffered channels, non-fatal hypothesis checks, increased timeouts.gitignoresecrets/,test.subscriptions.regions.json,test.certificates.jsonentriesUpstream References
azure-pipelines.yml— build-only, no test stepgenerate-subscription-file.ymlandload-build-secrets.shdev.azure.com/speedme/Carbon/_build?definitionId=2408Key Design Decisions
sourceinstead ofbash: The test step usessource ci/load-build-secrets.sh(notbash ci/load-build-secrets.sh) so that exported functions (global_redact,redact_input_with) remain available in the current shell for the pipe.Perl streaming filter: Uses
perl -lpewithIO::Handleautoflush for line-by-line real-time redaction, avoiding buffering delays in CI output.set +xbefore secrets: Placed before any secret access to prevent bash trace mode from echoing secret values — even if a developer addsset -xfor debugging upstream.Go-level
redactSecrets(): Belt-and-suspenders approach — even thoughglobal_redacthandles stdout, Go'st.Log()writes to an internal buffer that gets flushed at test end. The Go-level function ensures secrets are scrubbed before they reach the log buffer.URL-encoded key variant: Subscription keys embedded in WebSocket/HTTP URLs would bypass plain-text redaction. Adding the URL-encoded form to the redaction array covers this attack vector.
Pipeline Triggers
master: Automatic build + testcron: "0 18 * * 6")Testing
Local Verification
YAML Validation
Both
ci/azure-pipelines.ymlandci/generate-subscription-file.ymlvalidated successfully with Python YAML parser.Bash Script Validation
ci/load-build-secrets.shusesset -euo pipefailwith proper error handling for missing files, missingjq, and null/empty secret values.