diff --git a/azure-pipelines-1.yml b/azure-pipelines-1.yml new file mode 100644 index 000000000..aa912913d --- /dev/null +++ b/azure-pipelines-1.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' diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 000000000..2013df360 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,63 @@ +variables: + ConnectedServiceName: 'Primary' + WebAppName: 'kraigb-flaskpipelines' + +trigger: +- master + +pool: + name: Hosted Ubuntu 1604 + +steps: +- task: UsePythonVersion@0 + inputs: + versionSpec: '3.6' + architecture: 'x64' + +# Install the virtual environment on the build agent, which is then +# deployed with the app code. + +- script: | + python3.6 -m venv .env + source .env/bin/activate + pip3.6 install setuptools + pip3.6 install -r requirements.txt + + # The displayName is shows in the pipeline UI when a build runs + displayName: 'Install Dependencies' + +- script: | + echo Deleting venv + ls + rm -rf .env + ls + displayName: 'Remove .env before zip' + +- 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' + StartupCommand: 'gunicorn --bind=0.0.0.0 --workers=4 startup:app' + + # Inline post-deployment script + ScriptType: Inline Script + InlineScript: + echo 'Add your inline script steps here' + + # Alternate form: refer to a script in the repository + # ScriptType: File Path + # ScriptPath: 'post-deployment.sh' + diff --git a/post-deployment.sh b/post-deployment.sh new file mode 100644 index 000000000..afde0d931 --- /dev/null +++ b/post-deployment.sh @@ -0,0 +1,4 @@ +python3.6 -m venv antenv +source antenv/bin/activate +pip3.6 install setuptools +pip3.6 install -r requirements.txt