DevOps Classroomnotes 11/Feb/2023

Azure DevOps Pipelines Contd…

Expressions

  • Refer Here for official docs
  • Compile time vs runtime
#syntax ${{}} for compile time and $[] for runtime expressions.
variables:
  a: ${{ <expression> }}
  b: $[ <expression> ]
  • Functions in expressions Refer Here
  • Lets use expressions to print the BuildId and Parameter
# 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:
- main

pool:
  vmImage: ubuntu-latest


parameters:
  - name: version
    displayName: version
    type: string
    default: v1.0
variables:
  runtimetag: ${{format('{0}-{1}', 'v1.0', '$(Build.BuildId)')}}

steps:
- script: "echo ${{ parameters.version }}-$(Build.BuildId)"
  displayName: Say hello
- script: "echo ${{ variables.runtimetag }}"
  displayName: "Say hello again"
# 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:
- main

pool:
  vmImage: ubuntu-latest

variables:
  color: red


steps:
  - ${{ if eq(variables.color, 'red') }}:
      - script: echo red
        displayName: red
  - ${{ if eq(variables.color, 'blue') }}:
      - script: echo blue
        displayName: blue
  • repeating the steps
# 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:
- main

pool:
  vmImage: ubuntu-latest

variables:
  color: red

parameters:
  - name: listofbuilds
    type: object
    default:
      - mac
      - windows
      - linux



steps:
  - ${{ if eq(variables.color, 'red') }}:
      - script: echo red
        displayName: red
  - ${{ if eq(variables.color, 'blue') }}:
      - script: echo blue
        displayName: blue
  - ${{ each value in parameters.listofbuilds }}:
      - script: echo  ${{ value }}
        displayName: ${{ value }}

Preview

Service Connections

  • Refer Here for Azure DevOps Service Pipeline connections.
  • Service Connection Types Refer Here
  • Refer Here for Azure Devops Toolkit for AWS
  • Refer Here to create a service connection from Azure Devops to GCP
  • Note: Refer Here for a document which speaks from code to kubernetes

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