Created
July 20, 2020 07:39
-
-
Save georghildebrand/8b32083f2e51dbbeb23b80a2fd003009 to your computer and use it in GitHub Desktop.
Azure Function App Using Build.SourceDirectory as working Dir to avoid losing python path
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| trigger: | |
| - master | |
| variables: | |
| # Azure Resource Manager connection created during pipeline creation | |
| azureSubscription: 'conn' | |
| # Function app name | |
| functionAppName: 'functestnewtry' | |
| # Agent VM image name | |
| vmImageName: 'ubuntu-latest' | |
| # Working Directory | |
| workingDirectory: '$(Build.SourcesDirectory)' | |
| stages: | |
| - stage: Build | |
| displayName: Build stage | |
| jobs: | |
| - job: Build | |
| displayName: Build | |
| pool: | |
| vmImage: $(vmImageName) | |
| steps: | |
| - bash: | | |
| if [ -f extensions.csproj ] | |
| then | |
| dotnet build extensions.csproj --runtime ubuntu.16.04-x64 --output ./bin | |
| fi | |
| workingDirectory: $(workingDirectory) | |
| displayName: 'Build extensions' | |
| - task: UsePythonVersion@0 | |
| displayName: 'Use Python 3.6' | |
| inputs: | |
| versionSpec: 3.6 | |
| - bash: | | |
| python -m venv worker_venv | |
| source worker_venv/bin/activate | |
| pip install -r requirements.txt | |
| workingDirectory: $(workingDirectory) | |
| displayName: 'Install application dependencies' | |
| - task: ArchiveFiles@2 | |
| displayName: 'Archive files' | |
| inputs: | |
| rootFolderOrFile: '$(workingDirectory)' | |
| includeRootFolder: false | |
| archiveType: zip | |
| archiveFile: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip | |
| replaceExistingArchive: true | |
| - publish: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip | |
| artifact: drop | |
| - stage: Deploy | |
| displayName: Deploy stage | |
| dependsOn: Build | |
| condition: succeeded() | |
| jobs: | |
| - deployment: Deploy | |
| displayName: Deploy | |
| environment: 'development' | |
| pool: | |
| vmImage: $(vmImageName) | |
| strategy: | |
| runOnce: | |
| deploy: | |
| steps: | |
| - task: AzureFunctionApp@1 | |
| displayName: 'Azure functions app deploy' | |
| inputs: | |
| azureSubscription: '$(azureSubscription)' | |
| appType: functionAppLinux | |
| appName: $(functionAppName) | |
| package: '$(Pipeline.Workspace)/drop/$(Build.BuildId).zip' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment