quartz/content/Devops&DevSecOps/Testing AzureDevOps.md
2023-12-04 15:08:09 +03:00

3.0 KiB

Index

No hosted parallelism has been purchased or granted. To request a free parallelism grant, please fill out the following form https://aka.ms/azpipelines-parallelism-reques

  • Local Agent kurulmasi

Repo url link

First pipeline yml

Name of file azure-pipeline.yml

# Maven
# Build your Java project and run tests with Apache Maven.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/java

trigger:
- main

pool:
  name: hvlubuntu

steps:
- task: Maven@1
  inputs:
    mavenPomFile: 'pom.xml'
    publishJUnitResults: true
    testResultsFiles: '**/surefire-reports/TEST-*.xml'
    javaHomeOption: 'JDKVersion'
    mavenVersionOption: 'Default'
    mavenAuthenticateFeed: false
    effectivePomSkip: false
    sonarQubeRunAnalysis: false`

!Pasted image 20230714155723.png

CI/CD Build and Release Pipelines

!Pasted image 20230714155935.png

Change index.jsp and trigger pipeline

Show source code and build dir.

!Screenshot from 2023-07-14 16-37-45.png

Copy artifacts

# Maven

# Build your Java project and run tests with Apache Maven.

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

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

  

trigger:

- main

  

pool:

name: hvlubuntu

  

steps:

- task: Maven@1

inputs:

mavenPomFile: 'pom.xml'

publishJUnitResults: true

testResultsFiles: '**/surefire-reports/TEST-*.xml'

javaHomeOption: 'JDKVersion'

mavenVersionOption: 'Default'

mavenAuthenticateFeed: false

effectivePomSkip: false

sonarQubeRunAnalysis: false`

- task: CopyFiles@2

inputs:

Contents: '**/*.war'

TargetFolder: '$(build.artifactstagingdirectory)'

!Pasted image 20230714164425.png

For see results in azuredevops we need to publish artifacts

!Pasted image 20230714164855.png

# Maven
# Build your Java project and run tests with Apache Maven.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/java

trigger:
- main

pool:
  name: hvlubuntu

steps:
- task: Maven@1
  inputs:
    mavenPomFile: 'pom.xml'
    publishJUnitResults: true
    testResultsFiles: '**/surefire-reports/TEST-*.xml'
    javaHomeOption: 'JDKVersion'
    mavenVersionOption: 'Default'
    mavenAuthenticateFeed: false
    effectivePomSkip: false
    sonarQubeRunAnalysis: false`
    
- task: CopyFiles@2
  inputs:
    Contents: '**/*.war'
    TargetFolder: '$(build.artifactstagingdirectory)'
- task: PublishPipelineArtifact@1
  inputs:
    targetPath: '$(Pipeline.Workspace)'
    artifact: 'warfile'
    publishLocation: 'pipeline'