Debian Codegraph @

sample_yaml_builds/linux/consumption/python-consumption.yml

raw
1 # Configure the details of the functionapp
2 variables:
3 azureSubscription: '{ARM ACCESS TOKEN NAME}'
4 storageName: '{STORAGE NAME OF FUNCTIONAPP}'
5 functionappName: '{NAME OF FUNCTIONAPP}'
6 resourceGroupName: '{RESOURCE GROUP NAME OF FUNCTIONAPP}'
7
8 jobs:
9 # Build the python packages in a virtual env
10 - job: Build
11 pool:
12 vmImage: ubuntu-16.04
13 steps:
14 - task: UsePythonVersion@0
15 displayName: "Setting python version to 3.6 as required by functions"
16 inputs:
17 versionSpec: '3.6'
18 architecture: 'x64'
19 - script: |
20 dotnet restore # COMMENT OUT IF NOT USING FUNCTION EXTENSIONS
21 dotnet build --runtime ubuntu.16.04-x64 --output './bin/' # COMMENT OUT IF NOT USING FUNCTION EXTENSIONS
22 python3.6 -m venv worker_venv
23 source worker_venv/bin/activate
24 pip3.6 install setuptools
25 pip3.6 install -r requirements.txt
26 - task: ArchiveFiles@2
27 displayName: "Archive files"
28 inputs:
29 rootFolderOrFile: "$(System.DefaultWorkingDirectory)"
30 includeRootFolder: false
31 archiveFile: "$(System.DefaultWorkingDirectory)/build$(Build.BuildId).zip"
32 - task: PublishBuildArtifacts@1
33 inputs:
34 PathtoPublish: '$(System.DefaultWorkingDirectory)/build$(Build.BuildId).zip'
35 name: 'drop'
36 # Download the build artifacts from
37 - job: Deploy
38 pool:
39 vmImage: 'VS2017-Win2016'
40 steps:
41 - task: DownloadBuildArtifacts@0
42 inputs:
43 buildType: 'current'
44 downloadType: 'single'
45 artifactName: 'drop'
46 downloadPath: '$(System.DefaultWorkingDirectory)'
47 - task: AzureFileCopy@2
48 inputs:
49 sourcePath: "drop/build$(Build.BuildId).zip"
50 azureConnectionType: 'ConnectedServiceNameARM'
51 azureSubscription: "$(azureSubscription)"
52 destination: azureBlob
53 storage: "$(storageName)"
54 containerName: 'azure-build'
55 - task: createsastoken@1
56 inputs:
57 ConnectedServiceName: "$(azureSubscription)"
58 StorageAccountRM: "$(storageName)"
59 SasTokenTimeOutInHours: 10000
60 Permission: 'r'
61 StorageContainerName: 'azure-build'
62 - task: AzureAppServiceSetAppSettings@2
63 inputs:
64 ConnectedServiceName: "$(azureSubscription)"
65 WebAppName: "$(functionappName)"
66 ResourceGroupName: "$(resourceGroupName)"
67 AppSettings: "WEBSITE_RUN_FROM_PACKAGE='$(storageUri)/build$(Build.BuildId).zip$(storageToken)'"
68
69 dependsOn: Build
70 condition: succeeded()