File: trigger-ml-sample-pipeline.yml

package info (click to toggle)
python-azure 20250603%2Bgit-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 851,724 kB
  • sloc: python: 7,362,925; ansic: 804; javascript: 287; makefile: 195; sh: 145; xml: 109
file content (95 lines) | stat: -rw-r--r-- 3,371 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
parameters:
  - name: ServiceDirectory
    type: string
    default: 'ml'
  - name: Artifacts
    type: object
    default:
    - name: azure-ai-ml
      safeName: azureaiml
      skipVerifyChangeLog: true
  - name: SamplesRepo
    type: string
    default: 'https://github.com/azure/azureml-examples'

jobs:
  - job: 'Build_Upload_PR'
    displayName: "Build, Upload, and PR Azure ML Changeset"
    timeoutInMinutes: 90
    variables:
      - name: StorageAccountName
        value: 'azuresdkartifacts'
      - template: /eng/pipelines/templates/variables/globals.yml

    pool:
      name: azsdk-pool-mms-ubuntu-2004-general
      vmImage: MMSUbuntu20.04

    steps:
    - template: /eng/pipelines/templates/steps/resolve-package-targeting.yml
      parameters:
        BuildTargetingString: "azure-*"

    - script: |
        echo "##vso[build.addbuildtag]Scheduled"
      displayName: 'Tag scheduled builds'
      condition: and(eq(variables['Build.SourceBranchName'], variables['DefaultBranch']), eq(variables['Build.Reason'],'Schedule'))

    - task: UsePythonVersion@0
      displayName: 'Use Python $(PythonVersion)'
      inputs:
        versionSpec: $(PythonVersion)

    - script: |
        python -m pip install tools/azure-sdk-tools[build]
        python -m pip install azure-identity
        python -m pip install azure-storage-blob
      displayName: 'Prep Environment'

    - pwsh: |
        sdk_build -d "$(Build.ArtifactStagingDirectory)" --repo="$(Build.SourcesDirectory)" --service="${{parameters.ServiceDirectory}}" "$(TargetingString)"
      displayName: Generate Packages

    - pwsh: |
        Get-ChildItem "$(Build.ArtifactStagingDirectory)" -R
      displayName: Output Staging Directory

    - pwsh: |
        git clone --depth 1 ${{ parameters.SamplesRepo }} $(Agent.BuildDirectory)/ml
        Write-Host "##vso[task.setvariable variable=mlrepo;]$(Agent.BuildDirectory)/ml"
      displayName: Clone the ML Samples Repo, Set Variables

    - pwsh: |
        Get-ChildItem "$(mlrepo)" -R
      displayName: Output Staging Directory

    - pwsh: |
        cat "$(mlrepo)/sdk/python/setup.sh"
      displayName: Display setup.sh pre-update

    - task: AzurePowerShell@5
      displayName: Generate Samples Repo Changes
      inputs:
        azureSubscription: 'Azure SDK Artifacts'
        azurePowerShellVersion: LatestVersion
        pwsh: true
        ScriptType: InlineScript
        Inline: |
          python scripts/devops_tasks/generate_ml_sample_update.py --ml-repo "$(mlrepo)" --ml-wheel-folder "$(Build.ArtifactStagingDirectory)/azure-ai-ml" --build-id "$(Build.BuildId)" --storage-account-name "$(StorageAccountName)";
          exit $LASTEXITCODE;

    - pwsh: |
        cat "$(mlrepo)/sdk/python/setup.sh"
      displayName: Display setup.sh post-update

    - template: /eng/common/pipelines/templates/steps/create-pull-request.yml
      parameters:
        RepoName: azureml-examples
        RepoOwner: Azure
        PRBranchName: test-ml-sdk-version-${{ parameters.ServiceDirectory }}-$(Build.BuildId)
        PROwner: Azure
        BaseBranchName: main
        CommitMsg: "Update sdk/python/setup.sh to target fresh built azure-ai-ml wheel."
        PRTitle: "SDK Samples Run generated from $(Build.BuildId)"
        WorkingDirectory: $(mlrepo)
        PRBody: "Check azureml samples against azure-sdk build $(Build.BuildId)."