File: template.yml

package info (click to toggle)
azure-cli 2.82.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,359,416 kB
  • sloc: python: 1,910,381; sh: 1,343; makefile: 406; cs: 145; javascript: 74; sql: 37; xml: 21
file content (106 lines) | stat: -rw-r--r-- 3,391 bytes parent folder | download | duplicates (3)
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
96
97
98
99
100
101
102
103
104
105
106
# Some content of this file is generated.

trigger:
  branches:
    exclude:
    - '*'

variables:
- template: ${{ variables.Pipeline.Workspace }}/.azure-pipelines/templates/variables.yml

schedules:
- cron: "0 18 * * 5"
  displayName: Weekly Friday test
  branches:
    include:
    - CLITest
  always: true

jobs:
- job: LiveTestPython38
  displayName: Live Test Python 3.8
  timeoutInMinutes: 9999
  strategy:
    maxParallel: 20
    matrix:
    {% for module in modules %}
      {{module}}:
        Target: {{module}}
    {% endfor %}
  pool:
    name: ${{ variables.ubuntu_pool }}
  steps:
    - task: UsePythonVersion@0
      inputs:
        versionSpec: '3.8'
        addToPath: true
        architecture: 'x64'
    - bash: |
        if [[ "$(USER_TARGET)" =~ "$(Target)" || "$(USER_TARGET)" == "" ]]; then
          echo "Match!"
        else
          echo "Not match!"
          exit
        fi
        cd ..
        pwd
        ls
        # ssh-keygen -f ~/.ssh/id_rsa -t rsa -N ''
        git clone -b $(USER_BRANCH) $(USER_REPO)
        #git clone https://github.com/Azure/azure-cli-extensions.git
        python -m venv env
        source env/bin/activate
        pip install azdev
        pip install pytest-json-report
        pip install pytest-html
        azdev setup -c azure-cli
        # az login --service-principal --username $(APP_ID) --password $(PASSWORD) --tenant $(TENANT_ID)
        az login -u azureclitest@azuresdkteam.onmicrosoft.com -p $(AZURECLITESTPASSWORD)
        azdev test $(Target) $(USER_LIVE) --no-exitfirst -a "-n 8 --json-report --json-report-summary --json-report-file=$(Target).report.json --html=$(Target).report.html"
        pwd
        ls
    - task: PublishTestResults@2
      condition: succeededOrFailed()
      inputs:
        testResultsFiles: '/mnt/vss/.azdev/env_config/mnt/vss/_work/1/env/test_results.xml'
        testRunTitle: 'Azure CLI live test results of $(Target)'
        # mergeTestResults: true
        # testResultsFormat: 'JUnit'
    - task: PublishBuildArtifacts@1
      condition: succeededOrFailed()
      inputs:
        PathtoPublish: '/mnt/vss/_work/1/$(Target).report.json'
        ArtifactName: '$(Target).report.json'
        publishLocation: 'Container'
    - task: PublishBuildArtifacts@1
      condition: succeededOrFailed()
      inputs:
        PathtoPublish: '/mnt/vss/_work/1/$(Target).report.html'
        ArtifactName: '$(Target).report.html'
        publishLocation: 'Container'

- job: SendEmail
  displayName: Send email
  dependsOn: LiveTestPython38
  condition: succeededOrFailed()
  pool:
    name: ${{ variables.ubuntu_pool }}
  steps:
    - task: UsePythonVersion@0
      inputs:
        versionSpec: '3.8'
        addToPath: true
        architecture: 'x64'
    - task: DownloadBuildArtifacts@0
      inputs:
        buildType: 'current'
        downloadType: 'specific'
        downloadPath: '$(System.ArtifactsDirectory)'
    - bash: |
        echo $(System.ArtifactsDirectory)
        ls $(System.ArtifactsDirectory)
        pwd
        commit_id=`git ls-remote https://github.com/Azure/azure-cli.git HEAD`
        pip install sendgrid
        # Send notification
        python /mnt/vss/_work/1/s/scripts/live_test/sendemail.py "$(SENDGRID_KEY)" "$(Build.BuildId)" "$(USER_REPO)" "$(USER_BRANCH)" "$(USER_TARGET)" "$(USER_LIVE)" "$(System.ArtifactsDirectory)" "$(Build.RequestedForEmail)"