From 0108b2ba808aa4e0308d350205c920d0dda37334 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Fri, 15 Mar 2024 17:23:56 -0400 Subject: [PATCH] Sync eng/common directory with azure-sdk-tools for PR 7892 (#28944) Sync eng/common directory with azure-sdk-tools for PR https://github.com/Azure/azure-sdk-tools/pull/7892 See [eng/common workflow](https://github.com/Azure/azure-sdk-tools/blob/main/eng/common/README.md#workflow) --------- Co-authored-by: Ben Broderick Phillips --- .../templates/steps/bypass-local-dns.yml | 2 +- .../templates/steps/git-push-changes.yml | 23 +++++-------------- eng/common/scripts/check-for-git-changes.ps1 | 14 +++++++++++ eng/common/testproxy/publish-proxy-logs.yml | 7 +++--- 4 files changed, 25 insertions(+), 21 deletions(-) create mode 100644 eng/common/scripts/check-for-git-changes.ps1 diff --git a/eng/common/pipelines/templates/steps/bypass-local-dns.yml b/eng/common/pipelines/templates/steps/bypass-local-dns.yml index 922f58a8286c..6e30c91fd258 100644 --- a/eng/common/pipelines/templates/steps/bypass-local-dns.yml +++ b/eng/common/pipelines/templates/steps/bypass-local-dns.yml @@ -6,6 +6,6 @@ steps: condition: | and( succeededOrFailed(), - contains(variables['OSVmImage'], 'ubuntu'), + or(contains(variables['OSVmImage'], 'ubuntu'),contains(variables['OSVmImage'], 'linux')), eq(variables['Container'], '') ) diff --git a/eng/common/pipelines/templates/steps/git-push-changes.yml b/eng/common/pipelines/templates/steps/git-push-changes.yml index a922b203a9b1..c8fbeaa9769c 100644 --- a/eng/common/pipelines/templates/steps/git-push-changes.yml +++ b/eng/common/pipelines/templates/steps/git-push-changes.yml @@ -10,25 +10,14 @@ parameters: SkipCheckingForChanges: false steps: -- pwsh: | - echo "git add -A" - git add -A - - echo "git diff --name-status --cached --exit-code" - git diff --name-status --cached --exit-code - - if ($LastExitCode -ne 0) { - echo "##vso[task.setvariable variable=HasChanges]$true" - echo "Changes detected so setting HasChanges=true" - } - else { - echo "##vso[task.setvariable variable=HasChanges]$false" - echo "No changes so skipping code push" - } +- task: PowerShell@2 displayName: Check for changes condition: and(succeeded(), eq(${{ parameters.SkipCheckingForChanges }}, false)) - workingDirectory: ${{ parameters.WorkingDirectory }} - ignoreLASTEXITCODE: true + inputs: + pwsh: true + workingDirectory: ${{ parameters.WorkingDirectory }} + filePath: ${{ parameters.ScriptDirectory }}/check-for-git-changes.ps1 + ignoreLASTEXITCODE: true - pwsh: | # Remove the repo owner from the front of the repo name if it exists there diff --git a/eng/common/scripts/check-for-git-changes.ps1 b/eng/common/scripts/check-for-git-changes.ps1 new file mode 100644 index 000000000000..2c1186ab0b3f --- /dev/null +++ b/eng/common/scripts/check-for-git-changes.ps1 @@ -0,0 +1,14 @@ +echo "git add -A" +git add -A + +echo "git diff --name-status --cached --exit-code" +git diff --name-status --cached --exit-code + +if ($LastExitCode -ne 0) { + echo "##vso[task.setvariable variable=HasChanges]$true" + echo "Changes detected so setting HasChanges=true" +} +else { + echo "##vso[task.setvariable variable=HasChanges]$false" + echo "No changes so skipping code push" +} diff --git a/eng/common/testproxy/publish-proxy-logs.yml b/eng/common/testproxy/publish-proxy-logs.yml index 543186edd353..4f4d3d7f548f 100644 --- a/eng/common/testproxy/publish-proxy-logs.yml +++ b/eng/common/testproxy/publish-proxy-logs.yml @@ -3,16 +3,17 @@ parameters: steps: - pwsh: | - Copy-Item -Path "${{ parameters.rootFolder }}/test-proxy.log" -Destination "${{ parameters.rootFolder }}/proxy.log" + New-Item -ItemType Directory -Force "${{ parameters.rootFolder }}/proxy-logs" + Copy-Item -Path "${{ parameters.rootFolder }}/test-proxy.log" -Destination "${{ parameters.rootFolder }}/proxy-logs/proxy.log" displayName: Copy Log File condition: succeededOrFailed() - template: ../pipelines/templates/steps/publish-artifact.yml parameters: ArtifactName: "$(System.StageName)-$(System.JobName)-$(System.JobAttempt)-proxy-logs" - ArtifactPath: "${{ parameters.rootFolder }}/proxy.log" + ArtifactPath: "${{ parameters.rootFolder }}/proxy-logs" - pwsh: | - Remove-Item -Force ${{ parameters.rootFolder }}/proxy.log + Remove-Item -Force ${{ parameters.rootFolder }}/proxy-logs/proxy.log displayName: Cleanup Copied Log File condition: succeededOrFailed()