-
Notifications
You must be signed in to change notification settings - Fork 577
Simplify pipelines #27505
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?
Simplify pipelines #27505
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -65,17 +65,15 @@ parameters: | |||||
| type: string | ||||||
| default: repo | ||||||
|
|
||||||
| # The package manager (if any) used by this pipeline. | ||||||
| - name: packageManager | ||||||
| type: string | ||||||
| default: pnpm | ||||||
| values: | ||||||
| - pnpm | ||||||
| - none | ||||||
| # If true, skip package-manager setup/install entirely (used by packages without package.json, e.g. gitssh). | ||||||
| - name: skipPackageInstall | ||||||
| type: boolean | ||||||
| default: false | ||||||
|
|
||||||
| - name: packageManagerInstallCommand | ||||||
| type: string | ||||||
| default: 'pnpm i --frozen-lockfile' | ||||||
| # If true, install only root dependencies for version-setting scenarios in packages with native deps. | ||||||
| - name: installWorkspaceRootOnly | ||||||
| type: boolean | ||||||
| default: false | ||||||
|
|
||||||
| # The semver range constraint to use for interdependencies; that is, dependencies on other packages within the release | ||||||
| # group | ||||||
|
|
@@ -239,8 +237,8 @@ extends: | |||||
| containerBaseDir=${{ parameters.containerBaseDir }} | ||||||
| interdependencyRange='${{ parameters.interdependencyRange }}' | ||||||
| isReleaseGroup=${{ parameters.isReleaseGroup }} | ||||||
| packageManager=${{ parameters.packageManager }} | ||||||
| packageManagerInstallCommand=${{ parameters.packageManagerInstallCommand }} | ||||||
| skipPackageInstall=${{ parameters.skipPackageInstall }} | ||||||
| installWorkspaceRootOnly=${{ parameters.installWorkspaceRootOnly }} | ||||||
| releaseKind=${{ parameters.releaseKind }} | ||||||
| setVersion=${{ parameters.setVersion }} | ||||||
| shouldPublishNpmPackages=${{ parameters.shouldPublishNpmPackages }} | ||||||
|
|
@@ -301,8 +299,8 @@ extends: | |||||
| fi | ||||||
| fi | ||||||
|
|
||||||
| if [[ "${{ parameters.packageManager }}" == "none" ]] && [[ "${{ parameters.setVersion }}" == "True" ]]; then | ||||||
| echo "##vso[task.logissue type=error]packageManager: 'none' is incompatible with setVersion: true (version-setting transitively requires a package manager)." | ||||||
| if [[ "${{ parameters.skipPackageInstall }}" == "true" ]] && [[ "${{ parameters.setVersion }}" == "True" ]]; then | ||||||
|
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. Should this be |
||||||
| echo "##vso[task.logissue type=error]skipPackageInstall: true is incompatible with setVersion: true (version-setting requires dependencies to be installed)." | ||||||
| exit -1; | ||||||
| fi | ||||||
|
|
||||||
|
|
@@ -316,22 +314,27 @@ extends: | |||||
| buildDirectory: ${{ parameters.buildDirectory }} | ||||||
| requireNotice: ${{ parameters.shouldReleaseDockerImage }} | ||||||
|
|
||||||
| - ${{ if eq(parameters.packageManager, 'pnpm') }}: | ||||||
| - ${{ if ne(parameters.skipPackageInstall, true) }}: | ||||||
|
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. Does this work?
Suggested change
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. Same for other |
||||||
| - template: /tools/pipelines/templates/include-install-pnpm.yml@self | ||||||
| parameters: | ||||||
| buildDirectory: ${{ parameters.buildDirectory }} | ||||||
|
|
||||||
| # Set version | ||||||
| - ${{ if eq(parameters.setVersion, true) }}: | ||||||
| - ${{ if and(eq(parameters.setVersion, true), ne(parameters.skipPackageInstall, true)) }}: | ||||||
| - task: Bash@3 | ||||||
| displayName: Install dependencies | ||||||
| retryCountOnTaskFailure: 4 | ||||||
| inputs: | ||||||
| targetType: 'inline' | ||||||
| workingDirectory: $(Pipeline.Workspace)/${{ parameters.buildDirectory }} | ||||||
| script: | | ||||||
| set -eu -o pipefail | ||||||
| ${{ parameters.packageManagerInstallCommand }} | ||||||
| ${{ if eq(parameters.installWorkspaceRootOnly, true) }}: | ||||||
| script: | | ||||||
| set -eu -o pipefail | ||||||
| pnpm i --frozen-lockfile --workspace-root | ||||||
| ${{ else }}: | ||||||
| script: | | ||||||
| set -eu -o pipefail | ||||||
| pnpm i --frozen-lockfile | ||||||
|
|
||||||
| - template: /tools/pipelines/templates/include-set-package-version.yml@self | ||||||
| parameters: | ||||||
|
|
@@ -402,7 +405,7 @@ extends: | |||||
| # as a BuildKit secret so the Dockerfile's npm/pnpm steps can install from our | ||||||
| # ADO npm mirror. Only emit --secret for pnpm release groups; non-pnpm | ||||||
| # Dockerfiles don't consume it. (gitssh is already excluded one level up.) | ||||||
| ${{ if eq(parameters.packageManager, 'pnpm') }}: | ||||||
| ${{ if ne(parameters.skipPackageInstall, true) }}: | ||||||
| buildArguments: --target base $(DockerBuildArgs.output) --secret id=npmrc,src=$(NPM_CONFIG_USERCONFIG) | ||||||
| ${{ else }}: | ||||||
| buildArguments: --target base $(DockerBuildArgs.output) | ||||||
|
|
@@ -548,7 +551,7 @@ extends: | |||||
| image: $(containerTag) | ||||||
| # See the base-image build above for the rationale. Passed here too because | ||||||
| # a cache miss could re-execute the base stage layers during this build. | ||||||
| ${{ if eq(parameters.packageManager, 'pnpm') }}: | ||||||
| ${{ if ne(parameters.skipPackageInstall, true) }}: | ||||||
| buildArguments: $(DockerBuildArgs.output) --secret id=npmrc,src=$(NPM_CONFIG_USERCONFIG) | ||||||
| ${{ else }}: | ||||||
| buildArguments: $(DockerBuildArgs.output) | ||||||
|
|
@@ -588,7 +591,7 @@ extends: | |||||
| localImage: $(containerTag) | ||||||
| remoteImage: $(ComputeFinalTagList.FinalTagList) | ||||||
|
|
||||||
| - ${{ if eq(parameters.packageManager, 'pnpm') }}: | ||||||
| - ${{ if ne(parameters.skipPackageInstall, true) }}: | ||||||
| # Prune the pnpm store before it's cached. This removes any deps that are not used by the current build. | ||||||
| - task: Bash@3 | ||||||
| displayName: Prune pnpm store | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,22 @@ | ||
| # Copyright (c) Microsoft Corporation and contributors. All rights reserved. | ||
| # Licensed under the MIT License. | ||
|
|
||
| # build-npm-package template to build NPM packages/projects | ||
| # build-npm-client-package template | ||
| # | ||
| # This template exists as a specialized variant of build-npm-package for the | ||
| # client release group pipeline (Build - client packages). It was split from | ||
| # the generic template because the client pipeline has additional behavior and | ||
| # artifact contracts that other npm package pipelines do not require. | ||
| # | ||
| # Key differences from build-npm-package: | ||
| # - Captures and publishes build output archive (build_output_archive) for | ||
| # downstream test pipelines. | ||
| # - Runs tests in dedicated jobs (coverage + per-task fan-out) rather than only | ||
| # inline in the main build job. | ||
| # - Builds and publishes the devtools browser extension artifact. | ||
| # - Includes client-specific telemetry and artifact shaping used by internal | ||
| # CI and follow-on workflows. | ||
| # | ||
|
|
||
| parameters: | ||
| - name: buildDirectory | ||
|
|
@@ -37,10 +52,6 @@ parameters: | |
| type: boolean | ||
| default: false | ||
|
|
||
| - name: isBundleSizeArtifactsPipeline | ||
|
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. Might be preferable to leave the bundle size stuff for now, Tommy and I are making changes in this area and some of this is probably going to change anyway. Since the bundle size artifacts live in the client-side of the world it may make more sense for them to be produced over here...? |
||
| type: boolean | ||
| default: false | ||
|
|
||
| - name: taskPack | ||
| type: boolean | ||
| default: true | ||
|
|
@@ -74,20 +85,12 @@ parameters: | |
| type: string | ||
| default: repo | ||
|
|
||
| - name: packageManager | ||
| type: string | ||
| default: pnpm | ||
|
|
||
| # Parameter for modifying the 'types' field in the package.json. | ||
| # If the value 'none' is provided, the 'types' field in package.json will remain unchanged. | ||
| - name: packageTypesOverride | ||
| type: string | ||
| default: none | ||
|
|
||
| - name: packageManagerInstallCommand | ||
| type: string | ||
| default: 'pnpm i --frozen-lockfile' | ||
|
|
||
| # The semver range constraint to use for interdependencies; that is, dependencies on other packages within the release | ||
| # group | ||
| - name: interdependencyRange | ||
|
|
@@ -331,21 +334,16 @@ extends: | |
|
|
||
| - template: /tools/pipelines/templates/include-install.yml@self | ||
| parameters: | ||
| packageManager: '${{ parameters.packageManager }}' | ||
| buildDirectory: '${{ parameters.buildDirectory }}' | ||
| packageManagerInstallCommand: '${{ parameters.packageManagerInstallCommand }}' | ||
|
|
||
| # The bundle-size-artifacts pipeline runs a client build but doesn't publish packages, | ||
| # so we skip version setting for it. | ||
| - ${{ if eq(parameters.isBundleSizeArtifactsPipeline, false) }}: | ||
| - template: /tools/pipelines/templates/include-set-package-version.yml@self | ||
| parameters: | ||
| buildDirectory: '${{ parameters.buildDirectory }}' | ||
| buildNumberInPatch: ${{ parameters.buildNumberInPatch }} | ||
| buildToolsVersionToInstall: '${{ parameters.buildToolsVersionToInstall }}' | ||
| tagName: '${{ parameters.tagName }}' | ||
| interdependencyRange: '${{ parameters.interdependencyRange }}' | ||
| packageTypesOverride: '${{ parameters.packageTypesOverride }}' | ||
|
|
||
| - template: /tools/pipelines/templates/include-set-package-version.yml@self | ||
| parameters: | ||
| buildDirectory: '${{ parameters.buildDirectory }}' | ||
| buildNumberInPatch: ${{ parameters.buildNumberInPatch }} | ||
| buildToolsVersionToInstall: '${{ parameters.buildToolsVersionToInstall }}' | ||
| tagName: '${{ parameters.tagName }}' | ||
| interdependencyRange: '${{ parameters.interdependencyRange }}' | ||
| packageTypesOverride: '${{ parameters.packageTypesOverride }}' | ||
|
|
||
| # Build and Lint | ||
| - template: /tools/pipelines/templates/include-build-lint.yml@self | ||
|
|
@@ -382,7 +380,7 @@ extends: | |
| - task: Bash@3 | ||
| displayName: npm pack | ||
| env: | ||
| PACKAGE_MANAGER: '${{ parameters.packageManager }}' | ||
| PACKAGE_MANAGER: 'pnpm' | ||
| RELEASE_GROUP: '${{ parameters.tagName }}' | ||
| STAGING_PATH: $(Build.ArtifactStagingDirectory) | ||
| inputs: | ||
|
|
@@ -449,29 +447,28 @@ extends: | |
| # At this point we want to publish the artifact with the _api-extractor-temp folder, | ||
| # but as part of 1ES migration that's now part of templateContext.outputs below. | ||
|
|
||
| - ${{ if eq(parameters.packageManager, 'pnpm') }}: | ||
| # Reset the pnpm-lock.yaml file since it's been modified by the versioning. But for dependency caching we want | ||
| # the cache key (which is based on the contents of the lockfile) to be the unmodified file. So we reset the | ||
| # lockfile as the last step so that when the dependency cache is uploaded, the cache key matches what it was | ||
| # at the beginning of the CI job. | ||
| - task: Bash@3 | ||
| displayName: Reset lockfile | ||
| inputs: | ||
| targetType: inline | ||
| workingDirectory: '$(Pipeline.Workspace)/${{ parameters.buildDirectory }}' | ||
| script: | | ||
| set -eu -o pipefail | ||
| git checkout HEAD -- pnpm-lock.yaml | ||
|
|
||
| # Prune the pnpm store before it's cached. This removes any deps that are not used by the current build. | ||
| - task: Bash@3 | ||
| displayName: Prune pnpm store | ||
| inputs: | ||
| targetType: inline | ||
| workingDirectory: '$(Pipeline.Workspace)/${{ parameters.buildDirectory }}' | ||
| script: | | ||
| set -eu -o pipefail | ||
| pnpm store prune | ||
| # Reset the pnpm-lock.yaml file since it's been modified by the versioning. But for dependency caching we want | ||
| # the cache key (which is based on the contents of the lockfile) to be the unmodified file. So we reset the | ||
| # lockfile as the last step so that when the dependency cache is uploaded, the cache key matches what it was | ||
| # at the beginning of the CI job. | ||
| - task: Bash@3 | ||
| displayName: Reset lockfile | ||
| inputs: | ||
| targetType: inline | ||
| workingDirectory: '$(Pipeline.Workspace)/${{ parameters.buildDirectory }}' | ||
| script: | | ||
| set -eu -o pipefail | ||
| git checkout HEAD -- pnpm-lock.yaml | ||
|
|
||
| # Prune the pnpm store before it's cached. This removes any deps that are not used by the current build. | ||
| - task: Bash@3 | ||
| displayName: Prune pnpm store | ||
| inputs: | ||
| targetType: inline | ||
| workingDirectory: '$(Pipeline.Workspace)/${{ parameters.buildDirectory }}' | ||
| script: | | ||
| set -eu -o pipefail | ||
| pnpm store prune | ||
|
|
||
| - task: Bash@3 | ||
| displayName: Check for extraneous modified files | ||
|
|
@@ -600,9 +597,7 @@ extends: | |
|
|
||
| - template: /tools/pipelines/templates/include-install.yml@self | ||
| parameters: | ||
| packageManager: '${{ parameters.packageManager }}' | ||
| buildDirectory: '${{ parameters.buildDirectory }}' | ||
| packageManagerInstallCommand: '${{ parameters.packageManagerInstallCommand }}' | ||
|
|
||
| # We need it in order to run flub where the code coverage comparison logic calls for it | ||
| - template: /tools/pipelines/templates/include-install-build-tools.yml@self | ||
|
|
@@ -764,9 +759,7 @@ extends: | |
|
|
||
| - template: /tools/pipelines/templates/include-install.yml@self | ||
| parameters: | ||
| packageManager: '${{ parameters.packageManager }}' | ||
| buildDirectory: '${{ parameters.buildDirectory }}' | ||
| packageManagerInstallCommand: '${{ parameters.packageManagerInstallCommand }}' | ||
|
|
||
| - task: DownloadPipelineArtifact@2 | ||
| inputs: | ||
|
|
||
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.
Was this just duplicate?