From b8419b4a212290860d8bc54b4a251c8d0f9c6a2c Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Tue, 24 Jun 2025 06:15:24 +0000 Subject: [PATCH 01/18] [EngSys] Update agent pool to "azsdk-pool" --- eng/pipelines/ci.yml | 53 +++++++++++-------- eng/pipelines/preview.yml | 8 +-- eng/pipelines/sdk_regenerate.yaml | 11 ++-- .../templates/stages/1es-redirect.yml | 4 +- eng/pipelines/templates/variables/image.yml | 10 ++-- 5 files changed, 50 insertions(+), 36 deletions(-) diff --git a/eng/pipelines/ci.yml b/eng/pipelines/ci.yml index 3d30de6b0fd..25c942b7c60 100644 --- a/eng/pipelines/ci.yml +++ b/eng/pipelines/ci.yml @@ -18,10 +18,15 @@ resources: name: Azure/azure-sdk-tools variables: - PythonVersion: "3.12" - AUTOREST_TESTSERVER_COVERAGE_DIRECTORY: "$(Build.SourcesDirectory)/autorest.python/packages/autorest.python/coverage/" - PROXY_URL: http://localhost:5000 - PROXY_MANUAL_START: true + - template: /eng/pipelines/templates/variables/image.yml + - name: PythonVersion + value: "3.12" + - name: AUTOREST_TESTSERVER_COVERAGE_DIRECTORY + value: "$(Build.SourcesDirectory)/autorest.python/packages/autorest.python/coverage/" + - name: PROXY_URL + value: http://localhost:5000 + - name : PROXY_MANUAL_START + value: true parameters: - name: VerificationPackages @@ -45,33 +50,39 @@ jobs: strategy: matrix: Linux_Python3.9: + Pool: $(LINUXPOOL) OSName: "Linux" - OSVmImage: "MMSUbuntu18.04" + OSVmImage: $(LINUXVMIMAGE) PythonVersion: "3.9" Windows_Python3.9: + Pool: $(WINDOWSPOOL) OSName: "Windows" - OSVmImage: "MMS2020" - PythonVersion: "3.9" + OSVmImage: $(WINDOWSVMIMAGE) + PythonVersion: "3.9" Linux_Python3.10: + Pool: $(LINUXPOOL) OSName: "Linux" - OSVmImage: "MMSUbuntu20.04" + OSVmImage: $(LINUXVMIMAGE) PythonVersion: "3.10" Linux_Python3.11: + Pool: $(LINUXPOOL) OSName: "Linux" - OSVmImage: "MMSUbuntu22.04" + OSVmImage: $(LINUXVMIMAGE) PythonVersion: "3.11" Linux_Python3.12: + Pool: $(LINUXPOOL) OSName: "Linux" - OSVmImage: "MMSUbuntu22.04" + OSVmImage: $(LINUXVMIMAGE) PythonVersion: "3.12" Windows_Python3.12: + Pool: $(WINDOWSPOOL) OSName: "Windows" - OSVmImage: "MMS2023" + OSVmImage: $(WINDOWSVMIMAGE) PythonVersion: "3.12" pool: - name: azsdk-pool-mms-ubuntu-2004-general - vmImage: $(OSVmImage) + name: $(Pool) + demands: ImageOverride -equals $(OSVmImage) steps: - template: ci-template.yml @@ -139,32 +150,32 @@ jobs: matrix: Linux_Python3.9: OSName: "Linux" - OSVmImage: "MMSUbuntu18.04" + OSVmImage: $(LINUXVMIMAGE) PythonVersion: "3.9" Windows_Python3.9: OSName: "Windows" - OSVmImage: "MMS2020" + OSVmImage: $(WINDOWSVMIMAGE) PythonVersion: "3.9" Linux_Python310: OSName: "Linux" - OSVmImage: "MMSUbuntu20.04" + OSVmImage: $(LINUXVMIMAGE) PythonVersion: "3.10" Linux_Python311: OSName: "Linux" - OSVmImage: "MMSUbuntu22.04" + OSVmImage: $(LINUXVMIMAGE) PythonVersion: "3.11" Linux_Python312: OSName: "Linux" - OSVmImage: "MMSUbuntu22.04" + OSVmImage: $(LINUXVMIMAGE) PythonVersion: "3.12" Windows_Python312: OSName: "Windows" - OSVmImage: "MMS2023" + OSVmImage: $(WINDOWSVMIMAGE) PythonVersion: "3.12" pool: - name: azsdk-pool-mms-ubuntu-2004-general - vmImage: $(OSVmImage) + name: azsdk-pool + demands: ImageOverride -equals $(OSVmImage) steps: - template: ci-template.yml diff --git a/eng/pipelines/preview.yml b/eng/pipelines/preview.yml index 84ce3fac5c6..4040a149350 100644 --- a/eng/pipelines/preview.yml +++ b/eng/pipelines/preview.yml @@ -30,11 +30,13 @@ resources: ref: refs/heads/main variables: - PythonVersion: "3.10" + - template: /eng/pipelines/templates/variables/image.yml + - name: PythonVersion + value: "3.10" pool: - name: azsdk-pool-mms-ubuntu-2004-general - vmImage: MMSUbuntu20.04 + name: $(LINUXPOOL) + demands: ImageOverride -equals $(LINUXVMIMAGE) extends: template: eng/pipelines/templates/stages/archetype-autorest-preview.yml@azure-sdk-tools diff --git a/eng/pipelines/sdk_regenerate.yaml b/eng/pipelines/sdk_regenerate.yaml index 38154bae8e6..8233ce5ea52 100644 --- a/eng/pipelines/sdk_regenerate.yaml +++ b/eng/pipelines/sdk_regenerate.yaml @@ -12,13 +12,14 @@ schedules: pr: none -pool: - name: "azsdk-pool-mms-ubuntu-2004-general" - vmImage: "MMSUbuntu20.04" - variables: - - group: Release Secrets for GitHub + - template: /eng/pipelines/templates/variables/image.yml + - name: group + value: Release Secrets for GitHub +pool: + name: $(LINUXPOOL) + demands: ImageOverride -equals $(LINUXVMIMAGE) resources: repositories: diff --git a/eng/pipelines/templates/stages/1es-redirect.yml b/eng/pipelines/templates/stages/1es-redirect.yml index bb78a16005a..1e813af7895 100644 --- a/eng/pipelines/templates/stages/1es-redirect.yml +++ b/eng/pipelines/templates/stages/1es-redirect.yml @@ -23,8 +23,8 @@ extends: skipBuildTagsForGitHubPullRequests: true sdl: sourceAnalysisPool: - name: azsdk-pool-mms-win-2022-general - image: azsdk-pool-mms-win-2022-1espt + name: azsdk-pool + image: windows-2022 os: windows psscriptanalyzer: compiled: true diff --git a/eng/pipelines/templates/variables/image.yml b/eng/pipelines/templates/variables/image.yml index a7ce2512066..2bd105c720d 100644 --- a/eng/pipelines/templates/variables/image.yml +++ b/eng/pipelines/templates/variables/image.yml @@ -2,18 +2,18 @@ variables: - name: LINUXPOOL - value: azsdk-pool-mms-ubuntu-2004-general + value: azsdk-pool - name: WINDOWSPOOL - value: azsdk-pool-mms-win-2022-general + value: azsdk-pool - name: MACPOOL value: Azure Pipelines - name: LINUXVMIMAGE - value: azsdk-pool-mms-ubuntu-2004-1espt + value: ubuntu-24.04 - name: LINUXNEXTVMIMAGE - value: ubuntu-22.04 + value: ubuntu-24.04 - name: WINDOWSVMIMAGE - value: azsdk-pool-mms-win-2022-1espt + value: windows-2022 - name: MACVMIMAGE value: macos-11 From 01851bf5709c49243922981afab82e3307290358 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Tue, 24 Jun 2025 06:29:05 +0000 Subject: [PATCH 02/18] Use correct syntax in matrix --- eng/pipelines/ci.yml | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/eng/pipelines/ci.yml b/eng/pipelines/ci.yml index 25c942b7c60..06c3e58cf2c 100644 --- a/eng/pipelines/ci.yml +++ b/eng/pipelines/ci.yml @@ -50,34 +50,34 @@ jobs: strategy: matrix: Linux_Python3.9: - Pool: $(LINUXPOOL) + Pool: ${{ variables.LINUXPOOL }} OSName: "Linux" - OSVmImage: $(LINUXVMIMAGE) + OSVmImage: ${{ variables.LINUXVMIMAGE}} PythonVersion: "3.9" Windows_Python3.9: - Pool: $(WINDOWSPOOL) + Pool: ${{ variables.WINDOWSPOOL }} OSName: "Windows" - OSVmImage: $(WINDOWSVMIMAGE) + OSVmImage: ${{ variables.WINDOWSVMIMAGE}} PythonVersion: "3.9" Linux_Python3.10: - Pool: $(LINUXPOOL) + Pool: ${{ variables.LINUXPOOL }} OSName: "Linux" - OSVmImage: $(LINUXVMIMAGE) + OSVmImage: ${{ variables.LINUXVMIMAGE}} PythonVersion: "3.10" Linux_Python3.11: - Pool: $(LINUXPOOL) + Pool: ${{ variables.LINUXPOOL }} OSName: "Linux" - OSVmImage: $(LINUXVMIMAGE) + OSVmImage: ${{ variables.LINUXVMIMAGE}} PythonVersion: "3.11" Linux_Python3.12: - Pool: $(LINUXPOOL) + Pool: ${{ variables.LINUXPOOL }} OSName: "Linux" - OSVmImage: $(LINUXVMIMAGE) + OSVmImage: ${{ variables.LINUXVMIMAGE}} PythonVersion: "3.12" Windows_Python3.12: - Pool: $(WINDOWSPOOL) + Pool: ${{ variables.WINDOWSPOOL }} OSName: "Windows" - OSVmImage: $(WINDOWSVMIMAGE) + OSVmImage: ${{ variables.WINDOWSVMIMAGE}} PythonVersion: "3.12" pool: @@ -150,27 +150,27 @@ jobs: matrix: Linux_Python3.9: OSName: "Linux" - OSVmImage: $(LINUXVMIMAGE) + OSVmImage: ${{ variables.LINUXVMIMAGE}} PythonVersion: "3.9" Windows_Python3.9: OSName: "Windows" - OSVmImage: $(WINDOWSVMIMAGE) + OSVmImage: ${{ variables.WINDOWSVMIMAGE}} PythonVersion: "3.9" Linux_Python310: OSName: "Linux" - OSVmImage: $(LINUXVMIMAGE) + OSVmImage: ${{ variables.LINUXVMIMAGE}} PythonVersion: "3.10" Linux_Python311: OSName: "Linux" - OSVmImage: $(LINUXVMIMAGE) + OSVmImage: ${{ variables.LINUXVMIMAGE}} PythonVersion: "3.11" Linux_Python312: OSName: "Linux" - OSVmImage: $(LINUXVMIMAGE) + OSVmImage: ${{ variables.LINUXVMIMAGE}} PythonVersion: "3.12" Windows_Python312: OSName: "Windows" - OSVmImage: $(WINDOWSVMIMAGE) + OSVmImage: ${{ variables.WINDOWSVMIMAGE}} PythonVersion: "3.12" pool: From 4f8903bfff3b0786d2abacef63882bb0bcc2a618 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Tue, 24 Jun 2025 06:32:13 +0000 Subject: [PATCH 03/18] more pool vars --- eng/pipelines/ci.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/eng/pipelines/ci.yml b/eng/pipelines/ci.yml index 06c3e58cf2c..d78f488a531 100644 --- a/eng/pipelines/ci.yml +++ b/eng/pipelines/ci.yml @@ -149,32 +149,38 @@ jobs: strategy: matrix: Linux_Python3.9: + Pool: ${{ variables.LINUXPOOL }} OSName: "Linux" OSVmImage: ${{ variables.LINUXVMIMAGE}} PythonVersion: "3.9" Windows_Python3.9: + Pool: ${{ variables.WINDOWSPOOL }} OSName: "Windows" OSVmImage: ${{ variables.WINDOWSVMIMAGE}} PythonVersion: "3.9" Linux_Python310: + Pool: ${{ variables.LINUXPOOL }} OSName: "Linux" OSVmImage: ${{ variables.LINUXVMIMAGE}} PythonVersion: "3.10" Linux_Python311: + Pool: ${{ variables.LINUXPOOL }} OSName: "Linux" OSVmImage: ${{ variables.LINUXVMIMAGE}} PythonVersion: "3.11" Linux_Python312: + Pool: ${{ variables.LINUXPOOL }} OSName: "Linux" OSVmImage: ${{ variables.LINUXVMIMAGE}} PythonVersion: "3.12" Windows_Python312: + Pool: ${{ variables.WINDOWSPOOL }} OSName: "Windows" OSVmImage: ${{ variables.WINDOWSVMIMAGE}} PythonVersion: "3.12" pool: - name: azsdk-pool + name: $(Pool) demands: ImageOverride -equals $(OSVmImage) steps: From 83d714b3d2220029c4ad6955236088c4e54637f0 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Wed, 25 Jun 2025 11:42:45 -0400 Subject: [PATCH 04/18] toggle between windows and linux in scripts --- packages/autorest.python/scripts/eng/run-tests.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/autorest.python/scripts/eng/run-tests.ts b/packages/autorest.python/scripts/eng/run-tests.ts index 35237ada63b..a5ca1b3701c 100644 --- a/packages/autorest.python/scripts/eng/run-tests.ts +++ b/packages/autorest.python/scripts/eng/run-tests.ts @@ -46,7 +46,20 @@ const commandToRun = argv.command || "all"; function getCommand(command: string, folder: string, name?: string): string { if (!validCommands.includes(command)) throw new Error(`Unknown command '${command}'.`); - const retval = `FOLDER=${folder} tox -c ./test/${folder}/tox.ini -e ${command}`; + + // Check if running on Windows + const isWindows = process.platform === "win32"; + const baseCommand = `tox -c ./test/${folder}/tox.ini -e ${command}`; + + let retval: string; + if (isWindows) { + // Windows command format: set FOLDER=value && command + retval = `set FOLDER=${folder} && ${baseCommand}`; + } else { + // Unix/Linux/macOS format: FOLDER=value command + retval = `FOLDER=${folder} ${baseCommand}`; + } + if (name) { return `${retval} -- -f ${name}`; } From 84dbe82aaee8e5e46d8799b460e89ca58bca288a Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Wed, 25 Jun 2025 15:04:22 -0400 Subject: [PATCH 05/18] add changeset --- .chronus/changes/azsdk-pool-2025-5-25-15-4-16.md | 8 ++++++++ .../typetest/property/optional/_types.py | 13 +++++++++++++ .../typetest/property/valuetypes/_types.py | 13 +++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 .chronus/changes/azsdk-pool-2025-5-25-15-4-16.md create mode 100644 packages/typespec-python/test/azure/generated/typetest-property-optional/typetest/property/optional/_types.py create mode 100644 packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/_types.py diff --git a/.chronus/changes/azsdk-pool-2025-5-25-15-4-16.md b/.chronus/changes/azsdk-pool-2025-5-25-15-4-16.md new file mode 100644 index 00000000000..d3ca5afbf36 --- /dev/null +++ b/.chronus/changes/azsdk-pool-2025-5-25-15-4-16.md @@ -0,0 +1,8 @@ +--- +changeKind: internal +packages: + - "@autorest/python" + - "@azure-tools/typespec-python" +--- + +Fix CI to use windows \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/typetest-property-optional/typetest/property/optional/_types.py b/packages/typespec-python/test/azure/generated/typetest-property-optional/typetest/property/optional/_types.py new file mode 100644 index 00000000000..efc2e343741 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/typetest-property-optional/typetest/property/optional/_types.py @@ -0,0 +1,13 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Literal, Union + +UnionStringLiteralPropertyProperty = Literal["hello", "world"] +UnionIntLiteralPropertyProperty = Literal[1, 2] +UnionFloatLiteralPropertyProperty = float diff --git a/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/_types.py b/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/_types.py new file mode 100644 index 00000000000..4193b13917d --- /dev/null +++ b/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/_types.py @@ -0,0 +1,13 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Literal, Union + +UnionStringLiteralPropertyProperty = Literal["hello", "world"] +UnionIntLiteralPropertyProperty = Literal[42, 43] +UnionFloatLiteralPropertyProperty = float From e0305a9968d519136f48ddbe84c6edf8a752026a Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Wed, 25 Jun 2025 15:15:52 -0400 Subject: [PATCH 06/18] normalize line ending diffs --- eng/scripts/check-for-changed-files.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/eng/scripts/check-for-changed-files.js b/eng/scripts/check-for-changed-files.js index 2903114428e..db3fd78726e 100644 --- a/eng/scripts/check-for-changed-files.js +++ b/eng/scripts/check-for-changed-files.js @@ -2,6 +2,13 @@ const { run } = require("./helpers.js"); +// First, refresh the git index to normalize line endings +// This ensures line ending differences don't show up as changes +run("git", ["add", "--renormalize", "."], { + encoding: "utf-8", + stdio: [null, "pipe", "pipe"], +}); + const proc = run("git", ["status", "--porcelain", "."], { encoding: "utf-8", stdio: [null, "pipe", "pipe"], From 9772285912d413b04bd39f5ceff56d82144549b2 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Wed, 25 Jun 2025 15:20:21 -0400 Subject: [PATCH 07/18] update tsp tests --- packages/typespec-python/scripts/eng/run-tests.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/typespec-python/scripts/eng/run-tests.ts b/packages/typespec-python/scripts/eng/run-tests.ts index 35237ada63b..893e09e9f8b 100644 --- a/packages/typespec-python/scripts/eng/run-tests.ts +++ b/packages/typespec-python/scripts/eng/run-tests.ts @@ -46,7 +46,18 @@ const commandToRun = argv.command || "all"; function getCommand(command: string, folder: string, name?: string): string { if (!validCommands.includes(command)) throw new Error(`Unknown command '${command}'.`); - const retval = `FOLDER=${folder} tox -c ./test/${folder}/tox.ini -e ${command}`; + // Check if running on Windows + const isWindows = process.platform === "win32"; + const baseCommand = `tox -c ./test/${folder}/tox.ini -e ${command}`; + + let retval: string; + if (isWindows) { + // Windows command format: set FOLDER=value && command + retval = `set FOLDER=${folder} && ${baseCommand}`; + } else { + // Unix/Linux/macOS format: FOLDER=value command + retval = `FOLDER=${folder} ${baseCommand}`; + } if (name) { return `${retval} -- -f ${name}`; } From 62a83fe6c114a545be2d3eb2c245dffdea987a89 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Thu, 26 Jun 2025 11:24:48 -0400 Subject: [PATCH 08/18] renormalize yaml file --- .github/policies/resourceManagement.yml | 756 ++++++++++++------------ 1 file changed, 378 insertions(+), 378 deletions(-) diff --git a/.github/policies/resourceManagement.yml b/.github/policies/resourceManagement.yml index 7f0c51d2673..ac742c62743 100644 --- a/.github/policies/resourceManagement.yml +++ b/.github/policies/resourceManagement.yml @@ -1,378 +1,378 @@ -id: -name: GitOps.PullRequestIssueManagement -description: GitOps.PullRequestIssueManagement primitive -owner: -resource: repository -disabled: false -where: -configuration: - resourceManagementConfiguration: - scheduledSearches: - - description: - frequencies: - - daily: - time: 1:0 - filters: - - isIssue - - isOpen - - hasLabel: - label: needs-author feedback - - hasLabel: - label: no-recent-activity - - noActivitySince: - days: 14 - actions: - - closeIssue - - description: - frequencies: - - hourly: - hour: 6 - filters: - - isIssue - - isOpen - - hasLabel: - label: needs-author feedback - - noActivitySince: - days: 7 - - isNotLabeledWith: - label: no-recent-activity - actions: - - addLabel: - label: no-recent-activity - - addReply: - reply: Hi, we're sending this friendly reminder because we haven't heard back from you in **7 days**. We need more information about this issue to help address it. Please be sure to give us your input. If we don't hear back from you within **14 days** of this comment the issue will be automatically closed. Thank you! - - description: - frequencies: - - hourly: - hour: 6 - filters: - - isIssue - - isOpen - - hasLabel: - label: issue-addressed - - noActivitySince: - days: 7 - actions: - - addReply: - reply: Hi @${issueAuthor}, since you haven’t asked that we “`/unresolve`” the issue, we’ll close this out. If you believe further discussion is needed, please add a comment “`/unresolve`” to reopen the issue. - - closeIssue - - description: - frequencies: - - hourly: - hour: 6 - filters: - - isOpen - - hasLabel: - label: no-recent-activity - - isPullRequest - - noActivitySince: - days: 7 - actions: - - closeIssue - - addReply: - reply: "Hi @${issueAuthor}. Thank you for your contribution. Since there hasn't been recent engagement, we're going to close this out. Feel free to respond with a comment containing \"/reopen\" if you'd like to continue working on these changes. Please be sure to use the command to reopen or remove the \"no-recent-activity\" label; otherwise, this is likely to be closed again with the next cleanup pass. " - - description: - frequencies: - - weekday: - day: Friday - time: 5:0 - filters: - - isOpen - - isNotLabeledWith: - label: no-recent-activity - - noActivitySince: - days: 60 - - isPullRequest - actions: - - addLabel: - label: no-recent-activity - - addReply: - reply: Hi @${issueAuthor}. Thank you for your interest in helping to improve the Azure SDK experience and for your contribution. We've noticed that there hasn't been recent engagement on this pull request. If this is still an active work stream, please let us know by pushing some changes or leaving a comment. Otherwise, we'll close this out in 7 days. - eventResponderTasks: - - if: - - payloadType: Issue_Comment - - isAction: - action: Created - - isActivitySender: - issueAuthor: True - - hasLabel: - label: needs-author feedback - - isOpen - then: - - addLabel: - label: needs-team attention - - removeLabel: - label: needs-author feedback - description: - - if: - - payloadType: Issues - - not: - isAction: - action: Closed - - hasLabel: - label: no-recent-activity - then: - - removeLabel: - label: no-recent-activity - description: - - if: - - payloadType: Issue_Comment - - hasLabel: - label: no-recent-activity - then: - - removeLabel: - label: no-recent-activity - description: - - if: - - payloadType: Issues - - isAction: - action: Opened - - and: - - not: - activitySenderHasPermission: - permission: Write - - not: - activitySenderHasAssociation: - association: Member - - not: - activitySenderHasAssociation: - association: Collaborator - - not: - activitySenderHasPermission: - permission: Admin - then: - - addLabel: - label: customer-reported - - addLabel: - label: question - description: - - if: - - payloadType: Issues - - isAction: - action: Labeled - - labelAdded: - label: needs-author feedback - then: - - removeLabel: - label: needs-team attention - - removeLabel: - label: triage - - removeLabel: - label: needs-team triage - description: - - if: - - payloadType: Pull_Request - - isAction: - action: Opened - - and: - - not: - activitySenderHasPermission: - permission: Write - - not: - activitySenderHasAssociation: - association: Member - - not: - activitySenderHasAssociation: - association: Collaborator - - not: - activitySenderHasPermission: - permission: Admin - then: - - addLabel: - label: customer-reported - - addReply: - reply: Thank you for your contribution @${issueAuthor}! We will review the pull request and get back to you soon. - - addLabel: - label: community contribution - description: - - if: - - payloadType: Issues - - isAction: - action: Labeled - - not: - hasLabel: - label: needs-triage - - not: - hasLabel: - label: needs-team-triage - - not: - hasLabel: - label: needs-author-feedback - - hasLabel: - label: customer-reported - - not: - isInMilestone: - milestone: '' - - isOpen - - not: - hasLabel: - label: issue-addressed - then: - - addLabel: - label: needs-team-attention - description: - - if: - - payloadType: Pull_Request - - isOpen - - hasLabel: - label: auto-merge - - isAction: - action: Synchronize - - and: - - not: - activitySenderHasPermission: - permission: Admin - - not: - activitySenderHasPermission: - permission: Write - then: - - dismissPullRequestReview: - message: Hi @{issueAuthor}. We've noticed that new changes have been pushed to this pull request. Because it is set to automatically merge, we've reset the approvals to allow the opportunity to review the updates. - description: - - if: - - payloadType: Issues - - labelAdded: - label: issue-addressed - then: - - addReply: - reply: Hi @${issueAuthor}. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text “`/unresolve`” to remove the “issue-addressed” label and continue the conversation. - - removeLabel: - label: needs-triage - - removeLabel: - label: needs-team-triage - - removeLabel: - label: needs-team-attention - - removeLabel: - label: needs-author-feedback - - removeLabel: - label: no-recent-activity - description: - - if: - - payloadType: Issue_Comment - - hasLabel: - label: issue-addressed - - commentContains: - pattern: /unresolve - isRegex: False - - or: - - isActivitySender: - issueAuthor: True - - activitySenderHasPermission: - permission: Admin - - activitySenderHasPermission: - permission: Write - then: - - reopenIssue - - removeLabel: - label: issue-addressed - - addLabel: - label: needs-team-attention - description: - - if: - - payloadType: Issue_Comment - - hasLabel: - label: issue-addressed - - commentContains: - pattern: /unresolve - isRegex: False - - and: - - not: - isActivitySender: - issueAuthor: True - - not: - activitySenderHasPermission: - permission: Admin - - not: - activitySenderHasPermission: - permission: Write - then: - - addReply: - reply: Hi ${contextualAuthor}, only the original author of the issue can ask that it be unresolved. Please open a new issue with your scenario and details if you would like to discuss this topic with the team. - description: - - if: - - payloadType: Issues - - isOpen - - hasLabel: - label: issue-addressed - - or: - - labelAdded: - label: needs-team-attention - - labelAdded: - label: needs-author-feedback - - labelAdded: - label: Service Attention - - labelAdded: - label: needs-triage - - labelAdded: - label: needs-team-triage - then: - - removeLabel: - label: issue-addressed - description: - - if: - - payloadType: Pull_Request - - hasLabel: - label: no-recent-activity - - isOpen - - or: - - isAction: - action: Null - - isAction: - action: Synchronize - - isAction: - action: Null - then: - - removeLabel: - label: no-recent-activity - description: - - if: - - payloadType: Pull_Request_Review - - hasLabel: - label: no-recent-activity - - isOpen - then: - - removeLabel: - label: no-recent-activity - description: - - if: - - payloadType: Issue_Comment - - isAction: - action: Created - - hasLabel: - label: no-recent-activity - - isOpen - - and: - - not: - commentContains: - pattern: What is Check Enforcer? - isRegex: False - - not: - commentContains: - pattern: Since there hasn't been recent engagement, this is being closed out. - isRegex: False - then: - - removeLabel: - label: no-recent-activity - description: - - if: - - payloadType: Issue_Comment - - not: isOpen - - commentContains: - pattern: /reopen - isRegex: False - - hasLabel: - label: no-recent-activity - - or: - - isActivitySender: - issueAuthor: True - - activitySenderHasPermission: - permission: Admin - - activitySenderHasPermission: - permission: Write - then: - - reopenIssue - - removeLabel: - label: no-recent-activity - description: -onFailure: -onSuccess: +id: +name: GitOps.PullRequestIssueManagement +description: GitOps.PullRequestIssueManagement primitive +owner: +resource: repository +disabled: false +where: +configuration: + resourceManagementConfiguration: + scheduledSearches: + - description: + frequencies: + - daily: + time: 1:0 + filters: + - isIssue + - isOpen + - hasLabel: + label: needs-author feedback + - hasLabel: + label: no-recent-activity + - noActivitySince: + days: 14 + actions: + - closeIssue + - description: + frequencies: + - hourly: + hour: 6 + filters: + - isIssue + - isOpen + - hasLabel: + label: needs-author feedback + - noActivitySince: + days: 7 + - isNotLabeledWith: + label: no-recent-activity + actions: + - addLabel: + label: no-recent-activity + - addReply: + reply: Hi, we're sending this friendly reminder because we haven't heard back from you in **7 days**. We need more information about this issue to help address it. Please be sure to give us your input. If we don't hear back from you within **14 days** of this comment the issue will be automatically closed. Thank you! + - description: + frequencies: + - hourly: + hour: 6 + filters: + - isIssue + - isOpen + - hasLabel: + label: issue-addressed + - noActivitySince: + days: 7 + actions: + - addReply: + reply: Hi @${issueAuthor}, since you haven’t asked that we “`/unresolve`” the issue, we’ll close this out. If you believe further discussion is needed, please add a comment “`/unresolve`” to reopen the issue. + - closeIssue + - description: + frequencies: + - hourly: + hour: 6 + filters: + - isOpen + - hasLabel: + label: no-recent-activity + - isPullRequest + - noActivitySince: + days: 7 + actions: + - closeIssue + - addReply: + reply: "Hi @${issueAuthor}. Thank you for your contribution. Since there hasn't been recent engagement, we're going to close this out. Feel free to respond with a comment containing \"/reopen\" if you'd like to continue working on these changes. Please be sure to use the command to reopen or remove the \"no-recent-activity\" label; otherwise, this is likely to be closed again with the next cleanup pass. " + - description: + frequencies: + - weekday: + day: Friday + time: 5:0 + filters: + - isOpen + - isNotLabeledWith: + label: no-recent-activity + - noActivitySince: + days: 60 + - isPullRequest + actions: + - addLabel: + label: no-recent-activity + - addReply: + reply: Hi @${issueAuthor}. Thank you for your interest in helping to improve the Azure SDK experience and for your contribution. We've noticed that there hasn't been recent engagement on this pull request. If this is still an active work stream, please let us know by pushing some changes or leaving a comment. Otherwise, we'll close this out in 7 days. + eventResponderTasks: + - if: + - payloadType: Issue_Comment + - isAction: + action: Created + - isActivitySender: + issueAuthor: True + - hasLabel: + label: needs-author feedback + - isOpen + then: + - addLabel: + label: needs-team attention + - removeLabel: + label: needs-author feedback + description: + - if: + - payloadType: Issues + - not: + isAction: + action: Closed + - hasLabel: + label: no-recent-activity + then: + - removeLabel: + label: no-recent-activity + description: + - if: + - payloadType: Issue_Comment + - hasLabel: + label: no-recent-activity + then: + - removeLabel: + label: no-recent-activity + description: + - if: + - payloadType: Issues + - isAction: + action: Opened + - and: + - not: + activitySenderHasPermission: + permission: Write + - not: + activitySenderHasAssociation: + association: Member + - not: + activitySenderHasAssociation: + association: Collaborator + - not: + activitySenderHasPermission: + permission: Admin + then: + - addLabel: + label: customer-reported + - addLabel: + label: question + description: + - if: + - payloadType: Issues + - isAction: + action: Labeled + - labelAdded: + label: needs-author feedback + then: + - removeLabel: + label: needs-team attention + - removeLabel: + label: triage + - removeLabel: + label: needs-team triage + description: + - if: + - payloadType: Pull_Request + - isAction: + action: Opened + - and: + - not: + activitySenderHasPermission: + permission: Write + - not: + activitySenderHasAssociation: + association: Member + - not: + activitySenderHasAssociation: + association: Collaborator + - not: + activitySenderHasPermission: + permission: Admin + then: + - addLabel: + label: customer-reported + - addReply: + reply: Thank you for your contribution @${issueAuthor}! We will review the pull request and get back to you soon. + - addLabel: + label: community contribution + description: + - if: + - payloadType: Issues + - isAction: + action: Labeled + - not: + hasLabel: + label: needs-triage + - not: + hasLabel: + label: needs-team-triage + - not: + hasLabel: + label: needs-author-feedback + - hasLabel: + label: customer-reported + - not: + isInMilestone: + milestone: '' + - isOpen + - not: + hasLabel: + label: issue-addressed + then: + - addLabel: + label: needs-team-attention + description: + - if: + - payloadType: Pull_Request + - isOpen + - hasLabel: + label: auto-merge + - isAction: + action: Synchronize + - and: + - not: + activitySenderHasPermission: + permission: Admin + - not: + activitySenderHasPermission: + permission: Write + then: + - dismissPullRequestReview: + message: Hi @{issueAuthor}. We've noticed that new changes have been pushed to this pull request. Because it is set to automatically merge, we've reset the approvals to allow the opportunity to review the updates. + description: + - if: + - payloadType: Issues + - labelAdded: + label: issue-addressed + then: + - addReply: + reply: Hi @${issueAuthor}. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text “`/unresolve`” to remove the “issue-addressed” label and continue the conversation. + - removeLabel: + label: needs-triage + - removeLabel: + label: needs-team-triage + - removeLabel: + label: needs-team-attention + - removeLabel: + label: needs-author-feedback + - removeLabel: + label: no-recent-activity + description: + - if: + - payloadType: Issue_Comment + - hasLabel: + label: issue-addressed + - commentContains: + pattern: /unresolve + isRegex: False + - or: + - isActivitySender: + issueAuthor: True + - activitySenderHasPermission: + permission: Admin + - activitySenderHasPermission: + permission: Write + then: + - reopenIssue + - removeLabel: + label: issue-addressed + - addLabel: + label: needs-team-attention + description: + - if: + - payloadType: Issue_Comment + - hasLabel: + label: issue-addressed + - commentContains: + pattern: /unresolve + isRegex: False + - and: + - not: + isActivitySender: + issueAuthor: True + - not: + activitySenderHasPermission: + permission: Admin + - not: + activitySenderHasPermission: + permission: Write + then: + - addReply: + reply: Hi ${contextualAuthor}, only the original author of the issue can ask that it be unresolved. Please open a new issue with your scenario and details if you would like to discuss this topic with the team. + description: + - if: + - payloadType: Issues + - isOpen + - hasLabel: + label: issue-addressed + - or: + - labelAdded: + label: needs-team-attention + - labelAdded: + label: needs-author-feedback + - labelAdded: + label: Service Attention + - labelAdded: + label: needs-triage + - labelAdded: + label: needs-team-triage + then: + - removeLabel: + label: issue-addressed + description: + - if: + - payloadType: Pull_Request + - hasLabel: + label: no-recent-activity + - isOpen + - or: + - isAction: + action: Null + - isAction: + action: Synchronize + - isAction: + action: Null + then: + - removeLabel: + label: no-recent-activity + description: + - if: + - payloadType: Pull_Request_Review + - hasLabel: + label: no-recent-activity + - isOpen + then: + - removeLabel: + label: no-recent-activity + description: + - if: + - payloadType: Issue_Comment + - isAction: + action: Created + - hasLabel: + label: no-recent-activity + - isOpen + - and: + - not: + commentContains: + pattern: What is Check Enforcer? + isRegex: False + - not: + commentContains: + pattern: Since there hasn't been recent engagement, this is being closed out. + isRegex: False + then: + - removeLabel: + label: no-recent-activity + description: + - if: + - payloadType: Issue_Comment + - not: isOpen + - commentContains: + pattern: /reopen + isRegex: False + - hasLabel: + label: no-recent-activity + - or: + - isActivitySender: + issueAuthor: True + - activitySenderHasPermission: + permission: Admin + - activitySenderHasPermission: + permission: Write + then: + - reopenIssue + - removeLabel: + label: no-recent-activity + description: +onFailure: +onSuccess: From 63894bd3e3d446396c0f06ca5592bd7ad6ffed24 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Thu, 26 Jun 2025 11:41:39 -0400 Subject: [PATCH 09/18] remove erroneous commits --- .../typetest/property/optional/_types.py | 13 ------------- .../typetest/property/valuetypes/_types.py | 13 ------------- 2 files changed, 26 deletions(-) delete mode 100644 packages/typespec-python/test/azure/generated/typetest-property-optional/typetest/property/optional/_types.py delete mode 100644 packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/_types.py diff --git a/packages/typespec-python/test/azure/generated/typetest-property-optional/typetest/property/optional/_types.py b/packages/typespec-python/test/azure/generated/typetest-property-optional/typetest/property/optional/_types.py deleted file mode 100644 index efc2e343741..00000000000 --- a/packages/typespec-python/test/azure/generated/typetest-property-optional/typetest/property/optional/_types.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Literal, Union - -UnionStringLiteralPropertyProperty = Literal["hello", "world"] -UnionIntLiteralPropertyProperty = Literal[1, 2] -UnionFloatLiteralPropertyProperty = float diff --git a/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/_types.py b/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/_types.py deleted file mode 100644 index 4193b13917d..00000000000 --- a/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/_types.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Literal, Union - -UnionStringLiteralPropertyProperty = Literal["hello", "world"] -UnionIntLiteralPropertyProperty = Literal[42, 43] -UnionFloatLiteralPropertyProperty = float From 3a191c047d988d9bf95d9c077d0287af421a0632 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Thu, 26 Jun 2025 15:11:32 -0400 Subject: [PATCH 10/18] show diff if there is one --- eng/scripts/check-for-changed-files.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/eng/scripts/check-for-changed-files.js b/eng/scripts/check-for-changed-files.js index db3fd78726e..fb90fe42b26 100644 --- a/eng/scripts/check-for-changed-files.js +++ b/eng/scripts/check-for-changed-files.js @@ -23,6 +23,10 @@ if (proc.stderr) { } if (proc.stdout || proc.stderr) { + run("git", ["diff", "."], { + encoding: "utf-8", + stdio: [null, "pipe", "pipe"], + }); console.error( `ERROR: There are diffs in regeneration. Please run 'inv regenerate' and re-run. You may also have to remove 'node_modules' and re-run 'npm install' to get the latest testserver.`, ); From af35e48c4b5ba099e08982c34bb1ece08e46f94a Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Thu, 26 Jun 2025 16:15:01 -0400 Subject: [PATCH 11/18] update gitattributes --- .gitattributes | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.gitattributes b/.gitattributes index 2a0e8466c2c..40531c7315c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,10 +1,10 @@ -# These files are text and should be normalized (convert crlf => lf) -*.cs text diff=csharp -*.py text -*.json text -*.md text -*.iced text -*.csproj text +gitattributes# Default: auto-detect text files and force LF line endings +* text=auto eol=lf -# Use unix line endings always, even on Windows -* text=auto eol=lf +# Specific text files (these will inherit eol=lf from above) +*.cs text diff=csharp +*.py text +*.json text +*.md text +*.iced text +*.csproj text From f8d9a3b03263b133031f5003f4f63cf8b5b080f0 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Thu, 26 Jun 2025 16:18:09 -0400 Subject: [PATCH 12/18] try with git add and reset to normalize --- eng/scripts/check-for-changed-files.js | 44 ++++++++++++++++---------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/eng/scripts/check-for-changed-files.js b/eng/scripts/check-for-changed-files.js index fb90fe42b26..ade5642cd1c 100644 --- a/eng/scripts/check-for-changed-files.js +++ b/eng/scripts/check-for-changed-files.js @@ -2,33 +2,45 @@ const { run } = require("./helpers.js"); -// First, refresh the git index to normalize line endings -// This ensures line ending differences don't show up as changes +// Stage all current changes first (if any) + +run("git", ["add", "."], { + encoding: "utf-8", + stdio: [null, "pipe", "pipe"], +}); + +// Reset the index but keep working directory +run("git", ["reset"], { + encoding: "utf-8", + stdio: [null, "pipe", "pipe"], +}); + +// Re-add everything - this forces Git to apply .gitattributes rules to ALL files run("git", ["add", "--renormalize", "."], { - encoding: "utf-8", - stdio: [null, "pipe", "pipe"], + encoding: "utf-8", + stdio: [null, "pipe", "pipe"], }); const proc = run("git", ["status", "--porcelain", "."], { - encoding: "utf-8", - stdio: [null, "pipe", "pipe"], + encoding: "utf-8", + stdio: [null, "pipe", "pipe"], }); if (proc.stdout) { - console.log(proc.stdout); + console.log(proc.stdout); } if (proc.stderr) { - console.error(proc.stderr); + console.error(proc.stderr); } if (proc.stdout || proc.stderr) { - run("git", ["diff", "."], { - encoding: "utf-8", - stdio: [null, "pipe", "pipe"], - }); - console.error( - `ERROR: There are diffs in regeneration. Please run 'inv regenerate' and re-run. You may also have to remove 'node_modules' and re-run 'npm install' to get the latest testserver.`, - ); - process.exit(1); + run("git", ["diff", "."], { + encoding: "utf-8", + stdio: [null, "pipe", "pipe"], + }); + console.error( + `ERROR: There are diffs in regeneration. Please run 'inv regenerate' and re-run. You may also have to remove 'node_modules' and re-run 'npm install' to get the latest testserver.`, + ); + process.exit(1); } From 132e78b4882664447443783b0c5e6933ff5aece3 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Thu, 26 Jun 2025 16:34:55 -0400 Subject: [PATCH 13/18] log git diff --- eng/scripts/check-for-changed-files.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/eng/scripts/check-for-changed-files.js b/eng/scripts/check-for-changed-files.js index ade5642cd1c..526cd07f078 100644 --- a/eng/scripts/check-for-changed-files.js +++ b/eng/scripts/check-for-changed-files.js @@ -35,10 +35,15 @@ if (proc.stderr) { } if (proc.stdout || proc.stderr) { - run("git", ["diff", "."], { + const diffProc = run("git", ["diff", "."], { encoding: "utf-8", stdio: [null, "pipe", "pipe"], }); + + if (diffProc.stdout) { + console.log("Git diff output:"); + console.log(diffProc.stdout); + } console.error( `ERROR: There are diffs in regeneration. Please run 'inv regenerate' and re-run. You may also have to remove 'node_modules' and re-run 'npm install' to get the latest testserver.`, ); From e2dbc3189f483a0151dcf2ad4589fc87d73c45fc Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Thu, 26 Jun 2025 16:55:25 -0400 Subject: [PATCH 14/18] console error the stdout --- eng/scripts/check-for-changed-files.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/eng/scripts/check-for-changed-files.js b/eng/scripts/check-for-changed-files.js index 526cd07f078..47b21657e0f 100644 --- a/eng/scripts/check-for-changed-files.js +++ b/eng/scripts/check-for-changed-files.js @@ -41,11 +41,7 @@ if (proc.stdout || proc.stderr) { }); if (diffProc.stdout) { - console.log("Git diff output:"); - console.log(diffProc.stdout); + console.error(diffProc.stdout); } - console.error( - `ERROR: There are diffs in regeneration. Please run 'inv regenerate' and re-run. You may also have to remove 'node_modules' and re-run 'npm install' to get the latest testserver.`, - ); process.exit(1); } From 505ec1f70b94a0f17c2d5d99cf798e87b0c803eb Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Wed, 2 Jul 2025 12:28:44 -0400 Subject: [PATCH 15/18] fix gitattributes file --- .gitattributes | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitattributes b/.gitattributes index 40531c7315c..9ccb537a987 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,4 +1,4 @@ -gitattributes# Default: auto-detect text files and force LF line endings +# Default: auto-detect text files and force LF line endings * text=auto eol=lf # Specific text files (these will inherit eol=lf from above) From 77f570ab7a93eb368095894bf170f8c0302da74f Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Wed, 2 Jul 2025 13:25:47 -0400 Subject: [PATCH 16/18] try new copilot diff --- eng/scripts/check-for-changed-files.js | 39 +++++++++++--------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/eng/scripts/check-for-changed-files.js b/eng/scripts/check-for-changed-files.js index 47b21657e0f..7fadd25f8c2 100644 --- a/eng/scripts/check-for-changed-files.js +++ b/eng/scripts/check-for-changed-files.js @@ -2,15 +2,8 @@ const { run } = require("./helpers.js"); -// Stage all current changes first (if any) - -run("git", ["add", "."], { - encoding: "utf-8", - stdio: [null, "pipe", "pipe"], -}); - -// Reset the index but keep working directory -run("git", ["reset"], { +// First, reset any staged changes and clean the working directory +run("git", ["reset", "HEAD", "."], { encoding: "utf-8", stdio: [null, "pipe", "pipe"], }); @@ -21,27 +14,29 @@ run("git", ["add", "--renormalize", "."], { stdio: [null, "pipe", "pipe"], }); -const proc = run("git", ["status", "--porcelain", "."], { +// Check for differences ignoring whitespace and line endings +const proc = run("git", ["diff", "--ignore-space-at-eol", "--ignore-blank-lines", "--cached"], { encoding: "utf-8", stdio: [null, "pipe", "pipe"], }); -if (proc.stdout) { - console.log(proc.stdout); -} - -if (proc.stderr) { - console.error(proc.stderr); -} - -if (proc.stdout || proc.stderr) { - const diffProc = run("git", ["diff", "."], { +if (proc.stdout && proc.stdout.toString().trim()) { + console.log("Detected actual content changes (ignoring line endings):"); + console.log(proc.stdout.toString()); + + // Also show the status for context + const statusProc = run("git", ["status", "--porcelain", "."], { encoding: "utf-8", stdio: [null, "pipe", "pipe"], }); - if (diffProc.stdout) { - console.error(diffProc.stdout); + if (statusProc.stdout) { + console.log("Git status:"); + console.log(statusProc.stdout); } + + console.error( + `ERROR: There are actual content diffs in regeneration (excluding line ending changes). Please run 'inv regenerate' and re-run. You may also have to remove 'node_modules' and re-run 'npm install' to get the latest testserver.`, + ); process.exit(1); } From 019676701da789115c385e9714ef7bb6eb07ff99 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Wed, 2 Jul 2025 13:55:27 -0400 Subject: [PATCH 17/18] only check for linux --- eng/scripts/check-for-changed-files.js | 47 ++++++++------------------ 1 file changed, 14 insertions(+), 33 deletions(-) diff --git a/eng/scripts/check-for-changed-files.js b/eng/scripts/check-for-changed-files.js index 7fadd25f8c2..2903114428e 100644 --- a/eng/scripts/check-for-changed-files.js +++ b/eng/scripts/check-for-changed-files.js @@ -2,41 +2,22 @@ const { run } = require("./helpers.js"); -// First, reset any staged changes and clean the working directory -run("git", ["reset", "HEAD", "."], { - encoding: "utf-8", - stdio: [null, "pipe", "pipe"], +const proc = run("git", ["status", "--porcelain", "."], { + encoding: "utf-8", + stdio: [null, "pipe", "pipe"], }); -// Re-add everything - this forces Git to apply .gitattributes rules to ALL files -run("git", ["add", "--renormalize", "."], { - encoding: "utf-8", - stdio: [null, "pipe", "pipe"], -}); +if (proc.stdout) { + console.log(proc.stdout); +} -// Check for differences ignoring whitespace and line endings -const proc = run("git", ["diff", "--ignore-space-at-eol", "--ignore-blank-lines", "--cached"], { - encoding: "utf-8", - stdio: [null, "pipe", "pipe"], -}); +if (proc.stderr) { + console.error(proc.stderr); +} -if (proc.stdout && proc.stdout.toString().trim()) { - console.log("Detected actual content changes (ignoring line endings):"); - console.log(proc.stdout.toString()); - - // Also show the status for context - const statusProc = run("git", ["status", "--porcelain", "."], { - encoding: "utf-8", - stdio: [null, "pipe", "pipe"], - }); - - if (statusProc.stdout) { - console.log("Git status:"); - console.log(statusProc.stdout); - } - - console.error( - `ERROR: There are actual content diffs in regeneration (excluding line ending changes). Please run 'inv regenerate' and re-run. You may also have to remove 'node_modules' and re-run 'npm install' to get the latest testserver.`, - ); - process.exit(1); +if (proc.stdout || proc.stderr) { + console.error( + `ERROR: There are diffs in regeneration. Please run 'inv regenerate' and re-run. You may also have to remove 'node_modules' and re-run 'npm install' to get the latest testserver.`, + ); + process.exit(1); } From bc66d1f622261218dae0eb268d7c541068e84a64 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Wed, 2 Jul 2025 13:57:09 -0400 Subject: [PATCH 18/18] only check changed files only for linux --- eng/pipelines/ci-template.yml | 288 +++++++++++++++++----------------- 1 file changed, 144 insertions(+), 144 deletions(-) diff --git a/eng/pipelines/ci-template.yml b/eng/pipelines/ci-template.yml index f27da67075f..f474bfc6d36 100644 --- a/eng/pipelines/ci-template.yml +++ b/eng/pipelines/ci-template.yml @@ -1,147 +1,147 @@ parameters: - installAutorest: false - installTypeSpec: false - installCadlRanch: false - folderName: "" - regenerate: false - checkChange: true - updateToLatestTypespec: false - unitTest: false - skipWarning: false + installAutorest: false + installTypeSpec: false + installCadlRanch: false + folderName: "" + regenerate: false + checkChange: true + updateToLatestTypespec: false + unitTest: false + skipWarning: false steps: - - checkout: self - - checkout: azure-sdk-tools - - template: eng/common/testproxy/test-proxy-tool.yml@azure-sdk-tools - parameters: - TestProxy: true - templateRoot: azure-sdk-tools - - task: NodeTool@0 - displayName: "Install Node.js 20.x" - inputs: - versionSpec: "20.x" - - - task: UsePythonVersion@0 - displayName: "Use Python $(PythonVersion)" - inputs: - versionSpec: $(PythonVersion) - - - script: npm install -g pnpm@9.5.0 - displayName: Install pnpm 9.5.0 - - - script: npm install -g autorest - displayName: Install autorest - condition: and(succeeded(), ${{ parameters.installAutorest }}) - - - script: npm install -g @typespec/compiler - displayName: Install TypeSpec - condition: and(succeeded(), ${{ parameters.installTypeSpec }}) - - - script: npm install -g @typespec/compiler@next - displayName: Install TypeSpec Next - condition: and(succeeded(), ${{ parameters.updateToLatestTypespec }}) - - - script: npm install -g @azure-tools/typespec-bump-deps@latest - displayName: Install @azure-tools/typespec-bump-deps - condition: and(succeeded(), ${{ parameters.updateToLatestTypespec }}) - - - script: npx @azure-tools/typespec-bump-deps package.json packages/typespec-python/package.json - displayName: Update typespec packages to latest dev version - workingDirectory: $(Build.SourcesDirectory)/autorest.python/ - condition: and(succeeded(), ${{ parameters.updateToLatestTypespec }}) - - - script: pnpm install --no-frozen-lockfile - displayName: Pnpm install no frozen lockfile - workingDirectory: $(Build.SourcesDirectory)/autorest.python/ - condition: and(succeeded(), ${{ parameters.updateToLatestTypespec }}) - - - script: pnpm install - displayName: Pnpm install - workingDirectory: $(Build.SourcesDirectory)/autorest.python/ - condition: and(succeeded(), eq(${{ parameters.updateToLatestTypespec }}, false)) - - - script: pnpm list - displayName: Pnpm list - workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/typespec-python - - - script: pnpm run build - displayName: Build project - workingDirectory: $(Build.SourcesDirectory)/autorest.python/ - - - script: pip list - displayName: List installed packages - workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/${{parameters.folderName}} - - - script: pip install -r dev_requirements.txt - displayName: Pip install dev requirements - workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/${{parameters.folderName}} - - - script: pip list - displayName: List installed packages - workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/${{parameters.folderName}} - - - script: pnpm run cspell - displayName: Cspell - workingDirectory: $(Build.SourcesDirectory)/autorest.python/ - - - script: pnpm run lint --command eslint --skipWarning ${{ parameters.skipWarning }} - displayName: Eslint - workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/${{parameters.folderName}} - - - script: pnpm run lint --command pylint - displayName: Pylint - workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/${{parameters.folderName}} - - - script: pnpm run lint --command mypy - displayName: Mypy - workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/${{parameters.folderName}} - - - script: pnpm run lint --command pyright - displayName: Pyright - workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/${{parameters.folderName}} - - - script: pnpm run format - displayName: Black - workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/${{parameters.folderName}} - - - script: node ./eng/scripts/check-for-changed-files.js - displayName: Fail on black diff of root folder - workingDirectory: $(Build.SourcesDirectory)/autorest.python/ - condition: and(succeeded(), ${{ parameters.checkChange }}) - - - script: | - cd test/unittests - tox run -e ci - displayName: Unit tests - workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/${{parameters.folderName}}/ - condition: and(succeeded(), ${{ parameters.unitTest }}) - - - script: inv regenerate - displayName: "Regenerate Code(autorest)" - workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/${{parameters.folderName}}/ - condition: and(succeeded(), ${{ parameters.regenerate }}, eq('${{parameters.folderName}}', 'autorest.python')) - - - script: | - rm -rf test/azure/generated test/unbranded/generated - npm run regenerate - displayName: "Regenerate Code(typespec)" - workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/${{parameters.folderName}}/ - condition: and(succeeded(), ${{ parameters.regenerate }}, eq('${{parameters.folderName}}', 'typespec-python')) - - - script: node ../../../eng/scripts/check-for-changed-files.js - displayName: Fail on regeneration diff in Typespec - workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/typespec-python/test - condition: and(succeeded(), ${{ parameters.regenerate }}, ${{ parameters.checkChange }}) - - - script: node ../../../eng/scripts/check-for-changed-files.js - displayName: Fail on regeneration diff in Autorest - workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/autorest.python/test - condition: and(succeeded(), ${{ parameters.regenerate }}, ${{ parameters.checkChange }}) - - - script: | - pnpm pack - AbsolutePkgPath=$(find "$(pwd)" -name "autorest-python-*" -maxdepth 1) - cd ../.. - pnpm install $AbsolutePkgPath -w --verbose - displayName: Test tarball - workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/${{parameters.folderName}}/ + - checkout: self + - checkout: azure-sdk-tools + - template: eng/common/testproxy/test-proxy-tool.yml@azure-sdk-tools + parameters: + TestProxy: true + templateRoot: azure-sdk-tools + - task: NodeTool@0 + displayName: "Install Node.js 20.x" + inputs: + versionSpec: "20.x" + + - task: UsePythonVersion@0 + displayName: "Use Python $(PythonVersion)" + inputs: + versionSpec: $(PythonVersion) + + - script: npm install -g pnpm@9.5.0 + displayName: Install pnpm 9.5.0 + + - script: npm install -g autorest + displayName: Install autorest + condition: and(succeeded(), ${{ parameters.installAutorest }}) + + - script: npm install -g @typespec/compiler + displayName: Install TypeSpec + condition: and(succeeded(), ${{ parameters.installTypeSpec }}) + + - script: npm install -g @typespec/compiler@next + displayName: Install TypeSpec Next + condition: and(succeeded(), ${{ parameters.updateToLatestTypespec }}) + + - script: npm install -g @azure-tools/typespec-bump-deps@latest + displayName: Install @azure-tools/typespec-bump-deps + condition: and(succeeded(), ${{ parameters.updateToLatestTypespec }}) + + - script: npx @azure-tools/typespec-bump-deps package.json packages/typespec-python/package.json + displayName: Update typespec packages to latest dev version + workingDirectory: $(Build.SourcesDirectory)/autorest.python/ + condition: and(succeeded(), ${{ parameters.updateToLatestTypespec }}) + + - script: pnpm install --no-frozen-lockfile + displayName: Pnpm install no frozen lockfile + workingDirectory: $(Build.SourcesDirectory)/autorest.python/ + condition: and(succeeded(), ${{ parameters.updateToLatestTypespec }}) + + - script: pnpm install + displayName: Pnpm install + workingDirectory: $(Build.SourcesDirectory)/autorest.python/ + condition: and(succeeded(), eq(${{ parameters.updateToLatestTypespec }}, false)) + + - script: pnpm list + displayName: Pnpm list + workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/typespec-python + + - script: pnpm run build + displayName: Build project + workingDirectory: $(Build.SourcesDirectory)/autorest.python/ + + - script: pip list + displayName: List installed packages + workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/${{parameters.folderName}} + + - script: pip install -r dev_requirements.txt + displayName: Pip install dev requirements + workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/${{parameters.folderName}} + + - script: pip list + displayName: List installed packages + workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/${{parameters.folderName}} + + - script: pnpm run cspell + displayName: Cspell + workingDirectory: $(Build.SourcesDirectory)/autorest.python/ + + - script: pnpm run lint --command eslint --skipWarning ${{ parameters.skipWarning }} + displayName: Eslint + workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/${{parameters.folderName}} + + - script: pnpm run lint --command pylint + displayName: Pylint + workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/${{parameters.folderName}} + + - script: pnpm run lint --command mypy + displayName: Mypy + workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/${{parameters.folderName}} + + - script: pnpm run lint --command pyright + displayName: Pyright + workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/${{parameters.folderName}} + + - script: pnpm run format + displayName: Black + workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/${{parameters.folderName}} + + - script: node ./eng/scripts/check-for-changed-files.js + displayName: Fail on black diff of root folder + workingDirectory: $(Build.SourcesDirectory)/autorest.python/ + condition: and(succeeded(), ${{ parameters.checkChange }}, eq(variables['Agent.OS'], 'Linux')) + + - script: | + cd test/unittests + tox run -e ci + displayName: Unit tests + workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/${{parameters.folderName}}/ + condition: and(succeeded(), ${{ parameters.unitTest }}) + + - script: inv regenerate + displayName: "Regenerate Code(autorest)" + workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/${{parameters.folderName}}/ + condition: and(succeeded(), ${{ parameters.regenerate }}, eq('${{parameters.folderName}}', 'autorest.python')) + + - script: | + rm -rf test/azure/generated test/unbranded/generated + npm run regenerate + displayName: "Regenerate Code(typespec)" + workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/${{parameters.folderName}}/ + condition: and(succeeded(), ${{ parameters.regenerate }}, eq('${{parameters.folderName}}', 'typespec-python')) + + - script: node ../../../eng/scripts/check-for-changed-files.js + displayName: Fail on regeneration diff in Typespec + workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/typespec-python/test + condition: and(succeeded(), ${{ parameters.regenerate }}, ${{ parameters.checkChange }}, eq(variables['Agent.OS'], 'Linux')) + + - script: node ../../../eng/scripts/check-for-changed-files.js + displayName: Fail on regeneration diff in Autorest + workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/autorest.python/test + condition: and(succeeded(), ${{ parameters.regenerate }}, ${{ parameters.checkChange }}, eq(variables['Agent.OS'], 'Linux')) + + - script: | + pnpm pack + AbsolutePkgPath=$(find "$(pwd)" -name "autorest-python-*" -maxdepth 1) + cd ../.. + pnpm install $AbsolutePkgPath -w --verbose + displayName: Test tarball + workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/${{parameters.folderName}}/