1. Нам важно Ваше мнение!
    и обсуждайте вместе! Нажимайте "мне нравится" и рекомендуйте друзьям ;)
    Понравилось тема? Напишите в ней свой отзыв.
    Считаете что тема не достаточно полно раскрыта? Расскажите свою точку зрения!
    С Вашей помощью сделаем форум еще лучше!

McAllen : gitlab azure devops - Eduard Kabrinskiy

Тема в разделе 'Горячие новости для тех кто следит за собой', создана пользователем NorthLasVegasEn, 11 май 2021.

  1. Kabrinskiy Eduard - Azure devops build variables - Кабринский Рдуард


    <h1>Azure devops build variables</h1>
    <p>[youtube]</p>
    Azure devops build variables <a href="http://remmont.com">World news today live</a> Azure devops build variables
    <h1>Learn to Use Variable Groups in Azure DevOps Pipelines</h1>
    <p style="clear: both"><img src="https://miro.medium.com/fit/c/96/96/0*V-xzNa1FS58Cochq.jpeg" /></p>
    <p>A few months ago, I set up an AWS development environment in one region with Terraform and Chef. I realized I needed to refactor my code to handle multiple regions aka multi-region and AWS accounts. I didn’t want to duplicate code for the various regions and environments. The solution would become a nightmare to maintain and have a horrible code smell. Ew.</p>
    <p>I was new to Azure DevOps for CI/CD pipelines and I wanted to find a way to apply different sets of variables to the same code base, so I poked around and found Variable Groups. ‘This sounds promising!’ I thought and started digging through Microsoft docs to learn more. So here’s the scoop on Variable Groups.</p>
    <p><ul>
    <li>You can share variable groups between pipelines.</li>
    <li>You can “link’“ variable groups to specific stages in a pipeline, build, or release.</li>
    </ul>
    </p>
    <h1>Variable Groups</h1>
    <p>To create a Variable Group, follow the steps below:</p>
    <p><ol>
    <li>In the left panel, click and expand Pipelines</em>.</li>
    <li>Under Pipelines</em>, click Library</em>.</li>
    <li>Click the Variable group</em> button.</li>
    <li>Enter a name for the variable group in the Variable Group Name</em> field.</li>
    <li>Use the Description</em> field to enter information about the variable group.</li>
    <li>Click the Add</em> button to create a new variable for the group.</li>
    <li>Fill in the variable Name</em> and Value</em>.</li>
    </ol>
    </p>
    <p style="clear: both"><img src="https://miro.medium.com/max/60/0*Ill0TNodr-4UMg07.png" /></p>
    <p>An example variable group for AWS us-east-1.</p>
    <p>For this tutorial, we’ll link our Variable Groups to an Azure DevOps Build and Release Pipeline. I’ll show two methods:</p>
    <p><ol>
    <li>As code with azure-pipeline.yml file in the Build Pipeline.</li>
    <li>With the Azure DevOps GUI in the Release Pipeline.</li>
    </ol>
    </p>
    <h1>Build Pipeline</h1>
    <p>Before we can link the variable group to our build we need to set up a repository. The repository can be set up in Azure DevOps or GitHub. For this tutorial, I used Azure DevOps. I’ve also posted the code on GitHub but it’s pretty basic output to demonstrate how the Variable Groups function.</p>
    <p>Lets set up the build with the steps below:</p>
    <p><ol>
    <li>In the left panel, expand Pipelines.</li>
    <li>Click on the New pipeline button.</li>
    <li>Associate the pipeline to a repo in GitHub or Azure DevOps.</li>
    <li>Click Run.</li>
    </ol>
    </p>
    <p>As we can see, our first build succeeds as expected, but none of the variables were echoed during the build.</p>
    <p style="clear: both"><img src="https://miro.medium.com/max/60/0*eRUbdZyMWk3K5StB.png" /></p>
    <p style="clear: both"><img src="https://miro.medium.com/max/60/0*G3mNl-Qyhn2jaaX-.png" /></p>
    <p>Next, lets associate the variable groups the build. Since the build uses the azure-pipelines.yml file , we’ll update the code to use the variable groups. For more information on Azure Pipelines, check out Microsoft’s YAML schema reference.</p>
    <p>In your editor, open up azure-pipelines.yml and add the code snippet below to the beginning of the file.</p>
    <p>Save and commit the file. The build should execute and output the variables stored in the variable group dev_us-west-2 (see below). Now try it with dev_us-east-1.</p>
    <p style="clear: both"><img src="https://miro.medium.com/max/60/0*B_wnpDqMDoXT0VrR.png" /></p>
    <p>Let’s take our variable groups a step further and create two jobs: “Build us-east-1” and “Build us-west-2”</p>
    <p>For this exercise, we’ll match the appropriate variable group to the it’s job. Open up the azure-pipelines.yml file in your favorite editor and replace the text provided in this GitHub branch. Or use the code below.</p>
    <p style="clear: both"><img src="https://miro.medium.com/max/42/0*ZS1jyLIZXEmROxmP.png" /></p>
    <p>After you’ve saved your changes, commit and push the code to run the build. Now you see two separate jobs, one for “build_Virgina” and another for “build_Oregon” each of our regions.</p>
    <p style="clear: both"><img src="https://miro.medium.com/max/60/0*i4E43m-Z6pmCaBSJ.png" /></p>
    <p>Open each job and click on the “Show Variable Values” step. The values echoed for each Variable Group correspond to the assigned job in the code block above. See the images below.</p>
    <p style="clear: both"><img src="https://miro.medium.com/max/60/0*XGG-TMXVyTVa11W7.png" /></p>
    <p style="clear: both"><img src="https://miro.medium.com/max/60/0*_s3q0PMnbGtz551M.png" /></p>
    <p>Now that we learned how to associate Variable Groups to build pipelines through code, let’s move on to Releases!</p>
    <h1>Release Pipeline</h1>
    <p>For this section of the tutorial, we will create a Release Pipeline for both of our regions, us-east-1 and us-west-2. Use the steps below to create a new Release in Azure DevOps.</p>
    <p><ol>
    <li>In the left hand panel, click Pipelines</em>.</li>
    <li>Click Releases</em>.</li>
    <li>Click the New pipeline</em> button.</li>
    <li>A new pane will open for Stage 1,</em> prompting you to Select a template</em> Or start with an Empty job</em>.</li>
    <li>Click the Empty job</em> link.</li>
    <li>A new pane opens for the stage. Change the Stage name</em> to Release us-east-1.</li>
    <li>Use the x</em> in the upper right corner to close the pane.</li>
    </ol>
    </p>
    <p style="clear: both"><img src="https://miro.medium.com/max/60/0*NF7OOb8Qr-HScipV.png" /></p>
    <p>Next, we will link the Variable Group dev_us-east-1 to the Release us-east-1 stage. To do this, follow the steps below:</p>
    <p><ol>
    <li>Click the Variables</em> menu.</li>
    <li>Select Variable group</em>s in the middle panel.</li>
    <li>Click the Link variable group</em> button.</li>
    <li>Select Dev_us-east-1</em>.</li>
    <li>Under the Variable group scope, select the Stages</em> radio button.</li>
    <li>In the drop-down box, select Release us-east-1</em>.</li>
    <li>Click the Link</em> button.</li>
    <li>Click the Pipeline</em> to return to the Stages</em>.</li>
    </ol>
    </p>
    <p style="clear: both"><img src="https://miro.medium.com/max/60/0*codCrJgSMX95Sf0h.png" /></p>
    <p>Now we need to create a new task for our release. To keep it simple for this tutorial, we’ll write a script to echo the values of our pipeline variables to validate our Variable Group has been linked.</p>
    <p><ol>
    <li>Click the 1 job, 0 task</em> link under the Release us-east-1 stage.</li>
    <li>Click the blue +</em> on the Agent job</em> section.</li>
    <li>A new pane opens, search for or select Command Line</em>.</li>
    <li>Under the Agent job</em> section, Click Command Line Script</em>.</li>
    <li>Update the Display name</em> to Echo Variable Group Values</em>.</li>
    <li>Add the snippet below to the Script</em> text box.</li>
    </ol>
    </p>
    <p><ol>
    <li>Click Save</em>.</li>
    <li>Click Release</em>.</li>
    <li>Select Create a Release</em>.</li>
    <li>A new pane opens, click the Release</em> button.</li>
    </ol>
    </p>
    <p style="clear: both"><img src="https://miro.medium.com/max/60/0*a_BYGkKUgz7zukAB.png" /></p>
    <p>After the release begins, a banner displays on screen. Click the Release-1</em> link provided to open the details and see the output. Use the steps below.</p>
    <p><ol>
    <li>After the release completes, click the Release us-east-1</em> stage box.</li>
    <li>Click the Echo Variable Group Values</em> in the Agent job</em> section.</li>
    </ol>
    </p>
    <p>The variable values for dev_us-east-1 have been exported successfully for this stage of the release.</p>
    <p style="clear: both"><img src="https://miro.medium.com/max/60/0*o_xu0WFbZxbHBYQX.png" /></p>
    <p style="clear: both"><img src="https://miro.medium.com/max/60/0*DiyXO351vFmXSVqi.png" /></p>
    <p>Finally, we will create a new stage for Release us-west-2</em> and associate this stage with the dev_us-west-2 Variable Group. Go back to the Pipelines</em> and Releases sections</em> to edit the existing release.</p>
    <p><ol>
    <li>Hover over the Release us-east-1</em> box, click the Clone button (looks like two papers stacked).</li>
    <li>A copy of the release appears, click the box to edit.</li>
    <li>Update the Stage nam</em>e to Release us-west-2</em>.</li>
    <li>Click the Lightening Bolt</em> icon.</li>
    <li>Change the Triggers</em> to After Release</em>.</li>
    <li>Click the Variables</em> menu.</li>
    <li>Click the Variable groups</em> section.</li>
    <li>Click the Link variable group</em> button.</li>
    <li>Select dev_us-west-2</em>.</li>
    <li>Under the Variable group scope</em>, click the Stages</em> radio button.</li>
    <li>This time select Release us-west-2</em>.</li>
    <li>Click the Link</em> button.</li>
    <li>Click the Save</em> button in the upper right.</li>
    </ol>
    </p>
    <p style="clear: both"><img src="https://miro.medium.com/max/60/0*iAKardfTOtt2wegP.png" /></p>
    <p>Now we have separate stages to release to our two AWS regions in us-east-1 and us-west-2. As you can see, Azure DevOps Variable Groups gives us the opportunity to apply one code base to many different environments and the ability to reduce repeated code.</p>
    <h2>Azure devops build variables</h2>

    <h3>Azure devops build variables</h3>
    <p>[youtube]</p>
    Azure devops build variables <a href="http://remmont.com">Top stories today</a> Azure devops build variables
    <h4>Azure devops build variables</h4>
    Learn how to use Azure DevOps Variable Groups create multi-region AWS deployments in multiple regions and environments with one code base.
    <h5>Azure devops build variables</h5>
    Azure devops build variables <a href="http://remmont.com">Azure devops build variables</a> Azure devops build variables
    SOURCE: <h6>Azure devops build variables</h6> <a href="https://dev-ops.engineer/">Azure devops build variables</a> Azure devops build variables
    #tags#[replace: -,-Azure devops build variables] Azure devops build variables#tags#

    Эдуард Кабринский
    today's news headlines

Поделиться этой страницей