Ann Arbor : devops and microservices - Эдуард Кабринский
Posted: 11 May 2021, 05:54
Эдуард Кабринский - Python azure devops - Eduard Kabrinskiy
<h1>Python azure devops</h1>
<p>[youtube]</p>
Python azure devops <a href="http://remmont.com">New new new</a> Python azure devops
<h1>Python azure devops</h1>
<p>Deploying a CD pipeline for a Django-based Python app <br /></p>
<h2>Overview</h2>
<p><strong>Python</strong> is a server-side scripting language and a powerful tool for making dynamic and interactive web pages.</p>
<p>This lab shows how to deploy a <strong>Python</strong> application to <strong>Azure App Service</strong> using <strong>Azure DevOps</strong>. We will be using Django framework for deployment.</p>
<h3>Prerequisites for the lab</h3>
<p>Refer the Getting Started page to know the prerequisites for this lab.</p>
<p>Click the Azure DevOps Demo Generator link and follow the instructions in Getting Started page to provision the project to your <strong>Azure DevOps</strong>.</p>
<h2>Exercise 1: Examine the source code</h2>
<p>In this lab, you will use a simple <strong>Python</strong> web application built using <strong>Django</strong> framework. <strong>Django</strong> is a high-level Python Web framework that encourages rapid development and clean, pragmatic design. In this exercise, you will examine the source code provisioned by Azure DevOps Demo Generator.</p>
<p>Navigate to the project you created above using Azure DevOps Demo Generator.</p>
<p>Select <strong>Repos</strong>. In this repository you have</p>
<p><ul>
<li><strong>Application</strong> folder which has a web application developed using Python and Django</li>
<li><strong>unit_tests</strong> folder has few unit test cases which can be executed as part of your CI pipeline </ul></p>
<p><strong>functional_test</strong> folder which has a Selenium test case which can be executed as part of the CD pipeline after the application deployed.</p>
<p style="clear: both"><img src="https://www.azuredevopslabs.com/labs/vs ... cecode.png" /></p>
<p>In the following exercises, we will Build this application using Azure DevOps CI pipeline and Deploy the application to Azure App service using Azure DevOps CD pipeline.</p>
<h2>Exercise 2: Examine the CI pipeline</h2>
<p><strong>Python</strong> is an interpreted language, and hence compilation is not required. In this exercise, we will run unit tests and we will archive the application files to use in the release for deployment.</p>
<p>Navigate to <strong>Pipelines –> Builds</strong>. Select <strong>Python-CI</strong> and click <strong>Edit</strong>.</p>
<p style="clear: both"><img src="https://www.azuredevopslabs.com/labs/vs ... i-edit.png" /></p>
<p>Your build pipeline will look like as below. This pipeline has tasks to install dependencies of application, run unit tests, archive& publish the application into a zip file (package) which can be deployed to a web application.</p>
<p style="clear: both"><img src="https://www.azuredevopslabs.com/labs/vs ... peline.png" /></p>
<p>Select <strong>Use Python Version</strong> task. This task is used in a build or release pipeline to select a version of Python to run on an agent, and optionally add it to PATH.</p>
<p style="clear: both"><img src="https://www.azuredevopslabs.com/labs/vs ... ersion.png" /></p>
<p>Select <strong>Install dependencies</strong> task. In this task, we are using Command Line task to install dependencies of the application like Django framework version etc..</p>
<p style="clear: both"><img src="https://www.azuredevopslabs.com/labs/vs ... encies.png" /></p>
<p>Select <strong>pytest</strong> task. In this task also we are using Command Line task to run <strong>Unit tests</strong> using <strong>pytest</strong> and publish the test results to <strong>test-results.xml</strong> file.</p>
<p style="clear: both"><img src="https://www.azuredevopslabs.com/labs/vs ... pytest.png" /></p>
<p>Select <strong>Publish Test Results</strong>. Using this task we will publish the test results form the previous task to Azure Pipelines. The published test results will be displayed in the <strong>Tests</strong> tab in a build or release summary.</p>
<p style="clear: both"><img src="https://www.azuredevopslabs.com/labs/vs ... esults.png" /></p>
<p>Select <strong>Archive application</strong> task. Using Archive files task we are creating a <strong>zip</strong> (package) file from the application folder to use in the release pipeline.</p>
<p style="clear: both"><img src="https://www.azuredevopslabs.com/labs/vs ... cation.png" /></p>
<p>Select <strong>Archive Tests</strong> task. We have few Selenium functional tests which need to be executed after the deployment in the release pipeline. Using Archive files task we are creating a <strong>zip</strong> (package) file from Tests folder to use in the release pipeline.</p>
<p style="clear: both"><img src="https://www.azuredevopslabs.com/labs/vs ... -tests.png" /></p>
<p>Select <strong>Publish Artifacts</strong> task. This task is used to publish build artifacts (Application and Tests packages from previous tasks) to Azure Pipelines.</p>
<p style="clear: both"><img src="https://www.azuredevopslabs.com/labs/vs ... tifact.png" /></p>
<p>Select <strong>Triggers</strong> and <strong>Enable continuous integration</strong> trigger. A continuous integration trigger on a build pipeline indicates that the system should automatically queue a new build whenever a code change is committed. <strong>Save</strong> changes.</p>
<p style="clear: both"><img src="https://www.azuredevopslabs.com/labs/vs ... ble-ci.png" /></p>
<h2>Exercise 3: Configure Release pipeline</h2>
<p>In this exercise, you will configure release (CD) pipeline to create Azure resources using Azure CLI as part of your deployment and deploy the Python application to the App service provisioned.</p>
<p>Go to <strong>Releases</strong> under <strong>Pipelines</strong> tab, select release definition <strong>Python-CD</strong> and click <strong>Edit</strong> pipeline.</p>
<p style="clear: both"><img src="https://www.azuredevopslabs.com/labs/vs ... d-edit.png" /></p>
<p>Select <strong>Dev</strong> stage and click <strong>View stage tasks</strong> to view the pipeline tasks.</p>
<p style="clear: both"><img src="https://www.azuredevopslabs.com/labs/vs ... -tasks.png" /></p>
<p>You will see the tasks as below.</p>
<p style="clear: both"><img src="https://www.azuredevopslabs.com/labs/vs ... -tasks.png" /></p>
<p>Select the <strong>Azure CLI</strong> task. Select the Azure subscription from the drop-down list and click <strong>Authorize</strong> to configure Azure service connection.</p>
<p style="clear: both"><img src="https://www.azuredevopslabs.com/labs/vs ... re-cli.png" /></p>
<p>In this task we are using Azure CLI commands to create Azure Resources required to deploy Python web application.</p>
<p>If you observe the commands you will see few variables like <strong>$(Location), $(ResourceGroup)</strong> etc.. These are the required values to deploy resources and the values are defined in <strong>Variables</strong> section. If required you can modify this variable values as desired.</p>
<p style="clear: both"><img src="https://www.azuredevopslabs.com/labs/vs ... iables.png" /></p>
<p>Select <strong>Azure App Service Manage</strong> task. Select the service connection for the Azure Subscription where the resources are created above. Using this task we are installing Python Extension for Azure App service created in previous task to support Python web application. Make sure App Service name is set to variable <strong>$(appservice-name)</strong></p>
<p style="clear: both"><img src="https://www.azuredevopslabs.com/labs/vs ... ension.png" /></p>
<p>Select <strong>Azure App Service Deploy</strong> task. Make sure the settings are as shown below. This task is used to deploy Application package to Azure app service which is provisioned above.</p>
<p style="clear: both"><img src="https://www.azuredevopslabs.com/labs/vs ... deploy.png" /></p>
<p>Select <strong>Run Functional Tests</strong> task. Here we are using Command line task to run Selenium tests after the application deployed to the Azure app service. And the test results will be published to release summary using <strong>Publish Test Results</strong> task.</p>
<p style="clear: both"><img src="https://www.azuredevopslabs.com/labs/vs ... ltests.png" /></p>
<p>Let us enable <strong>Continuous deployment trigger</strong>. Select <strong>Pipelines</strong> and click <strong>**Continuous deployment trigger</strong> option. Enable the trigger and <strong>Save</strong> the changes.</p>
<p style="clear: both"><img src="https://www.azuredevopslabs.com/labs/vs ... ble-cd.png" /></p>
<p>Now you have configured a release pipeline to provision required Azure resources, Deploy the web application and Run functional tests.</p>
<h2>Exercise 4: Trigger Build and Release pipeline with a code change</h2>
<p>In the previous exercises, we have configured build and release pipelines and enabled CI-CD. Let us update the code to trigger CI-CD.</p>
<p>Go to <strong>Repos</strong> tab and navigate to the below path to edit the file.</p>
<p style="clear: both"><img src="https://www.azuredevopslabs.com/labs/vs ... t-code.png" /></p>
<p>Click on <strong>Edit</strong> and go to line number 32, modify <strong>Continuous Delivery</strong> to <strong>Continuous Delivery for Python</strong> and <strong>Commit</strong> the code.</p>
<p style="clear: both"><img src="https://www.azuredevopslabs.com/labs/vs ... t_code.png" /></p>
<p>Since we have enabled CI-CD triggers a build will be queued automatically. Go to <strong>Builds</strong>, under <strong>Pipelines</strong> tab to see the build in progress.</p>
<p style="clear: both"><img src="https://www.azuredevopslabs.com/labs/vs ... ogress.gif" /></p>
<p>You would be able to see the test results under <strong>Tests</strong> tab in build summary. Once the build is complete, it triggers the CD pipeline. You can notice the linked release is in progress by navigating to Releases under Pipelines. The release will provision the Azure Web app and deploy the zip file generated by the associated build.</p>
<p>Now go to <strong>Releases</strong>, under <strong>Pipelines</strong> tab to see the release in progress.</p>
<p style="clear: both"><img src="https://www.azuredevopslabs.com/labs/vs ... ogress.gif" /></p>
<p>Once the Release succeeds, login to Azure Portal and go to the <strong>Resource Group</strong> with the name <strong>Python</strong>. You will see the resources <strong>App Service</strong> and <strong>App Service Plan</strong>. Select the <strong>App Service</strong> and from the Overview tab, click on <strong>Browse</strong> to see the application deployed.</p>
<p style="clear: both"><img src="https://www.azuredevopslabs.com/labs/vs ... output.gif" /></p>
<h2>Summary</h2>
<p>This lab shows how to create a continuous integration(CI) and continuous deployment (CD) pipeline for Python code with Azure DevOps on Azure.</p>
<h2>Python azure devops</h2>
<h3>Python azure devops</h3>
<p>[youtube]</p>
Python azure devops <a href="http://remmont.com">Current breaking news</a> Python azure devops
<h4>Python azure devops</h4>
Python azure devops Deploying a CD pipeline for a Django-based Python app Overview Python is a server-side scripting language and a powerful tool for making dynamic and interactive web
<h5>Python azure devops</h5>
Python azure devops <a href="http://remmont.com">Python azure devops</a> Python azure devops
SOURCE: <h6>Python azure devops</h6> <a href="https://dev-ops.engineer/">Python azure devops</a> Python azure devops
#tags#[replace: -,-Python azure devops] Python azure devops#tags#
Kabrinskiy Eduard
headline news
<h1>Python azure devops</h1>
<p>[youtube]</p>
Python azure devops <a href="http://remmont.com">New new new</a> Python azure devops
<h1>Python azure devops</h1>
<p>Deploying a CD pipeline for a Django-based Python app <br /></p>
<h2>Overview</h2>
<p><strong>Python</strong> is a server-side scripting language and a powerful tool for making dynamic and interactive web pages.</p>
<p>This lab shows how to deploy a <strong>Python</strong> application to <strong>Azure App Service</strong> using <strong>Azure DevOps</strong>. We will be using Django framework for deployment.</p>
<h3>Prerequisites for the lab</h3>
<p>Refer the Getting Started page to know the prerequisites for this lab.</p>
<p>Click the Azure DevOps Demo Generator link and follow the instructions in Getting Started page to provision the project to your <strong>Azure DevOps</strong>.</p>
<h2>Exercise 1: Examine the source code</h2>
<p>In this lab, you will use a simple <strong>Python</strong> web application built using <strong>Django</strong> framework. <strong>Django</strong> is a high-level Python Web framework that encourages rapid development and clean, pragmatic design. In this exercise, you will examine the source code provisioned by Azure DevOps Demo Generator.</p>
<p>Navigate to the project you created above using Azure DevOps Demo Generator.</p>
<p>Select <strong>Repos</strong>. In this repository you have</p>
<p><ul>
<li><strong>Application</strong> folder which has a web application developed using Python and Django</li>
<li><strong>unit_tests</strong> folder has few unit test cases which can be executed as part of your CI pipeline </ul></p>
<p><strong>functional_test</strong> folder which has a Selenium test case which can be executed as part of the CD pipeline after the application deployed.</p>
<p style="clear: both"><img src="https://www.azuredevopslabs.com/labs/vs ... cecode.png" /></p>
<p>In the following exercises, we will Build this application using Azure DevOps CI pipeline and Deploy the application to Azure App service using Azure DevOps CD pipeline.</p>
<h2>Exercise 2: Examine the CI pipeline</h2>
<p><strong>Python</strong> is an interpreted language, and hence compilation is not required. In this exercise, we will run unit tests and we will archive the application files to use in the release for deployment.</p>
<p>Navigate to <strong>Pipelines –> Builds</strong>. Select <strong>Python-CI</strong> and click <strong>Edit</strong>.</p>
<p style="clear: both"><img src="https://www.azuredevopslabs.com/labs/vs ... i-edit.png" /></p>
<p>Your build pipeline will look like as below. This pipeline has tasks to install dependencies of application, run unit tests, archive& publish the application into a zip file (package) which can be deployed to a web application.</p>
<p style="clear: both"><img src="https://www.azuredevopslabs.com/labs/vs ... peline.png" /></p>
<p>Select <strong>Use Python Version</strong> task. This task is used in a build or release pipeline to select a version of Python to run on an agent, and optionally add it to PATH.</p>
<p style="clear: both"><img src="https://www.azuredevopslabs.com/labs/vs ... ersion.png" /></p>
<p>Select <strong>Install dependencies</strong> task. In this task, we are using Command Line task to install dependencies of the application like Django framework version etc..</p>
<p style="clear: both"><img src="https://www.azuredevopslabs.com/labs/vs ... encies.png" /></p>
<p>Select <strong>pytest</strong> task. In this task also we are using Command Line task to run <strong>Unit tests</strong> using <strong>pytest</strong> and publish the test results to <strong>test-results.xml</strong> file.</p>
<p style="clear: both"><img src="https://www.azuredevopslabs.com/labs/vs ... pytest.png" /></p>
<p>Select <strong>Publish Test Results</strong>. Using this task we will publish the test results form the previous task to Azure Pipelines. The published test results will be displayed in the <strong>Tests</strong> tab in a build or release summary.</p>
<p style="clear: both"><img src="https://www.azuredevopslabs.com/labs/vs ... esults.png" /></p>
<p>Select <strong>Archive application</strong> task. Using Archive files task we are creating a <strong>zip</strong> (package) file from the application folder to use in the release pipeline.</p>
<p style="clear: both"><img src="https://www.azuredevopslabs.com/labs/vs ... cation.png" /></p>
<p>Select <strong>Archive Tests</strong> task. We have few Selenium functional tests which need to be executed after the deployment in the release pipeline. Using Archive files task we are creating a <strong>zip</strong> (package) file from Tests folder to use in the release pipeline.</p>
<p style="clear: both"><img src="https://www.azuredevopslabs.com/labs/vs ... -tests.png" /></p>
<p>Select <strong>Publish Artifacts</strong> task. This task is used to publish build artifacts (Application and Tests packages from previous tasks) to Azure Pipelines.</p>
<p style="clear: both"><img src="https://www.azuredevopslabs.com/labs/vs ... tifact.png" /></p>
<p>Select <strong>Triggers</strong> and <strong>Enable continuous integration</strong> trigger. A continuous integration trigger on a build pipeline indicates that the system should automatically queue a new build whenever a code change is committed. <strong>Save</strong> changes.</p>
<p style="clear: both"><img src="https://www.azuredevopslabs.com/labs/vs ... ble-ci.png" /></p>
<h2>Exercise 3: Configure Release pipeline</h2>
<p>In this exercise, you will configure release (CD) pipeline to create Azure resources using Azure CLI as part of your deployment and deploy the Python application to the App service provisioned.</p>
<p>Go to <strong>Releases</strong> under <strong>Pipelines</strong> tab, select release definition <strong>Python-CD</strong> and click <strong>Edit</strong> pipeline.</p>
<p style="clear: both"><img src="https://www.azuredevopslabs.com/labs/vs ... d-edit.png" /></p>
<p>Select <strong>Dev</strong> stage and click <strong>View stage tasks</strong> to view the pipeline tasks.</p>
<p style="clear: both"><img src="https://www.azuredevopslabs.com/labs/vs ... -tasks.png" /></p>
<p>You will see the tasks as below.</p>
<p style="clear: both"><img src="https://www.azuredevopslabs.com/labs/vs ... -tasks.png" /></p>
<p>Select the <strong>Azure CLI</strong> task. Select the Azure subscription from the drop-down list and click <strong>Authorize</strong> to configure Azure service connection.</p>
<p style="clear: both"><img src="https://www.azuredevopslabs.com/labs/vs ... re-cli.png" /></p>
<p>In this task we are using Azure CLI commands to create Azure Resources required to deploy Python web application.</p>
<p>If you observe the commands you will see few variables like <strong>$(Location), $(ResourceGroup)</strong> etc.. These are the required values to deploy resources and the values are defined in <strong>Variables</strong> section. If required you can modify this variable values as desired.</p>
<p style="clear: both"><img src="https://www.azuredevopslabs.com/labs/vs ... iables.png" /></p>
<p>Select <strong>Azure App Service Manage</strong> task. Select the service connection for the Azure Subscription where the resources are created above. Using this task we are installing Python Extension for Azure App service created in previous task to support Python web application. Make sure App Service name is set to variable <strong>$(appservice-name)</strong></p>
<p style="clear: both"><img src="https://www.azuredevopslabs.com/labs/vs ... ension.png" /></p>
<p>Select <strong>Azure App Service Deploy</strong> task. Make sure the settings are as shown below. This task is used to deploy Application package to Azure app service which is provisioned above.</p>
<p style="clear: both"><img src="https://www.azuredevopslabs.com/labs/vs ... deploy.png" /></p>
<p>Select <strong>Run Functional Tests</strong> task. Here we are using Command line task to run Selenium tests after the application deployed to the Azure app service. And the test results will be published to release summary using <strong>Publish Test Results</strong> task.</p>
<p style="clear: both"><img src="https://www.azuredevopslabs.com/labs/vs ... ltests.png" /></p>
<p>Let us enable <strong>Continuous deployment trigger</strong>. Select <strong>Pipelines</strong> and click <strong>**Continuous deployment trigger</strong> option. Enable the trigger and <strong>Save</strong> the changes.</p>
<p style="clear: both"><img src="https://www.azuredevopslabs.com/labs/vs ... ble-cd.png" /></p>
<p>Now you have configured a release pipeline to provision required Azure resources, Deploy the web application and Run functional tests.</p>
<h2>Exercise 4: Trigger Build and Release pipeline with a code change</h2>
<p>In the previous exercises, we have configured build and release pipelines and enabled CI-CD. Let us update the code to trigger CI-CD.</p>
<p>Go to <strong>Repos</strong> tab and navigate to the below path to edit the file.</p>
<p style="clear: both"><img src="https://www.azuredevopslabs.com/labs/vs ... t-code.png" /></p>
<p>Click on <strong>Edit</strong> and go to line number 32, modify <strong>Continuous Delivery</strong> to <strong>Continuous Delivery for Python</strong> and <strong>Commit</strong> the code.</p>
<p style="clear: both"><img src="https://www.azuredevopslabs.com/labs/vs ... t_code.png" /></p>
<p>Since we have enabled CI-CD triggers a build will be queued automatically. Go to <strong>Builds</strong>, under <strong>Pipelines</strong> tab to see the build in progress.</p>
<p style="clear: both"><img src="https://www.azuredevopslabs.com/labs/vs ... ogress.gif" /></p>
<p>You would be able to see the test results under <strong>Tests</strong> tab in build summary. Once the build is complete, it triggers the CD pipeline. You can notice the linked release is in progress by navigating to Releases under Pipelines. The release will provision the Azure Web app and deploy the zip file generated by the associated build.</p>
<p>Now go to <strong>Releases</strong>, under <strong>Pipelines</strong> tab to see the release in progress.</p>
<p style="clear: both"><img src="https://www.azuredevopslabs.com/labs/vs ... ogress.gif" /></p>
<p>Once the Release succeeds, login to Azure Portal and go to the <strong>Resource Group</strong> with the name <strong>Python</strong>. You will see the resources <strong>App Service</strong> and <strong>App Service Plan</strong>. Select the <strong>App Service</strong> and from the Overview tab, click on <strong>Browse</strong> to see the application deployed.</p>
<p style="clear: both"><img src="https://www.azuredevopslabs.com/labs/vs ... output.gif" /></p>
<h2>Summary</h2>
<p>This lab shows how to create a continuous integration(CI) and continuous deployment (CD) pipeline for Python code with Azure DevOps on Azure.</p>
<h2>Python azure devops</h2>
<h3>Python azure devops</h3>
<p>[youtube]</p>
Python azure devops <a href="http://remmont.com">Current breaking news</a> Python azure devops
<h4>Python azure devops</h4>
Python azure devops Deploying a CD pipeline for a Django-based Python app Overview Python is a server-side scripting language and a powerful tool for making dynamic and interactive web
<h5>Python azure devops</h5>
Python azure devops <a href="http://remmont.com">Python azure devops</a> Python azure devops
SOURCE: <h6>Python azure devops</h6> <a href="https://dev-ops.engineer/">Python azure devops</a> Python azure devops
#tags#[replace: -,-Python azure devops] Python azure devops#tags#
Kabrinskiy Eduard
headline news