Skip to content

Commit

Permalink
Use Common Matrix Generation (#38324)
Browse files Browse the repository at this point in the history
* convert python to using common matrix generation present in eng/common generate-matrix yml
  • Loading branch information
scbedd authored Nov 19, 2024
1 parent cd22b6e commit 67aa17f
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 95 deletions.
34 changes: 20 additions & 14 deletions eng/pipelines/templates/jobs/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -244,20 +244,26 @@ jobs:
MatrixConfigs: ${{ parameters.MatrixConfigs }}
MatrixFilters: ${{ parameters.MatrixFilters }}
MatrixReplace: ${{ parameters.MatrixReplace }}
PreGenerationSteps:

- template: /eng/pipelines/templates/steps/download-package-artifacts.yml

- task: Powershell@2
inputs:
pwsh: true
filePath: eng/scripts/distribute-packages-to-matrix.ps1
arguments: >-
-PackageInfoFolder "$(Build.ArtifactStagingDirectory)/PackageInfo"
-PlatformMatrix "${{ parameters.MatrixConfigs[0].Path }}"
displayName: 'Distribute Packages to Matrix'
condition: and(eq(variables['Build.Reason'], 'PullRequest'), eq('${{ parameters.ServiceDirectory }}','auto'))

${{ if eq(parameters.ServiceDirectory, 'auto') }}:
SparseCheckoutPaths:
- "**/setup.py"
- "**/pyproject.toml"
- "tools/"
- "**/ci*.yml"
- "**/_version.py"
- "**/version.py"
- "**/README.md"
- "**/CHANGELOG.md"
- "**/*matrix*.json"
EnablePRGeneration: true
PRMatrixSetting: "TargetingString"
PreGenerationSteps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.12'
- template: /eng/common/pipelines/templates/steps/save-package-properties.yml
parameters:
ServiceDirectory: ${{parameters.ServiceDirectory}}
CloudConfig:
Cloud: Public
AdditionalParameters:
Expand Down
66 changes: 3 additions & 63 deletions eng/pipelines/templates/steps/build-package-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,57 +59,9 @@ steps:
parameters:
ServiceDirectory: ${{ parameters.ServiceDirectory }}

# now we need to call Save-Package-Properties so that we can filter on it
- ${{ if and(eq(variables['Build.Reason'], 'PullRequest'), eq(parameters.ServiceDirectory, 'auto')) }}:
- pwsh: |
mkdir -p $(Build.ArtifactStagingDirectory)/diff
displayName: Create PR Diff Folder
- pwsh: |
$location = Join-Path "$(Build.ArtifactStagingDirectory)" "diff"
Write-Host "./eng/common/scripts/Generate-PR-Diff.ps1 -TargetPath `"$(Build.SourcesDirectory)`" -ArtifactPath `"$location`""
./eng/common/scripts/Generate-PR-Diff.ps1 -TargetPath "$(Build.SourcesDirectory)" -ArtifactPath "$location"
displayName: Generate PR Diff
- pwsh: |
Write-Host "We freshly generated the PR diff, and this is what it sees!"
Get-ChildItem -R -Force $(Build.ArtifactStagingDirectory)/diff | % { $_.FullName }
cat $(Build.ArtifactStagingDirectory)/diff/diff.json
displayName: Dump PR Diff
- task: Powershell@2
inputs:
filePath: $(Build.SourcesDirectory)/eng/common/scripts/Save-Package-Properties.ps1
arguments: >
-PrDiff $(Build.ArtifactStagingDirectory)/diff/diff.json
-OutDirectory $(Build.ArtifactStagingDirectory)/PackageInfo
pwsh: true
workingDirectory: $(Pipeline.Workspace)
displayName: Save package properties filtered for PR

- ${{ else }}:
- task: Powershell@2
condition: and(succeeded(), eq(variables['SetDevVersion'],'true'))
inputs:
filePath: $(Build.SourcesDirectory)/eng/common/scripts/Save-Package-Properties.ps1
arguments: >
-ServiceDirectory ${{parameters.ServiceDirectory}}
-OutDirectory $(Build.ArtifactStagingDirectory)/PackageInfo
-AddDevVersion
pwsh: true
workingDirectory: $(Pipeline.Workspace)
displayName: Save package properties with dev version
- task: Powershell@2
condition: and(succeeded(), ne(variables['SetDevVersion'],'true'))
inputs:
filePath: $(Build.SourcesDirectory)/eng/common/scripts/Save-Package-Properties.ps1
arguments: >
-ServiceDirectory ${{parameters.ServiceDirectory}}
-OutDirectory $(Build.ArtifactStagingDirectory)/PackageInfo
pwsh: true
workingDirectory: $(Pipeline.Workspace)
displayName: Save package properties for service
- template: /eng/common/pipelines/templates/steps/save-package-properties.yml
parameters:
ServiceDirectory: ${{ parameters.ServiceDirectory }}

- template: /eng/pipelines/templates/steps/resolve-package-targeting.yml
parameters:
Expand All @@ -136,18 +88,6 @@ steps:
displayName: 'Prep Environment'
condition: and(succeeded(), or(eq(variables['ENABLE_EXTENSION_BUILD'], 'true'), eq('${{ parameters.ArtifactSuffix }}', 'linux')))
- task: Powershell@2
inputs:
filePath: $(Build.SourcesDirectory)/eng/common/scripts/Save-Package-Properties.ps1
arguments: >
-ServiceDirectory ${{parameters.ServiceDirectory}}
-OutDirectory $(Build.ArtifactStagingDirectory)/PackageInfo
-AddDevVersion
pwsh: true
workingDirectory: $(Pipeline.Workspace)
displayName: Update package properties with dev version
condition: and(succeeded(), eq(variables['SetDevVersion'],'true'), or(eq(variables['ENABLE_EXTENSION_BUILD'], 'true'), eq('${{ parameters.ArtifactSuffix }}', 'linux')))

- script: |
sudo apt-get update
sudo apt-get install -y qemu-user-static
Expand Down
6 changes: 0 additions & 6 deletions sdk/attestation/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@ extends:
parameters:
ServiceDirectory: attestation
TestProxy: true
# Override the base matrix due to https://github.com/Azure/azure-sdk-for-python/issues/17837
MatrixConfigs:
- Name: attestation_ci_matrix
Path: eng/pipelines/templates/stages/platform-matrix.json
Selection: sparse
GenerateVMJobs: true
Artifacts:
- name: azure-mgmt-attestation
safeName: azuremgmtattestation
Expand Down
7 changes: 2 additions & 5 deletions sdk/evaluation/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,8 @@ extends:
TestProxy: true
# This custom matrix config should be dropped once:
# * Once azure-ai-ml supports 3.13 (currently crashes due to type annotation)
MatrixConfigs:
- Name: evaluation_ci_matrix
Path: eng/pipelines/templates/stages/platform-matrix-no-313.json
Selection: sparse
GenerateVMJobs: true
MatrixFilters:
- PythonVersion=^(?!3\.13)
Artifacts:
- name: azure-ai-evaluation
safeName: azureaievaluation
2 changes: 1 addition & 1 deletion sdk/identity/azure-identity/LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.
6 changes: 0 additions & 6 deletions sdk/keyvault/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,6 @@ extends:
parameters:
ServiceDirectory: keyvault
TestProxy: true
# Override the base matrix due to https://github.com/Azure/azure-sdk-for-python/issues/17837
MatrixConfigs:
- Name: keyvault_ci_matrix
Path: eng/pipelines/templates/stages/platform-matrix.json
Selection: sparse
GenerateVMJobs: true
Artifacts:
- name: azure-keyvault-administration
safename: azurekeyvaultadministration
Expand Down

0 comments on commit 67aa17f

Please sign in to comment.