forked from chrishantha/sample-java-programs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathazure-pipelines.yml
More file actions
97 lines (85 loc) · 2.72 KB
/
azure-pipelines.yml
File metadata and controls
97 lines (85 loc) · 2.72 KB
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# 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:
- master
pool:
vmImage: ubuntu-latest
variables:
testing: "karun"
steps:
- task: MavenAuthenticate@0
inputs:
artifactsFeeds: 'ATG_Artifacts'
mavenServiceConnections: 'PipeLineArtifactory'
- task: Maven@3
inputs:
mavenPomFile: 'pom.xml'
mavenOptions: '-Xmx3072m'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.8'
jdkArchitectureOption: 'x64'
#publishJUnitResults: true
#testResultsFiles: '**/surefire-reports/TEST-*.xml'
goals: 'clean install package'
- task: SonarQubePrepare@5
inputs:
SonarQube: 'AZDevopsSonar Connection'
scannerMode: 'MSBuild'
projectKey: 'Project-Key-Sonar'
projectName: 'Project-Name-Sonar'
- task: Maven@3
inputs:
mavenPomFile: 'pom.xml'
publishJUnitResults: true
testResultsFiles: '**/surefire-reports/TEST-*.xml'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.8'
mavenVersionOption: 'Default'
mavenOptions: '-Xmx3072m'
mavenAuthenticateFeed: false
effectivePomSkip: false
sonarQubeRunAnalysis: true
sqMavenPluginVersionChoice: 'latest'
#goals: 'build'
- task: SonarQubePublish@5
inputs:
pollingTimeoutSec: '3000'
- task: Bash@3
inputs:
targetType: 'inline'
script: |
# Write your commands here
echo 'Hello world'
export YOUR_TOKEN=37349de5b376b11b9f516efc719ae98f4f56df1a
export YOUR_PROJECT_KEY=Project-Key-Sonar
export SONAR_HOST=sonarqube.287908807331.rax.support
export STATUS=$(curl -u ${YOUR_TOKEN}: -G --data-urlencode "projectKey=${YOUR_PROJECT_KEY}" https://${SONAR_HOST}/api/qualitygates/project_status | python -c 'import sys,json;data=json.load(sys.stdin);print(data["projectStatus"]["status"])')
echo ">>>>>>>>>>>>>${STATUS}"
if [ "${STATUS}" = "ERROR" ]; then exit 1; fi
#- task: InvokeRESTAPI@1
# inputs:
# connectionType: 'connectedServiceName'
# serviceConnection: 'SonarQube API'
# method: 'GET'
# headers: |
# {
# "Content-Type":"application/json",
# "projectKey": "Project-Key-Sonar"
# }
# waitForCompletion: 'true'
#- task: CopyFiles@2
# inputs:
# SourceFolder: '/home/vsts/work/1/s/'
# Contents: '**/target/*.jar'
# TargetFolder: '$(Build.ArtifactStagingDirectory)'
#- task: PublishBuildArtifacts@1
# inputs:
# pathToPublish: $(Build.ArtifactStagingDirectory)
# artifactName: ATG_Artifacts
#- task: PublishPipelineArtifact@1
# inputs:
# targetPath: '$(Build.ArtifactStagingDirectory)'
# artifact: 'ATG_Artifacts'
# publishLocation: 'pipeline'