DevOps Classroomnotes 30/Jun/2023

Azure DevOps

Using Microsoft Hosted Agent

  • Refer Here for the list of microsoft hosted agents
  • Setting up Microsoft hosted agents (Watch the classroom video)
  • Create a pipeline for game of life which use jdk 8
---
trigger:
  - master

jobs:
  - job: buildjob
    displayName: Build and Package Game of life
    pool: 
      vmImage: ubuntu-22.04
    steps:
      - task: Maven@3
        inputs:
          mavenPOMFile: 'pom.xml'
          goals: 'package'
          publishJUnitResults: true
          testResultsFiles: '**/surefire-reports/TEST-*.xml'
          javaHomeOption: 'JDKVersion'
          jdkVersionOption: '1.8'

Preview

  • Azure DevOps Pipleine Variables Refer Here
  • Azure DevOps has predefined varibales Refer Here
  • Used Copyfiles task
---
trigger:
  - master

jobs:
  - job: buildjob
    displayName: Build and Package Game of life
    pool: 
      vmImage: ubuntu-22.04
    steps:
      - task: Maven@3
        inputs:
          mavenPOMFile: 'pom.xml'
          goals: 'package'
          publishJUnitResults: true
          testResultsFiles: '**/surefire-reports/TEST-*.xml'
          javaHomeOption: 'JDKVersion'
          jdkVersionOption: '1.8'
      - task: CopyFiles@2
        inputs:
          Contents: "**/target/gameoflife.war"
          TargetFolder: $(Build.ArtifactStagingDirectory)
  • Lets use Publish build artifacts to acheive the same result Refer Here
---
trigger:
  - master

jobs:
  - job: buildjob
    displayName: Build and Package Game of life
    pool: 
      vmImage: ubuntu-22.04
    steps:
      - task: Maven@3
        inputs:
          mavenPOMFile: 'pom.xml'
          goals: 'package'
          publishJUnitResults: true
          testResultsFiles: '**/surefire-reports/TEST-*.xml'
          javaHomeOption: 'JDKVersion'
          jdkVersionOption: '1.8'
      - task: CopyFiles@2
        inputs:
          Contents: "**/target/gameoflife.war"
          TargetFolder: $(Build.ArtifactStagingDirectory)
      - task: PublishBuildArtifacts@1
        inputs:
          pathToPublish: $(Build.ArtifactStagingDirectory)
          artifactName: GameOfLifeArtifacts

Preview
Preview

Leave a Reply

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

About continuous learner

devops & cloud enthusiastic learner