DevOps Classroom notes 03/Nov/2023

Azure DevOps contd

Approvals in Azure DevOps

  • Refer Here for official docs
  • We have created an environment with name deployment-docker
  • Make the changes in the yaml to use deployment and specify environment in it
---
trigger:
  - master

parameters:
  - name: containerRegistry
    displayName: Service Connection For Docker Image
    default: 'mydockerhub'
  - name: vmImage
    displayName: Microsoft Hosted Agent Name
    default: 'ubuntu-22.04'
    values:
      - windows-2022
      - windows-2019
      - ubuntu-22.04
      - ubuntu-20.04

variables:
  dockerfilelocation: '**/Dockerfile'

stages:
  - stage: buildstage
    displayName: Build the application
    jobs:
      - job: dockerbuild
        displayName: docker image build
        pool:
          name: "Azure Pipelines"
          vmImage: "${{ parameters.vmImage }}"
        steps:
          - task: Docker@2
            inputs:
              containerRegistry: "${{ parameters.containerRegistry }}"
              repository: shaikkhajaibrahim/nopfromado
              command: 'buildAndPush'
              Dockerfile: "$(dockerfilelocation)"
              tags: "$(Build.BuildId)"
  - stage: deployStage
    displayName: Deploy application
    jobs:
      - deployment: deployContainer
        displayName: Run the nop commerce
        pool: default
        environment: 'deployment-docker'
        strategy:
          runOnce:
            deploy:
              steps:
                - bash: "docker container rm -f $(docker container ls -a -q)"
                  displayName: Remove All running containers
                - bash: "docker image rm -f $(docker image ls -q)"
                  displayName: Remove all images
                - bash: "docker container run -d --name nop -P shaikkhajaibrahim/nopfromado:$(Build.BuildId)"
                  displayName: Run the application


  • Execute by pushing the code or manual trigger
    Preview
    Preview
    Preview
    Preview
  • Try creating an approval for multiple environments
    Preview
  • Environment: allows us to add resources

    • kubernetes
    • virtual machines

Notifications

  • We need to send an email or an update in Teams/Slack
  • Refer Here for fake smtp server
  • Create a smtp test server and make a note of credentials
  • Figure out how to send email notifications from azure devops pipelines
  • In built Notifications: Refer Here
  • Service hooks Refer Here
  • Custom Notifications from pipeline

Azure DevOps MarketPlace

  • Azure DevOps Market place gives us external tasks developed by community and use them in your pipelines Refer Here
    Preview

Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Animated Social Media Icons by Acurax Responsive Web Designing Company

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Visit Us On FacebookVisit Us On LinkedinVisit Us On Youtube