From 7060c34ae3936ea491af925147ee17386ed13027 Mon Sep 17 00:00:00 2001 From: "Craig Macomber (Microsoft)" <42876482+CraigMacomber@users.noreply.github.com> Date: Mon, 18 May 2026 23:55:41 +0000 Subject: [PATCH 1/6] Checkout faster with fetchDepth: 1 and fetchTags: false --- tools/pipelines/build-docs.yml | 14 ++++++++++---- .../pipelines/build-performance-observability.yml | 2 ++ tools/pipelines/deploy-website.yml | 8 ++++++++ tools/pipelines/publish-api-model-artifact.yml | 4 ++++ tools/pipelines/repo-policy-check.yml | 2 ++ tools/pipelines/test-perf-benchmarks.yml | 4 ++++ 6 files changed, 30 insertions(+), 4 deletions(-) diff --git a/tools/pipelines/build-docs.yml b/tools/pipelines/build-docs.yml index adc7a0f4135b..a31f09cb688e 100644 --- a/tools/pipelines/build-docs.yml +++ b/tools/pipelines/build-docs.yml @@ -100,10 +100,8 @@ stages: path: $(FluidFrameworkDirectory) submodules: false clean: true - - - template: /tools/pipelines/templates/include-install-build-tools.yml@self - parameters: - buildDirectory: $(Pipeline.Workspace)/$(FluidFrameworkDirectory) + fetchDepth: 1 + fetchTags: false - task: Bash@3 name: SetVersion displayName: 'Set Build Version' @@ -168,6 +166,8 @@ stages: - checkout: self submodules: false clean: true + fetchDepth: 1 + fetchTags: false - template: /tools/pipelines/templates/include-use-node-version.yml@self @@ -226,6 +226,8 @@ stages: - checkout: self submodules: false clean: true + fetchDepth: 1 + fetchTags: false - template: /tools/pipelines/templates/include-use-node-version.yml@self @@ -293,6 +295,8 @@ stages: path: $(FluidFrameworkDirectory) submodules: false clean: true + fetchDepth: 1 + fetchTags: false - template: /tools/pipelines/templates/include-use-node-version.yml@self @@ -345,6 +349,8 @@ stages: - checkout: self submodules: false clean: true + fetchDepth: 1 + fetchTags: false - task: DownloadPipelineArtifact@2 displayName: 'Copy fluidframework-docs to "build" folder' diff --git a/tools/pipelines/build-performance-observability.yml b/tools/pipelines/build-performance-observability.yml index dc3177e44ca8..2340fceb34b1 100644 --- a/tools/pipelines/build-performance-observability.yml +++ b/tools/pipelines/build-performance-observability.yml @@ -94,6 +94,8 @@ extends: steps: - checkout: self clean: true + fetchDepth: 1 + fetchTags: false path: ${{ variables.FluidFrameworkDirectory }} - template: /tools/pipelines/templates/include-use-node-version.yml@self diff --git a/tools/pipelines/deploy-website.yml b/tools/pipelines/deploy-website.yml index 3551f072562b..7732d6db1de4 100644 --- a/tools/pipelines/deploy-website.yml +++ b/tools/pipelines/deploy-website.yml @@ -127,6 +127,8 @@ stages: path: ${{ variables.FluidFrameworkDirectory }} submodules: false clean: true + fetchDepth: 1 + fetchTags: false - template: /tools/pipelines/templates/include-use-node-version.yml@self @@ -199,6 +201,8 @@ stages: path: ${{ variables.FluidFrameworkDirectory }} submodules: false clean: true + fetchDepth: 1 + fetchTags: false - template: /tools/pipelines/templates/include-use-node-version.yml@self @@ -266,6 +270,8 @@ stages: path: ${{ variables.FluidFrameworkDirectory }} submodules: false clean: true + fetchDepth: 1 + fetchTags: false - template: /tools/pipelines/templates/include-use-node-version.yml@self @@ -319,6 +325,8 @@ stages: path: ${{ variables.FluidFrameworkDirectory }} submodules: false clean: true + fetchDepth: 1 + fetchTags: false - task: DownloadPipelineArtifact@2 displayName: 'Copy fluidframework-docs to "build" folder' diff --git a/tools/pipelines/publish-api-model-artifact.yml b/tools/pipelines/publish-api-model-artifact.yml index a4d3864694dd..c64beee82f22 100644 --- a/tools/pipelines/publish-api-model-artifact.yml +++ b/tools/pipelines/publish-api-model-artifact.yml @@ -113,6 +113,8 @@ stages: path: ${{ variables.FluidFrameworkDirectory }} submodules: false clean: true + fetchDepth: 1 + fetchTags: false - template: /tools/pipelines/templates/include-install-build-tools.yml@self parameters: @@ -257,6 +259,8 @@ stages: - checkout: self submodules: false clean: true + fetchDepth: 1 + fetchTags: false - task: TriggerBuild@4 condition: eq(variables['shouldDeploy'], 'true') inputs: diff --git a/tools/pipelines/repo-policy-check.yml b/tools/pipelines/repo-policy-check.yml index 7618f5ec4419..44c5afeab066 100644 --- a/tools/pipelines/repo-policy-check.yml +++ b/tools/pipelines/repo-policy-check.yml @@ -89,6 +89,8 @@ extends: " - checkout: self path: ${{ variables.FluidFrameworkDirectory }} + fetchDepth: 1 + fetchTags: false - template: /tools/pipelines/templates/include-use-node-version.yml@self - template: /tools/pipelines/templates/include-install-pnpm.yml@self parameters: diff --git a/tools/pipelines/test-perf-benchmarks.yml b/tools/pipelines/test-perf-benchmarks.yml index 69fd3dd256de..4fefc8226acb 100644 --- a/tools/pipelines/test-perf-benchmarks.yml +++ b/tools/pipelines/test-perf-benchmarks.yml @@ -119,10 +119,14 @@ stages: # Checkout the FluidFramework repo (for workspace scripts and source code) - checkout: self path: $(FluidFrameworkDirectory) + fetchDepth: 1 + fetchTags: false # Checkout ff_pipeline_host (provides telemetry-generator and trips-setup/cleanup) - checkout: ff_pipeline_host path: $(FFPipelineHostDirectory) + fetchDepth: 1 + fetchTags: false - task: Bash@3 displayName: Print parameter/variable values for troubleshooting From 048be47cebdf3bd9f5b0a62a65271d43b6caab36 Mon Sep 17 00:00:00 2001 From: "Craig Macomber (Microsoft)" <42876482+CraigMacomber@users.noreply.github.com> Date: Tue, 19 May 2026 00:06:15 +0000 Subject: [PATCH 2/6] Fix unintended edit --- tools/pipelines/build-docs.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/pipelines/build-docs.yml b/tools/pipelines/build-docs.yml index a31f09cb688e..64c20ee318e6 100644 --- a/tools/pipelines/build-docs.yml +++ b/tools/pipelines/build-docs.yml @@ -102,6 +102,10 @@ stages: clean: true fetchDepth: 1 fetchTags: false + + - template: /tools/pipelines/templates/include-install-build-tools.yml@self + parameters: + buildDirectory: $(Pipeline.Workspace)/$(FluidFrameworkDirectory) - task: Bash@3 name: SetVersion displayName: 'Set Build Version' From ce88ce6cb1e2aeeb97982cd50ec22060116bbf02 Mon Sep 17 00:00:00 2001 From: "Craig Macomber (Microsoft)" <42876482+CraigMacomber@users.noreply.github.com> Date: Tue, 19 May 2026 00:22:15 +0000 Subject: [PATCH 3/6] Update templates --- tools/pipelines/templates/build-docker-service.yml | 2 ++ tools/pipelines/templates/build-npm-client-package.yml | 6 ++++++ tools/pipelines/templates/build-npm-package.yml | 2 ++ tools/pipelines/templates/include-policy-check.yml | 2 ++ .../templates/include-publish-docker-service-steps.yml | 2 ++ .../templates/include-publish-npm-package-deployment.yml | 2 ++ tools/pipelines/templates/include-test-real-service.yml | 4 ++++ tools/pipelines/templates/upload-dev-manifest.yml | 2 ++ tools/pipelines/templates/upload-server-manifest.yml | 2 ++ .../upload-telemetry/include-stage-upload-telemetry.yml | 2 ++ 10 files changed, 26 insertions(+) diff --git a/tools/pipelines/templates/build-docker-service.yml b/tools/pipelines/templates/build-docker-service.yml index aa18cd88333b..e24195ca034b 100644 --- a/tools/pipelines/templates/build-docker-service.yml +++ b/tools/pipelines/templates/build-docker-service.yml @@ -200,6 +200,8 @@ extends: clean: true lfs: false submodules: false + fetchDepth: 1 + fetchTags: false - task: Bash@3 displayName: Parameters diff --git a/tools/pipelines/templates/build-npm-client-package.yml b/tools/pipelines/templates/build-npm-client-package.yml index 7a464f931192..02cdf4fde203 100644 --- a/tools/pipelines/templates/build-npm-client-package.yml +++ b/tools/pipelines/templates/build-npm-client-package.yml @@ -229,6 +229,8 @@ extends: clean: true lfs: '${{ parameters.checkoutSubmodules }}' submodules: '${{ parameters.checkoutSubmodules }}' + fetchDepth: 1 + fetchTags: false - script: | echo "commit sha: $(Build.SourceVersion)" @@ -589,6 +591,8 @@ extends: clean: true lfs: '${{ parameters.checkoutSubmodules }}' submodules: '${{ parameters.checkoutSubmodules }}' + fetchDepth: 1 + fetchTags: false - script: | echo "commit: $(COMMIT_SHA)" @@ -753,6 +757,8 @@ extends: clean: true lfs: '${{ parameters.checkoutSubmodules }}' submodules: '${{ parameters.checkoutSubmodules }}' + fetchDepth: 1 + fetchTags: false - script: | echo "commit: $(COMMIT_SHA)" diff --git a/tools/pipelines/templates/build-npm-package.yml b/tools/pipelines/templates/build-npm-package.yml index 6ba51216b205..d0df92814e8b 100644 --- a/tools/pipelines/templates/build-npm-package.yml +++ b/tools/pipelines/templates/build-npm-package.yml @@ -218,6 +218,8 @@ extends: clean: true lfs: '${{ parameters.checkoutSubmodules }}' submodules: '${{ parameters.checkoutSubmodules }}' + fetchDepth: 1 + fetchTags: false - task: Bash@3 displayName: Parameters diff --git a/tools/pipelines/templates/include-policy-check.yml b/tools/pipelines/templates/include-policy-check.yml index fabfae50e000..167fb2113861 100644 --- a/tools/pipelines/templates/include-policy-check.yml +++ b/tools/pipelines/templates/include-policy-check.yml @@ -35,6 +35,8 @@ stages: steps: - checkout: self path: $(FluidFrameworkDirectory) + fetchDepth: 1 + fetchTags: false - template: /tools/pipelines/templates/include-use-node-version.yml@self - template: /tools/pipelines/templates/include-install-pnpm.yml@self diff --git a/tools/pipelines/templates/include-publish-docker-service-steps.yml b/tools/pipelines/templates/include-publish-docker-service-steps.yml index 09fb1584fb9d..397b4935e856 100644 --- a/tools/pipelines/templates/include-publish-docker-service-steps.yml +++ b/tools/pipelines/templates/include-publish-docker-service-steps.yml @@ -93,6 +93,8 @@ jobs: steps: - checkout: self clean: true + fetchDepth: 1 + fetchTags: false - template: /tools/pipelines/templates/include-git-tag-steps.yml@self parameters: tagName: ${{ parameters.tagName }} diff --git a/tools/pipelines/templates/include-publish-npm-package-deployment.yml b/tools/pipelines/templates/include-publish-npm-package-deployment.yml index 64eefcf1f9e3..b8d86e51a9cc 100644 --- a/tools/pipelines/templates/include-publish-npm-package-deployment.yml +++ b/tools/pipelines/templates/include-publish-npm-package-deployment.yml @@ -161,6 +161,8 @@ jobs: steps: - checkout: self clean: true + fetchDepth: 1 + fetchTags: false - template: /tools/pipelines/templates/include-git-tag-steps.yml@self parameters: tagName: ${{ parameters.tagName }} diff --git a/tools/pipelines/templates/include-test-real-service.yml b/tools/pipelines/templates/include-test-real-service.yml index ebd66f036a58..116cdc6a43f7 100644 --- a/tools/pipelines/templates/include-test-real-service.yml +++ b/tools/pipelines/templates/include-test-real-service.yml @@ -177,6 +177,8 @@ stages: - checkout: ff_pipeline_host path: $(FFPipelineHostDirectory) clean: true + fetchDepth: 1 + fetchTags: false # ADO doesn't support checking out refs that are determined at pipeline queue time as ours likely would be # (where the ref is a function of one of the pipeline resource inputs). See docs here: @@ -185,6 +187,8 @@ stages: - checkout: self path: $(FluidFrameworkDirectory) clean: true + fetchDepth: 1 + fetchTags: false - bash: | git fetch --depth=1 origin $FF_SOURCE_VERSION diff --git a/tools/pipelines/templates/upload-dev-manifest.yml b/tools/pipelines/templates/upload-dev-manifest.yml index 86219bab572f..897530f10b93 100644 --- a/tools/pipelines/templates/upload-dev-manifest.yml +++ b/tools/pipelines/templates/upload-dev-manifest.yml @@ -15,6 +15,8 @@ jobs: steps: - checkout: self path: $(FluidFrameworkDirectory) + fetchDepth: 1 + fetchTags: false - template: /tools/pipelines/templates/include-use-node-version.yml@self - template: /tools/pipelines/templates/include-install-build-tools.yml@self parameters: diff --git a/tools/pipelines/templates/upload-server-manifest.yml b/tools/pipelines/templates/upload-server-manifest.yml index 5a037ef0193f..6da61baa18b2 100644 --- a/tools/pipelines/templates/upload-server-manifest.yml +++ b/tools/pipelines/templates/upload-server-manifest.yml @@ -20,6 +20,8 @@ jobs: steps: - checkout: self path: $(FluidFrameworkDirectory) + fetchDepth: 1 + fetchTags: false - template: /tools/pipelines/templates/include-use-node-version.yml@self - template: /tools/pipelines/templates/include-install-build-tools.yml@self parameters: diff --git a/tools/pipelines/templates/upload-telemetry/include-stage-upload-telemetry.yml b/tools/pipelines/templates/upload-telemetry/include-stage-upload-telemetry.yml index 3d85a3709adf..85b24692549a 100644 --- a/tools/pipelines/templates/upload-telemetry/include-stage-upload-telemetry.yml +++ b/tools/pipelines/templates/upload-telemetry/include-stage-upload-telemetry.yml @@ -42,6 +42,8 @@ stages: steps: - checkout: ff_pipeline_host path: $(FFPipelineHostDirectory) + fetchDepth: 1 + fetchTags: false - template: /tools/pipelines/templates/include-use-node-version.yml@self From 10401b11bbea7fddf70734fe9e866b527b40f147 Mon Sep 17 00:00:00 2001 From: "Craig Macomber (Microsoft)" <42876482+CraigMacomber@users.noreply.github.com> Date: Tue, 19 May 2026 19:56:31 +0000 Subject: [PATCH 4/6] Make build-tools tests not depend on having tags from git present. --- .../src/test/commands/release/fromTag.test.ts | 103 ++++++++++++------ 1 file changed, 72 insertions(+), 31 deletions(-) diff --git a/build-tools/packages/build-cli/src/test/commands/release/fromTag.test.ts b/build-tools/packages/build-cli/src/test/commands/release/fromTag.test.ts index 18fa2216d3bb..8bb4f5bfec7b 100644 --- a/build-tools/packages/build-cli/src/test/commands/release/fromTag.test.ts +++ b/build-tools/packages/build-cli/src/test/commands/release/fromTag.test.ts @@ -3,45 +3,86 @@ * Licensed under the MIT License. */ -import type { ReleaseVersion, VersionBumpType } from "@fluid-tools/version-tools"; +import { Config } from "@oclif/core"; import { runCommand } from "@oclif/test"; import * as chai from "chai"; import { expect } from "chai"; import assertArrays from "chai-arrays"; import { describe, it } from "mocha"; - -import type { ReleaseGroup, ReleasePackage } from "../../../releaseGroups.js"; +import type { TaskOptions } from "simple-git"; +import FromTagCommand from "../../../commands/release/fromTag.js"; chai.use(assertArrays); -interface jsonOutput { - packageOrReleaseGroup: ReleaseGroup | ReleasePackage; - title: string; - tag: string; - date?: Date; - releaseType: VersionBumpType; - version: ReleaseVersion; - previousVersion?: ReleaseVersion; - previousTag?: string; -} - describe("flub release fromTag", () => { - const expected = { - version: "0.26.1", - date: "2023-10-26T19:35:13.000Z", - packageOrReleaseGroup: "build-tools", - previousTag: "build-tools_v0.26.0", - previousVersion: "0.26.0", - releaseType: "patch", - tag: "build-tools_v0.26.1", - title: "build-tools v0.26.1 (patch)", - }; - - it("--json", async () => { - const { stdout } = await runCommand(["release:fromTag", "build-tools_v0.26.1", "--json"], { - root: import.meta.url, + // Test both against a mocked got repo, and the real one. + // The real case, is skipped by default to avoid test failures in environments where the git repo is not present of the tags are not checked out. + for (const mock of [true, false]) { + // When mocking the git repo, pick a tag that does not (and will never) exist, to ensure mocking works. + const tagOffset = mock ? 50 : 0; + const previousVersion = `0.26.${tagOffset}`; + const version = `0.26.${tagOffset + 1}`; + const previousTag = `build-tools_v${previousVersion}`; + const tag = `build-tools_v${version}`; + const date = new Date("2023-10-26T19:35:13.000Z"); + + const expected = { + version, + date, + packageOrReleaseGroup: "build-tools", + previousTag, + previousVersion, + releaseType: "patch", + tag, + title: `build-tools v${version} (patch)`, + }; + + // Mocha's skip functionality (via `this`) does not work with arrow functions. + // eslint-disable-next-line prefer-arrow-callback + it(`--json (Mock: ${mock})`, async function () { + let output: Awaited>; + if (mock) { + const config = await Config.load({ root: import.meta.url }); + const command = new FromTagCommand([tag, "--json"], config); + await command.init(); + const context = await command.getContext(); + const gitRepo = await context.getGitRepository(); + const simpleGit = gitRepo.gitClient; + + // Mock gitClient.tags to return a fixed set of build-tools tags, so the test + // does not depend on git tags being present in the local checkout. + simpleGit.tags = (async (options: TaskOptions = []) => { + expect(options).to.deep.equal(["--list", "build-tools_v*"]); + return { + all: [previousTag, tag], + latest: tag, + }; + }) as unknown as (typeof simpleGit)["tags"]; + + // Mock gitClient.show to return fixed commit dates for each tag. + simpleGit.show = (async (options: TaskOptions = []) => { + const tagDates: Record = { + [tag]: date, + // This date is not used, but we set it to a different value to ensure the command pulls the date from the correct tag. + [previousTag]: new Date("2000-01-14T00:00:00.000Z"), + }; + const queriedTag = (options as string[]).at(-1) ?? ""; + expect(options).to.deep.equal(["-s", "--format=%cI", queriedTag]); + return tagDates[queriedTag]?.toISOString() ?? ""; + }) as unknown as (typeof simpleGit)["show"]; + + output = await command.run(); + } else { + // Skip real git test by default, as it requires specific tags to be present in the local repo, which may not be the case in all environments. + // Disable this skip if you want to test against the actual git repo and tags. + // this.skip(); + const { stdout } = await runCommand(["release:fromTag", tag, "--json"], { + root: import.meta.url, + }); + output = JSON.parse(stdout); + } + + expect(JSON.stringify(output)).to.equal(JSON.stringify(expected)); }); - const output: jsonOutput = JSON.parse(stdout) as jsonOutput; - expect(output).to.deep.equal(expected); - }); + } }); From 98b64da3742dfbe6fd7bacd973b1906b97143f80 Mon Sep 17 00:00:00 2001 From: "Craig Macomber (Microsoft)" <42876482+CraigMacomber@users.noreply.github.com> Date: Tue, 19 May 2026 20:17:49 +0000 Subject: [PATCH 5/6] Skip non-mocked use of tags from repo in test --- .../build-cli/src/test/commands/release/fromTag.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-tools/packages/build-cli/src/test/commands/release/fromTag.test.ts b/build-tools/packages/build-cli/src/test/commands/release/fromTag.test.ts index 8bb4f5bfec7b..101f0e21ec8a 100644 --- a/build-tools/packages/build-cli/src/test/commands/release/fromTag.test.ts +++ b/build-tools/packages/build-cli/src/test/commands/release/fromTag.test.ts @@ -75,7 +75,7 @@ describe("flub release fromTag", () => { } else { // Skip real git test by default, as it requires specific tags to be present in the local repo, which may not be the case in all environments. // Disable this skip if you want to test against the actual git repo and tags. - // this.skip(); + this.skip(); const { stdout } = await runCommand(["release:fromTag", tag, "--json"], { root: import.meta.url, }); From ef0f58e2b27d14eec32e49452ea12280ea862d7b Mon Sep 17 00:00:00 2001 From: "Craig Macomber (Microsoft)" <42876482+CraigMacomber@users.noreply.github.com> Date: Tue, 19 May 2026 13:45:40 -0700 Subject: [PATCH 6/6] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- .../build-cli/src/test/commands/release/fromTag.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build-tools/packages/build-cli/src/test/commands/release/fromTag.test.ts b/build-tools/packages/build-cli/src/test/commands/release/fromTag.test.ts index 101f0e21ec8a..a226e13eb57c 100644 --- a/build-tools/packages/build-cli/src/test/commands/release/fromTag.test.ts +++ b/build-tools/packages/build-cli/src/test/commands/release/fromTag.test.ts @@ -15,8 +15,8 @@ import FromTagCommand from "../../../commands/release/fromTag.js"; chai.use(assertArrays); describe("flub release fromTag", () => { - // Test both against a mocked got repo, and the real one. - // The real case, is skipped by default to avoid test failures in environments where the git repo is not present of the tags are not checked out. + // Test both against a mocked git repo and the real one. + // The real case is skipped by default to avoid test failures in environments where the git repo is not present or the tags are not checked out. for (const mock of [true, false]) { // When mocking the git repo, pick a tag that does not (and will never) exist, to ensure mocking works. const tagOffset = mock ? 50 : 0;