File size: 2,980 Bytes
065fee7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Live Test For Python SDK

name: AUTO RELEASE

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'
  variables:
    Codeql.Enabled: false
  steps:
    - task: UsePythonVersion@0
      inputs:
        versionSpec: '3.8'
        addToPath: true
        architecture: 'x64'
    - bash: |
        python scripts/dev_setup.py -p azure-core
        cd ..
        git config --global user.email "PythonSdkPipelines"
        git config --global user.name "$(USR_NAME)"

        # 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
    - template: /eng/common/testproxy/test-proxy-tool.yml
      parameters:
        rootFolder: ../azure-sdk-for-python
    - bash: |
        script_path=$(pwd)/scripts/auto_release
        cd ..

        # 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 init -f
          sudo npm install -g autorest --save
          sudo npm install -g @azure-tools/typespec-client-generator-cli

          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
        python -m 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 SUBSCRIPTION_ID=$(ENV-SUBSCRIPTION-ID)
        export AZURE_TENANT_ID=$(ENV-TENANT-ID)
        export AZURE_SUBSCRIPTION_ID=$(ENV-SUBSCRIPTION-ID)
        export ISSUE_LINK=$(ISSUE_LINK)
        export SCRIPT_PATH=$script_path
        export BOT_TOKEN=$(azuresdk-github-pat)
        export GIT_TOKEN=$(Yuchao-GitToken)
        export PYTHON_TAG=$(PYTHON_TAG)
        export DEBUG_SDK_BRANCH=$(DEBUG_SDK_BRANCH)
        export TARGET_DATE=$(TARGET_DATE)
        export TEST_FOLDER=$(TEST_FOLDER)
        export ISSUE_OWNER=$(ISSUE_OWNER)

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