From e0fed5edf319b0d35433976e1ecfd33fe069aa37 Mon Sep 17 00:00:00 2001 From: Chidozie Ononiwu Date: Tue, 15 Sep 2020 19:49:10 -0700 Subject: [PATCH] Add some changes in eng/common to test things --- .../templates/steps/create-pull-request.yml | 3 ++- .../scripts/modules/ChangeLog-Operations.psm1 | 2 +- eng/common/scripts/modules/Package-Properties.psm1 | 1 + eng/pipelines/eng-common-sync.yml | 14 ++++++++++---- eng/pipelines/templates/steps/sync-directory.yml | 8 +++++--- 5 files changed, 19 insertions(+), 9 deletions(-) diff --git a/eng/common/pipelines/templates/steps/create-pull-request.yml b/eng/common/pipelines/templates/steps/create-pull-request.yml index acdce7059583..298eada800b3 100644 --- a/eng/common/pipelines/templates/steps/create-pull-request.yml +++ b/eng/common/pipelines/templates/steps/create-pull-request.yml @@ -17,6 +17,7 @@ parameters: GHTeamReviewersVariable: '' # Multiple labels seperated by comma, e.g. "bug, APIView" PRLabels: '' + SkipCheckingForChanges: false steps: @@ -42,7 +43,7 @@ steps: echo "RepoName = $repName" displayName: Check for changes - condition: and(succeeded(), eq(variables['HasChanges'], '')) + condition: and(succeeded(), eq(${{ parameters.SkipCheckingForChanges }}, true)) workingDirectory: ${{ parameters.WorkingDirectory }} ignoreLASTEXITCODE: true diff --git a/eng/common/scripts/modules/ChangeLog-Operations.psm1 b/eng/common/scripts/modules/ChangeLog-Operations.psm1 index 5aed584d018b..46e4fd9302f4 100644 --- a/eng/common/scripts/modules/ChangeLog-Operations.psm1 +++ b/eng/common/scripts/modules/ChangeLog-Operations.psm1 @@ -1,5 +1,5 @@ # Common Changelog Operations - +# This Files has been retired $RELEASE_TITLE_REGEX = "(?^\#+.*(?\b\d+\.\d+\.\d+([^0-9\s][^\s:]+)?)(\s(?\(Unreleased\)|\(\d{4}-\d{2}-\d{2}\)))?)" # Returns a Collection of changeLogEntry object containing changelog info for all version present in the gived CHANGELOG diff --git a/eng/common/scripts/modules/Package-Properties.psm1 b/eng/common/scripts/modules/Package-Properties.psm1 index b0572a71d449..61c45455f0d0 100644 --- a/eng/common/scripts/modules/Package-Properties.psm1 +++ b/eng/common/scripts/modules/Package-Properties.psm1 @@ -1,3 +1,4 @@ +# This Files has been retired # Helper functions for retireving useful information from azure-sdk-for-* repo # Example Use : Import-Module .\eng\common\scripts\modules class PackageProps diff --git a/eng/pipelines/eng-common-sync.yml b/eng/pipelines/eng-common-sync.yml index 9326966e57de..ad02176ac503 100644 --- a/eng/pipelines/eng-common-sync.yml +++ b/eng/pipelines/eng-common-sync.yml @@ -33,11 +33,16 @@ stages: - ${{ if eq(variables['Build.Reason'], 'PullRequest') }}: - pwsh: | $patchDir = "$(System.DefaultWorkingDirectory)/patchfiles" - $patchfiles = git format-patch $(system.pullRequest.sourceBranch)...$(system.pullRequest.targetBranch) ${{ parameters.DirectoryToSync }} -o $patchDir - if ($patchfiles) - { + git log --graph --pretty=format:'%C(auto)%h%d %s %Creset%C(green)//%an %cr%Creset' -20 + $patchfiles = git format-patch HEAD~1...origin/master -- ${{ parameters.DirectoryToSync }} -o $patchDir + Write-Host "Patch Files $patchfiles" + Write-Host "LASTEXITCODE $LASTEXITCODE" + if ($patchfiles -and ($LASTEXITCODE -eq 0)) { echo "##vso[task.setvariable variable=PatchFilesLocation]$patchDir" - echo "##vso[task.setvariable variable=HasChanges]$true" + } + else { + Write-Host "Failed to Create PatchFiles from Pull Request [https://github.com/Azure/azure-sdk-tools/pull/$(System.PullRequest.PullRequestNumber)]" + exit 1 } displayName: Create Patch Files from Changes in PR workingDirectory: $(System.DefaultWorkingDirectory) @@ -53,6 +58,7 @@ stages: PRBody: > Sync ${{ parameters.DirectoryToSync }} directory with azure-sdk-tools for PR https://github.com/Azure/azure-sdk-tools/pull/$(System.PullRequest.PullRequestNumber)
See [eng/common workflow](https://github.com/Azure/azure-sdk-tools/blob/master/eng/common/README.md#workflow) + SkipCheckingForChanges: true ${{ if ne(variables['Build.Reason'], 'PullRequest') }}: CommitMessage: Sync ${{ parameters.DirectoryToSync }} directory with azure-sdk-tools repository DirectoryToSync: ${{ parameters.DirectoryToSync }} diff --git a/eng/pipelines/templates/steps/sync-directory.yml b/eng/pipelines/templates/steps/sync-directory.yml index 8fc6105ba430..7d0e95c1a1c2 100644 --- a/eng/pipelines/templates/steps/sync-directory.yml +++ b/eng/pipelines/templates/steps/sync-directory.yml @@ -7,6 +7,7 @@ parameters: PRTitle: pr-title-not-set PRBody: pr-body-not-set PRDataArtifactPath: pr-data-artifact-path-not-set + SkipCheckingForChanges: false steps: - pwsh: | @@ -20,10 +21,10 @@ steps: if ($PatchFilesLocation) { pushd ${{ repo }} - $results = Get-ChildItem $PatchFilesLocation | % { $git am $_.FullName } - if ($results.Count -ne (Get-ChildItem $PatchFilesLocation).Count) + $results = Get-ChildItem $PatchFilesLocation | % { git am $_.FullName } + if (($results.Count -ne (Get-ChildItem $PatchFilesLocation).Count) -or ($LASTEXITCODE -ne 0)) { - Write-Output "Failed to apply patch files" + Write-Output "Failed to apply patch files to [https://github.com/azure/${{ repo }}]" exit 1 } } @@ -50,6 +51,7 @@ steps: PushArgs: -f WorkingDirectory: $(System.DefaultWorkingDirectory)/${{ repo }} ScriptDirectory: $(System.DefaultWorkingDirectory)/eng/common/scripts + SkipCheckingForChanges: ${{ parameters.SkipCheckingForChanges }} - pwsh: | $PRData = "Azure;${{ repo }};$(Submitted.PullRequest.Number)"