-
Notifications
You must be signed in to change notification settings - Fork 11
/
azure-pipelines.yml
72 lines (65 loc) · 2.15 KB
/
azure-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# 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:
vmImage: ubuntu-latest
steps:
- task: Maven@3
inputs:
mavenPomFile: 'pom.xml'
mavenOptions: '-Xmx3072m'
javaHomeOption: 'JDKVersion'
##jdkVersionOption: '1.8'
##jdkArchitectureOption: 'x64'
mavenAuthenticateFeed: true
publishJUnitResults: true
testResultsFiles: '**/surefire-reports/TEST-*.xml'
goals: 'package'
- task: CopyFiles@2
inputs:
Contents: '**'
TargetFolder: '$(build.artifactstagingdirectory)'
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: 'Jacoco'
summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/src/main/java/'
# Download build artifacts v1
- task: DownloadBuildArtifacts@1
inputs:
buildType: 'current'
downloadType: 'specific'
downloadPath: '$(System.ArtifactsDirectory)'
- script:
echo '$(Pipeline.Workspace)'
echo '$(System.ArtifactsDirectory)/drop/target/*.jar'
# - script: |
# sudo apt update
# sudo apt install -y wget
# wget -qO gitleaks.tar.gz https://github.com/gitleaks/gitleaks/releases/download/v8.17.0/gitleaks_8.17.0_linux_x64.tar.gz
# tar -xvf gitleaks.tar.gz
# sudo mv gitleaks /usr/local/bin/
# rm gitleaks.tar.gz
# gitleaks detect --source=. --exit-code 126 --verbose --redact --report-format junit --report-path=$(Common.TestResultsDirectory)/gitleaks
# displayName: 'Detect Secrets - Gitleaks'
# continueOnError: true
# Run the springboot application
# - task: CmdLine@2
# inputs:
# script: 'java -jar *.jar'
# workingDirectory: '$(System.ArtifactsDirectory)/drop/target/'
- task: SonarCloudPrepare@1
inputs:
SonarCloud: 'SonarCloud'
organization: 'san-sample-projects'
scannerMode: 'Other'
projectKey: 'sample-spring-boot-crud-example-with-h2'
env:
SONAR_TOKEN: $(SONAR_TOKEN)