Skip to content
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

Yanxu/sync tools folder generation #26636

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .azure-pipelines/security-tools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
steps:
- checkout: self
fetchTags: false
- template: util/get-github-pat-steps.yml
- template: util/get-pr-changed-files.yml
- task: PowerShell@2
displayName: Install platyPS
inputs:
Expand All @@ -43,8 +43,6 @@ jobs:
inputs:
targetType: inline
script: dotnet msbuild build.proj /t:"Build;GenerateHelp" /p:"PullRequestNumber=$(System.PullRequest.PullRequestNumber);IsSecurityCheck=true"
env:
OCTOKITPAT: $(GithubToken)
- task: securedevelopmentteam.vss-secure-development-tools.build-task-credscan.CredScan@3
displayName: Run CredScan
inputs:
Expand Down
4 changes: 1 addition & 3 deletions .azure-pipelines/util/build-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ parameters:

steps:
- checkout: self
persistCredentials: true
- template: get-github-token-steps.yml
- template: get-pr-changed-files.yml
- task: NodeTool@0
condition: eq(variables.IsGenerateBased, true)
displayName: Install Autorest
Expand Down Expand Up @@ -39,7 +38,6 @@ steps:
custom: msbuild
arguments: 'build.proj /t:Build /p:Configuration=${{ parameters.configuration }};TestFramework=${{ parameters.testFramework }};PullRequestNumber=$(System.PullRequest.PullRequestNumber)'
env:
OCTOKITPAT: $(GithubToken)
PowerShellPlatform: ${{ parameters.powerShellPlatform }}

- task: PowerShell@2
Expand Down
24 changes: 24 additions & 0 deletions .azure-pipelines/util/get-pr-changed-files.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
steps:
- task: PowerShell@2
displayName: List PR Changed Files
inputs:
targetType: inline
pwsh: true
script: |
# refer to https://learn.microsoft.com/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml#system-variables-devops-services
# get the target branch name
$targetBranch = "$(System.PullRequest.TargetBranch)"
# fetch the targetBranch from origin to local branch and rename the branch to 'origin/base'
git fetch --no-tags origin "${targetBranch}:origin/base"
# refer to https://git-scm.com/docs/git-diff
# compare the pr and targetBranch branch, get the changed file list
# diff-filter options are ACMRT, which are: Added, Copied, Modified, Renamed , Changed
$changedFiles = git --no-pager diff --name-only --diff-filter=ACMRT origin/base -- .
Write-Host "Total updated files:" $changedFiles.Count
Write-Host "All Updated files:"
$changedFiles | Foreach-Object {Write-Host $_}
$RepoArtifacts = 'artifacts'
if(-not (Test-Path $RepoArtifacts)){
New-Item -ItemType Directory -Name $RepoArtifacts
}
$changedFiles | Out-File $RepoArtifacts/FilesChanged.txt
10 changes: 2 additions & 8 deletions build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@
<UsingTask Condition="$(OnPremiseBuild)" TaskName="CorporateValidation" AssemblyFile="$(CIToolsPath)/Microsoft.WindowsAzure.Tools.Build.Tasks.OnPremise.dll" />
<Import Condition="$(OnPremiseBuild)" Project="$(CIToolsPath)/Microsoft.WindowsAzure.Build.OnPremise.msbuild" />
<UsingTask TaskName="ESRPSignTask" AssemblyFile="$(CISignRepoPath)/tools/sdkbuildtools/tasks/MS.Az.Sdk.OnPremise.Build.Tasks.dll" />
<UsingTask TaskName="FilesChangedTask" AssemblyFile="$(RepoArtifacts)Microsoft.Azure.Build.Tasks/Microsoft.Azure.Build.Tasks.dll" />
<UsingTask TaskName="CIFilterTask" AssemblyFile="$(RepoArtifacts)Microsoft.Azure.Build.Tasks/Microsoft.Azure.Build.Tasks.dll" />

<Target Name="Clean">
Expand All @@ -131,16 +130,11 @@
<!-- Build the Microsoft.Azure.Build.Tasks project -->
<Exec Command="dotnet publish $(RepoTools)BuildPackagesTask/Microsoft.Azure.Build.Tasks/Microsoft.Azure.Build.Tasks.csproj -c $(Configuration)" />

<!-- Get all of the files changed in the given pull request -->
<FilesChangedTask RepositoryOwner="Azure" RepositoryName="azure-powershell" PullRequestNumber="$(PullRequestNumber)" OutputFile="$(RepoArtifacts)FilesChanged.txt">
<Output TaskParameter="FilesChanged" ItemName="FilesChanged" />
</FilesChangedTask>

<Exec Command="$(PowerShellCoreCommandPrefix) &quot;$(RepoTools)PrepareAutorestModule.ps1&quot;" Condition="'$(IsGenerateBased)' == 'true'"/>
<Exec Command="$(PowerShellCoreCommandPrefix) &quot;$(RepoTools)CreateFilterMappings.ps1&quot;" />
<Exec Command="$(PowerShellCoreCommandPrefix) &quot;$(RepoTools)PrepareForSecurityCheck.ps1&quot;" Condition="'$(IsSecurityCheck)' == 'true'"/>

<CIFilterTask FilesChanged="@(FilesChanged)" Mode="$(Configuration)" CsprojMapFilePath="./CsprojMappings.json">
<CIFilterTask FilesChangedFile="$(RepoArtifacts)FilesChanged.txt" Mode="$(Configuration)" CsprojMapFilePath="./CsprojMappings.json">
<Output TaskParameter="BuildCsprojList" ItemName="BuildCsprojList" />
<Output TaskParameter="TestCsprojList" ItemName="TestCsprojList" />
<Output TaskParameter="SubTasks" PropertyName="SubTasks" />
Expand Down Expand Up @@ -341,4 +335,4 @@ $(RepoArtifacts)$(Configuration)/**/Microsoft.Azure.PowerShell.Authenticators.dl
<SetEnvVar EnvName="SignedMsiDir" EnvValue="$(SignedOutputRootDir)" />
</Target>

</Project>
</Project>
Loading
Loading