Devops Pipeline

 I realize it can be hard to follow along with a video sometimes. If you get stuck, you can always refer to the steps documented here. This should have you up and running with your Flatris game in minutes. Enjoy. 1. In Azure, create a Linux WebApp Service Make sure to use a clone of the Flatris-LAB GitHub repository: https://github.com/likeabosslearning/Flatris-LAB LIKE A BOSS FLATRIS PIPELINE BUILD QUICK REFERENCE GUIDE 2. Create s Service Connection to link DevOps to your Azure subscription. You’ll use this Service connection name in the YAML file. 3. Create the DevOps Pipeline. Point to the Azure DevOps Repo hosting the Flatris DevOps app. Use the first option, ‘Node.js to get started with a general Node.js project. 4. Use the following custom YAML file, replacing the first 4 variables with the Service Connection, App Service, and Resource Group Names that match your environment. (You should be able to copy and paste. # Node.js Express Web App to Linux on Azure # Build a Node.js Express app and deploy it to Azure as a Linux web app. # Add steps that analyze code, save build artifacts, deploy, and more: # https://docs.microsoft.com/azure/devops/pipelines/languages/javascript trigger: - master variables:   # Azure Resource Manager connection created during pipeline creation   azureSubscription: 'ServiceConnectionName'      # Web app name   webAppName: 'LinuxApp5601'      # Resource group   resourceGroupName: 'Linux5601RG'   # Environment name   environmentName: 'LinuxApp5601'   # Agent VM image name   vmImageName: 'ubuntu-latest'    stages: - stage: Archive   displayName: Archive stage   jobs:     - job: Archive     displayName: Archive     pool:       vmImage: $(vmImageName)     steps:        - task: AzureAppServiceSettings@1       inputs:         azureSubscription: $(azureSubscription)         appName: $(webAppName)         resourceGroupName: $(resourceGroupName)         appSettings: |           [             {               "name": "SCM_DO_BUILD_DURING_DEPLOYMENT",               "value": "true"             }           ]     - task: ArchiveFiles@2       displayName: 'Archive files'       inputs:         rootFolderOrFile: '$(System.DefaultWorkingDirectory)'         includeRootFolder: false         archiveType: zip         archiveFile: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip         replaceExistingArchive: true     - upload: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip       artifact: drop - stage: Deploy   displayName: Deploy stage   dependsOn: Archive   condition: succeeded()   jobs:   - deployment: Deploy     displayName: Deploy     environment: $(environmentName)     pool:       vmImage: $(vmImageName)     strategy:       runOnce:         deploy:           steps:                       - task: AzureWebApp@1             displayName: 'Azure Web App Deploy: Matt-Test-NodeJS-Deploy'             inputs:               azureSubscription: $(azureSubscription)               appType: webAppLinux               appName: $(webAppName)               runtimeStack: 'NODE|10.14'               package: $(Pipeline.Workspace)/drop/$(Build.BuildId).zip 5. Save and run the pipeline, then open the link associated with your WebApp.


--------------------------------------------------

# Node.js Express Web App to Linux on Azure

# Build a Node.js Express app and deploy it to Azure as a Linux web app.

# Add steps that analyze code, save build artifacts, deploy, and more:

# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript

 

trigger:

- master

 

variables:

 

  # Azure Resource Manager connection created during pipeline creation

  azureSubscription: 'YourServiceConnectionName'

  

  # Web app name

  webAppName: 'YourLinuxApp'

  

  # Resource group

  resourceGroupName: 'YourRG'

 

  # Environment name

  environmentName: 'YourLinuxApp'

 

  # Agent VM image name

  vmImageName: 'ubuntu-latest'

  

stages:

- stage: Archive

  displayName: Archive stage

  jobs:  

  - job: Archive

    displayName: Archive

    pool:

      vmImage: $(vmImageName)

    steps:   

    - task: AzureAppServiceSettings@1

      inputs:

        azureSubscription: $(azureSubscription)

        appName: $(webAppName)

        resourceGroupName: $(resourceGroupName)

        appSettings: |

          [

            {

              "name": "SCM_DO_BUILD_DURING_DEPLOYMENT",

              "value": "true"

            }

          ]

    - task: ArchiveFiles@2

      displayName: 'Archive files'

      inputs:

        rootFolderOrFile: '$(System.DefaultWorkingDirectory)'

        includeRootFolder: false

        archiveType: zip

        archiveFile: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip

        replaceExistingArchive: true

 

    - upload: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip

      artifact: drop

 

- stage: Deploy

  displayName: Deploy stage

  dependsOn: Archive

  condition: succeeded()

  jobs:

  - deployment: Deploy

    displayName: Deploy

    environment: $(environmentName)

    pool: 

      vmImage: $(vmImageName)

    strategy:

      runOnce:

        deploy:

          steps:            

          - task: AzureWebApp@1

            displayName: 'Azure Web App Deploy: Matt-Test-NodeJS-Deploy'

            inputs:

              azureSubscription: $(azureSubscription)

              appType: webAppLinux

              appName: $(webAppName)

              runtimeStack: 'NODE|10.14'

              package: $(Pipeline.Workspace)/drop/$(Build.BuildId).zip

 ----------------------------------------------

This quick reference contains terms encountered when working with Azure Pipelines: Artifact An artifact is a collection of files or packages published by a run. Artifacts are made available to subsequent tasks, such as distribution or deployment. For more information, see Artifacts in Azure Pipelines. Continuous delivery Continuous delivery (CD) is a process by which code is built, tested, and deployed to one or more test and production stages. Deploying and testing in multiple stages helps drive quality. Continuous integration systems produce deployable artifacts, which includes infrastructure and apps. Automated release pipelines consume these artifacts to release new versions and fixes to existing systems. Monitoring and alerting systems run constantly to drive visibility into the entire CD process. This process ensures that errors are caught often and early. Continuous integration Continuous integration (CI) is the practice used by development teams to simplify the testing and building of code. CI helps to catch bugs or problems early in the development cycle, which makes them easier and faster to fix. Automated tests and builds are run as part of the CI process. The process can run on a set schedule, whenever code is pushed, or both. Items known as artifacts are produced from CI systems. They're used by the continuous delivery release pipelines to drive automatic deployments. Environment An environment is a collection of resources, where you deploy your application. It can contain one or more virtual machines, containers, web apps, or any service that's used to host the application being developed. A pipeline might deploy the app to one or more environments after build is completed and tests are run. Job A stage contains one or more jobs. Each job runs on an agent. A job represents an execution boundary of a set of steps. All of the steps run together on the same agent. For example, you might build two configurations - x86 and x64. In this case, you have one build stage and two jobs. LIKE A BOSS DEVOPS PIPELINES TERMS QUICK REFERENCE GUIDE Pipeline A pipeline defines the continuous integration and deployment process for your app. It's made up of one or more stages. It can be thought of as a workflow that defines how your test, build, and deployment steps are run. Run A run represents one execution of a pipeline. It collects the logs associated with running the steps and the results of running tests. Stage A stage is a logical boundary in the pipeline. It can be used to mark separation of concerns (e.g., Build, QA, and production). Each stage contains one or more jobs. Step A step is the smallest building block of a pipeline. For example, a pipeline might consist of build and test steps. A step can either be a script or a task. A task is simply a pre-created script offered as a convenience to you. To view the available tasks, see the Build and release tasks reference. For information on creating custom tasks, see Create a custom task. Trigger A trigger is something that's set up to tell the pipeline when to run. You can configure a pipeline to run upon a push to a repository, at scheduled times, or upon the completion of another build. All of these actions are known as triggers. For more information, see build triggers and release triggers.

---------------------------------------------

# Node.js Express Web App to Linux on Azure

# Build a Node.js Express app and deploy it to Azure as a Linux web app.

# Add steps that analyze code, save build artifacts, deploy, and more:

# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript

 

trigger:

- master

 

variables:

 

  # Azure Resource Manager connection created during pipeline creation

  azureSubscription: 'yoursubname'

  

  # Web app name

  webAppName: 'yourwebappname'

  

  # Resource group

  resourceGroupName: 'yourresourcegroup'

 

  # Environment name

  environmentName: 'yourenvironmentname'

 

  # Agent VM image name

  vmImageName: 'ubuntu-latest'

  

stages:

- stage: Archive

  displayName: Archive stage

  jobs:  

  - job: Archive

    displayName: Archive

    pool:

      vmImage: $(vmImageName)

    steps:   

    - task: AzureAppServiceSettings@1

      inputs:

        azureSubscription: $(azureSubscription)

        appName: $(webAppName)

        resourceGroupName: $(resourceGroupName)

        appSettings: |

          [

            {

              "name": "SCM_DO_BUILD_DURING_DEPLOYMENT",

              "value": "true"

            }

          ]

    - task: ArchiveFiles@2

      displayName: 'Archive files'

      inputs:

        rootFolderOrFile: '$(System.DefaultWorkingDirectory)'

        includeRootFolder: false

        archiveType: zip

        archiveFile: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip

        replaceExistingArchive: true

 

    - upload: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip

      artifact: drop

 

- stage: Deploy

  displayName: Deploy stage

  dependsOn: Archive

  condition: succeeded()

  jobs:

  - deployment: Deploy

    displayName: Deploy

    environment: $(environmentName)

    pool: 

      vmImage: $(vmImageName)

    strategy:

      runOnce:

        deploy:

          steps:            

          - task: AzureWebApp@1

            displayName: 'Azure Web App Deploy: Matt-Test-NodeJS-Deploy'

            inputs:

              azureSubscription: $(azureSubscription)

              appType: webAppLinux

              appName: $(webAppName)

              runtimeStack: 'NODE|10.14'

              package: $(Pipeline.Workspace)/drop/$(Build.BuildId).zip

Comments