-
Notifications
You must be signed in to change notification settings - Fork 0
/
basic-gradle-build-contitional-qa.yaml
109 lines (107 loc) · 3.4 KB
/
basic-gradle-build-contitional-qa.yaml
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: basic-gradle-build-qa-
spec:
entrypoint: basic-gradle-build-qa
arguments:
parameters:
- name: repo
value: sonar-go
- name: revision
value: master
- name: buildNumber
value: 0
- name: qa
value: false
volumes:
- name: artifactory
secret:
secretName: artifactory
templates:
- name: basic-gradle-build-qa
dag:
tasks:
- name: build
template: build
- name: qa-dev
dependencies: [build]
template: run-ITs
when: "{{workflow.parameters.qa}} == true"
arguments:
parameters: [{name: sqRuntimeVersion, value: DEV}]
- name: qa-latest
dependencies: [build]
template: run-ITs
when: "{{workflow.parameters.qa}} == true"
arguments:
parameters: [{name: sqRuntimeVersion, value: LATEST_RELEASE}]
- name: build
inputs:
artifacts: # Argo way to checkout a git repo (use volume behind)
- name: source
path: /workspace/src
git:
repo: "https://github.com/SonarSource/{{workflow.parameters.repo}}.git"
revision: "{{workflow.parameters.revision}}"
container:
image: openjdk:8u171-jdk
command: [sh, -c]
args: ["
cd /workspace/src &&
./gradlew build artifactoryPublish -DbuildNumber={{workflow.parameters.buildNumber}} --no-daemon --console plain
"]
env:
- name: BUILD_NUMBER
value: "{{workflow.parameters.buildNumber}}"
- name: ARTIFACTORY_URL
valueFrom:
secretKeyRef:
name: artifactory
key: url
- name: ARTIFACTORY_DEPLOY_REPO
valueFrom:
secretKeyRef:
name: artifactory
key: repo
- name: ARTIFACTORY_DEPLOY_USERNAME
valueFrom:
secretKeyRef:
name: artifactory
key: user
- name: ARTIFACTORY_DEPLOY_PASSWORD
valueFrom:
secretKeyRef:
name: artifactory
key: password
volumeMounts:
- name: artifactory
mountPath: "/home/gradle/secrets/artifactory"
- name: run-ITs
inputs:
parameters:
- name: sqRuntimeVersion
container:
image: gradle:4.5.1-jdk8 # Need to use an image that run commands as non root (mandatory by SQ (ES requirement))
command: [sh, -c]
args: ["
git clone --depth 1 https://github.com/SonarSource/{{workflow.parameters.repo}}.git &&
cd {{workflow.parameters.repo}} &&
git checkout {{workflow.parameters.revision}} &&
./gradlew integrationTest -Dsonar.runtimeVersion={{inputs.parameters.sqRuntimeVersion}} -DbuildNumber={{workflow.parameters.buildNumber}} -Dorchestrator.artifactory.apiKey=$ARTIFACTORY_PRIVATE_API_KEY --no-daemon
"] # Checkout the sources, cannot use a volume because it is mounted as root
env:
- name: ARTIFACTORY_PRIVATE_API_KEY
valueFrom:
secretKeyRef:
name: artifactory
key: APIkey
volumeMounts:
- name: artifactory
mountPath: "/home/gradle/secrets/artifactory"
outputs:
artifacts:
- name: tests-report
path: /home/gradle/{{workflow.parameters.repo}}/its/plugin/tests/build/reports/tests/integrationTest
- name: sq-instances
path: /home/gradle/{{workflow.parameters.repo}}/its/plugin/tests/target