Wednesday, July 7, 2021

Azure : Devops : Pipeline :YAML

 You can organize pipeline jobs into stages. Stages are the major divisions in a pipeline: "build this app", "run these tests", and "deploy to pre-production" are good examples of stages. They are logical boundaries in your pipeline where you can pause the pipeline and perform various checks.


Pipeline > Stages >Stage>Steps>Step


jobs:

- job: A

  steps:

  - bash: echo "A"


- job: B

  steps:

  - bash: echo "B"

  

  

  If you organize your pipeline into multiple stages, you use the stages keyword.


If you choose to specify a pool at the stage level, then all jobs defined in that stage will use that pool unless otherwise specified at the job-level

stages:

- stage: A

  jobs:

  - job: A1

  - job: A2


- stage: B

  jobs:

  - job: B1

  - job: B2

  

  When you define multiple stages in a pipeline, by default, they run sequentially in the order in which you define them in the YAML file. The exception to this is when you add dependencies. With dependencies, stages run in the order of the dependsOn requirements

  stages:

- stage: string

  dependsOn: string

  condition: string

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

  You can organize your pipeline into jobs. Every pipeline has at least one job. A job is a series of steps that run sequentially as a unit. In other words, a job is the smallest unit of work that can be scheduled to run.

  

  In the simplest case, a pipeline has a single job. In that case, you do not have to explicitly use the job keyword

  

  jobs:

- job: myJob

  timeoutInMinutes: 10

  pool:

    vmImage: 'ubuntu-16.04'

  steps:

  - bash: echo "Hello world"

  

  

  /usr/lib/jvm/adoptopenjdk-11-hotspot-amd64



 # update-alternatives --config java

          update-alternatives --list java

          echo ls /etc/alternatives

          ls /etc/alternatives

  

  

https://docs.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml

https://docs.microsoft.com/en-us/azure/devops/pipelines/release/caching?view=azure-devops


https://faun.pub/reduce-your-build-time-using-caching-in-azure-pipelines-7a7bd0201cee


MAVEN_CACHE_FOLDER: $(HOME)/.m2/repository"


variables:

  MAVEN_CACHE_FOLDER: $(HOME)/.m2/repository

  MAVEN_OPTS: '-Dmaven.repo.local=$(MAVEN_CACHE_FOLDER)'


- task: Cache@2

  inputs:

    key: '"funcs" | maven |"$(Agent.OS)" | **/pom.xml'

    restoreKeys: |

    path: $(MAVEN_CACHE_FOLDER)

  displayName: Cache Maven local repo

  

https://stackoverflow.com/questions/66161852/is-there-a-predefined-variable-for-home-vsts-in-azure-pipelines/66161853#66161853

  

  

Pool: Hosted Ubuntu 1604

Agent: Hosted Agent



Pool: Azure Pipelines

Image: ubuntu-16.04

Agent: Hosted Agent

No comments:

Post a Comment

Azure - Pipeline - Add Approver for Stage

https://learn.microsoft.com/en-us/azure/devops/pipelines/process/approvals?view=azure-devops&tabs=check-pass