Skip to content

Sync eng/common directory with azure-sdk-tools for PR 15278#48926

Open
azure-sdk wants to merge 3 commits intomainfrom
sync-eng/common-add-playground-bundle-template-15278
Open

Sync eng/common directory with azure-sdk-tools for PR 15278#48926
azure-sdk wants to merge 3 commits intomainfrom
sync-eng/common-add-playground-bundle-template-15278

Conversation

@azure-sdk
Copy link
Copy Markdown
Collaborator

Sync eng/common directory with azure-sdk-tools for PR Azure/azure-sdk-tools#15278 See eng/common workflow

JoshLove-msft and others added 3 commits April 24, 2026 00:47
Adds an opt-in capability to the shared TypeSpec emitter pipeline template that bundles an emitter package and uploads it to the typespec playground blob storage. The uploaded <pkgName>/latest.json import map is consumed by in-browser playgrounds (e.g. https://azure.github.io/typespec-azure) via their additionalPlaygroundPackages mechanism.

Self-contained tooling lives in eng/common/playground-bundle/ and mirrors @typespec/bundle-uploader from microsoft/typespec (which is private and cannot be installed from npm).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@azure-sdk azure-sdk requested a review from a team as a code owner April 24, 2026 00:55
@azure-sdk azure-sdk added EngSys This issue is impacting the engineering system. Central-EngSys This issue is owned by the Engineering System team. labels Apr 24, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR syncs eng/common tooling to add a self-contained TypeSpec emitter bundling + upload utility and wires it into the shared archetype-typespec-emitter.yml pipeline template (opt-in) to publish bundles to the TypeSpec playground storage.

Changes:

  • Added a Node-based bundle-and-upload script (upload.mjs) plus a pinned-deps package.json/lock for reproducible installs.
  • Added documentation describing how the bundler is invoked from pipelines.
  • Extended archetype-typespec-emitter.yml with an UploadPlaygroundBundle parameter and conditional upload steps for internal non-PR builds.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
eng/common/playground-bundle/upload.mjs New CLI script to bundle a TypeSpec emitter package and upload bundle assets + manifest + latest.json to blob storage.
eng/common/playground-bundle/package.json Introduces pinned Node dependencies and an engines constraint for the uploader tool.
eng/common/playground-bundle/package-lock.json Locks the dependency graph for deterministic npm ci installs.
eng/common/playground-bundle/README.md Documents purpose and pipeline invocation of the uploader tool.
eng/common/pipelines/templates/archetype-typespec-emitter.yml Adds opt-in parameter and conditional steps to install and run the uploader in pipelines.
Files not reviewed (1)
  • eng/common/playground-bundle/package-lock.json: Language not supported

Comment on lines +69 to +73
const content = JSON.stringify(manifest);
await blob.upload(content, content.length, {
blobHTTPHeaders: { blobContentType: "application/json; charset=utf-8" },
conditions: { ifNoneMatch: "*" },
});
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BlobClient.upload(content, content.length, ...) uses JavaScript string length (UTF-16 code units) rather than the byte length the Storage SDK expects. This can lead to incorrect contentLength and upload failures if the JSON ever contains non-ASCII characters. Consider switching to uploadData(Buffer.from(content, 'utf8')) or using Buffer.byteLength(content) for the length argument.

Copilot uses AI. Check for mistakes.
Comment on lines +90 to +93
const content = JSON.stringify(index);
await blob.upload(content, content.length, {
blobHTTPHeaders: { blobContentType: "application/json; charset=utf-8" },
});
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same issue as above: blob.upload(content, content.length, ...) passes string length instead of byte length. Use uploadData(Buffer.from(content, 'utf8')) or Buffer.byteLength(content) to avoid mismatched content-length on upload.

Copilot uses AI. Check for mistakes.
Comment on lines +168 to +184
- script: npm ci
displayName: 'Install playground bundle uploader'
workingDirectory: $(Build.SourcesDirectory)/eng/common/playground-bundle
env:
NPM_CONFIG_USERCONFIG: $(emitterNpmrcPath)

- task: AzureCLI@2
displayName: 'Upload playground bundle'
inputs:
azureSubscription: "TypeSpec Storage"
scriptType: "bash"
scriptLocation: "inlineScript"
workingDirectory: $(Build.SourcesDirectory)
inlineScript: >
node eng/common/playground-bundle/upload.mjs
--package-path ${{ parameters.EmitterPackagePath }}
--version $(initialize.emitterVersion)
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new steps run npm ci and node eng/common/playground-bundle/upload.mjs, but the Build job doesn’t install/pin a Node.js version. Since eng/common/playground-bundle/package.json requires Node >=20.19.0, this can break depending on the agent’s preinstalled Node. Consider adding a UseNode@1 step (e.g., 22.x) before these steps to make the job deterministic.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Central-EngSys This issue is owned by the Engineering System team. EngSys This issue is impacting the engineering system.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants