File: PythonSdkLiveTest.yml

package info (click to toggle)
python-azure 20230112%2Bgit-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 749,544 kB
  • sloc: python: 6,815,827; javascript: 287; makefile: 195; xml: 109; sh: 105
file content (97 lines) | stat: -rw-r--r-- 2,974 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
96
97
# Live Test For Python SDK

name: $(BASE_BRANCH)

trigger:
  branches:
    exclude:
    - '*'

# avoid being triggered as part of CI check
pr:
  branches:
    exclude:
    - '*'


variables:
  - group: Release Secrets for GitHub
  - group: Azure SDK Auto Release Pipeline Secrets

jobs:
- job: LiveTestPython38
  displayName: Live Test Python 3.8
  timeoutInMinutes: 1500
  strategy:
    maxParallel: 5
  pool:
    vmImage: 'ubuntu-20.04'
  steps:
    - task: UsePythonVersion@0
      inputs:
        versionSpec: '3.8'
        addToPath: true
        architecture: 'x64'
    - bash: |
        script_path=$(pwd)/scripts/auto_release
        cd ..
        git config --global user.email "PythonSdkPipelines"
        git config --global user.name "PythonSdkPipelines"

        # clone(REPO: https://github.com/Azure/azure-sdk-for-python.git, USR_NAME: Azure, USR_TOKEN: xxxxxxxxxxxxx)
        mkdir azure-sdk-for-python
        git clone ${REPO:0:8}$(USR_NAME):$(azuresdk-github-pat)@${REPO:8} $(pwd)/azure-sdk-for-python

        # prepare env if need to generate SDK code
        if [ "$(SPEC_README)" ]; then
          mkdir azure-rest-api-specs
          git clone https://github.com/Azure/azure-rest-api-specs.git $(pwd)/azure-rest-api-specs

          if [ "$(REST_REPO_HASH)" ]; then
            cd azure-rest-api-specs
            git reset --hard $(REST_REPO_HASH)
            cd ../
          fi

          # install autorest
          sudo npm install -g n
          sudo n 16.15.0
          export PATH=/usr/local/n/versions/node/16.15.0/bin:$PATH
          sudo npm init -f
          sudo npm install -g autorest --save

          mkdir temp_folder

          export SPEC_README=$(SPEC_README)
          export SPEC_REPO=$(pwd)/azure-rest-api-specs
          export TEMP_FOLDER=$(pwd)/temp_folder
          export DEBUG_REST_BRANCH=$(DEBUG_REST_BRANCH)
        fi

        # create virtual env
        python -m venv venv-sdk
        source venv-sdk/bin/activate
        pip install -r $script_path/requirement.txt

        # import env variable
        export AZURE_TEST_RUN_LIVE=$(AZURE_TEST_RUN_LIVE)
        export TENANT_ID=$(ENV-TENANT-ID)
        export CLIENT_ID=$(ENV-CLIENT-ID)
        export CLIENT_SECRET=$(ENV-CLIENT-SECRET)
        export SUBSCRIPTION_ID=$(ENV-SUBSCRIPTION-ID)
        export AZURE_TENANT_ID=$(ENV-TENANT-ID)
        export AZURE_CLIENT_ID=$(ENV-CLIENT-ID)
        export AZURE_CLIENT_SECRET=$(ENV-CLIENT-SECRET)
        export AZURE_SUBSCRIPTION_ID=$(ENV-SUBSCRIPTION-ID)
        export ISSUE_LINK=$(ISSUE_LINK)
        export BASE_BRANCH=$(BASE_BRANCH)
        export SCRIPT_PATH=$script_path
        export AZURESDK_BOT_TOKEN=$(azuresdk-github-pat)
        export STORAGE_CONN_STR=$(storage-conn-str)
        export STORAGE_ENDPOINT=$(storage-endpoint)
        export PYTHON_TAG=$(PYTHON_TAG)
        export DEBUG_SDK_BRANCH=$(DEBUG_SDK_BRANCH)

        # run
        cd azure-sdk-for-python
        python $script_path/main.py