From 99b2eb269592f7b2e443d722a396b75dce4a45e4 Mon Sep 17 00:00:00 2001 From: Tania Allard Date: Mon, 19 Aug 2019 18:20:10 -0400 Subject: [PATCH 1/2] Set up CI with Azure Pipelines Demo pipelines con Python [skip ci] --- azure-pipelines.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 azure-pipelines.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 000000000..aa912913d --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,19 @@ +# Starter pipeline +# Start with a minimal pipeline that you can customize to build and deploy your code. +# Add steps that build, run tests, deploy, and more: +# https://aka.ms/yaml + +trigger: +- master + +pool: + vmImage: 'ubuntu-latest' + +steps: +- script: echo Hello, world! + displayName: 'Run a one-line script' + +- script: | + echo Add other tasks to build, test, and deploy your project. + echo See https://aka.ms/yaml + displayName: 'Run a multi-line script' From 8f6194bc131275fb7c36fb4883c5250047cb1de2 Mon Sep 17 00:00:00 2001 From: Tania Allard Date: Mon, 19 Aug 2019 18:26:43 -0400 Subject: [PATCH 2/2] Update azure-pipelines.yml for Azure Pipelines Modify for Python app --- azure-pipelines.yml | 48 ++++++++++++++++++++++++++++++++++++--------- 1 file changed, 39 insertions(+), 9 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index aa912913d..68b0f3fb2 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,7 +1,6 @@ -# Starter pipeline -# Start with a minimal pipeline that you can customize to build and deploy your code. -# Add steps that build, run tests, deploy, and more: -# https://aka.ms/yaml +variables: + ConnectedServiceName: 'Azure Primary' + WebAppName: 'taniawebsite-flaskpipelines' trigger: - master @@ -10,10 +9,41 @@ pool: vmImage: 'ubuntu-latest' steps: -- script: echo Hello, world! - displayName: 'Run a one-line script' +- task: UsePythonVersion@0 + inputs: + versionSpec: '3.6' + architecture: 'x64' - script: | - echo Add other tasks to build, test, and deploy your project. - echo See https://aka.ms/yaml - displayName: 'Run a multi-line script' + # venv3.6 is the virtual environment name that App Service expects with + # Python 3.6; use "venv" for Python 3.7. + python3.6 -m venv antenv3.6 + source antenv3.6/bin/activate + pip3.6 install setuptools + pip3.6 install -r requirements.txt + + # The displayName is shown in the pipeline UI when a build runs + displayName: 'Install Dependencies' + +- task: ArchiveFiles@2 + inputs: + rootFolderOrFile: '$(Build.SourcesDirectory)' + includeRootFolder: false + archiveType: 'zip' + archiveFile: '$(Build.ArtifactStagingDirectory)/Application$(Build.BuildId).zip' + replaceExistingArchive: true + verbose: #optional + +- task: AzureRMWebAppDeployment@4 + displayName: Azure App Service Deploy + inputs: + appType: webAppLinux + RuntimeStack: 'PYTHON|3.6' + ConnectedServiceName: $(ConnectedServiceName) + WebAppName: $(WebAppName) + Package: '$(Build.ArtifactStagingDirectory)/Application$(Build.BuildId).zip' + + # The following parameter is specific to the Flask example code. You may + # or may not need a startup command for your own app. + + StartupCommand: 'gunicorn --bind=0.0.0.0 --workers=4 startup:app'