forked from Open-MBEE/exec-cameo-mdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
103 lines (99 loc) · 4.19 KB
/
Jenkinsfile
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
pipeline {
agent {
docker{
image 'circleci/openjdk@sha256:012843a8f91da1ea5e22e142bb5cb8c999a7457e03b8c79ab45d5fcb68043383'
}
}
environment {
GRADLE_USER_HOME = "$WORKSPACE/.gradle"
ARTIFACTORY_CREDENTIALS = credentials('mdk-artifactory-credentials')
TESTRAIL_CREDENTIALS = credentials('mdk-testrail-credentials')
BUILD_PROFILE = credentials('mdk-build-access')
TESTRAIL_HOST = credentials('mdk-testrail-host')
TESTRAIL_SUITE_ID = credentials('mdk-testrail-suite-id')
ARTIFACTORY_URL = credentials('mdk-artifactory-url')
ADDITIONAL_TEST_ARGUMENTS = credentials('mdk-additional-test-args-19')
}
stages {
stage('Dependencies') {
steps {
echo 'TAG_NAME = $TAG_NAME'
sh './gradlew \
-PbuildNumber=$BUILD_NUMBER \
-PbuildProfile=$BUILD_PROFILE \
-PbuildTag=$TAG_NAME \
-PartifactoryUrl=$ARTIFACTORY_URL \
-PartifactoryUsername=$ARTIFACTORY_CREDENTIALS_USR \
-PartifactoryPassword=$ARTIFACTORY_CREDENTIALS_PSW \
--gradle-user-home $GRADLE_USER_HOME \
--info --stacktrace --refresh-dependencies \
dependencies'
}
}
stage('Compile') {
steps {
sh './gradlew \
-PbuildNumber=$BUILD_NUMBER \
-PbuildProfile=$BUILD_PROFILE \
-PbuildTag=$TAG_NAME \
-PartifactoryUrl=$ARTIFACTORY_URL \
-PartifactoryUsername=$ARTIFACTORY_CREDENTIALS_USR \
-PartifactoryPassword=$ARTIFACTORY_CREDENTIALS_PSW \
--gradle-user-home $GRADLE_USER_HOME \
--continue --info --stacktrace \
clean assemble'
}
}
stage('Test') {
steps {
sh 'xvfb-run ./gradlew \
-PbuildNumber=$BUILD_NUMBER \
-PbuildProfile=$BUILD_PROFILE \
-PbuildTag=$TAG_NAME \
-PartifactoryUrl=$ARTIFACTORY_URL \
-PartifactoryUsername=$ARTIFACTORY_CREDENTIALS_USR \
-PartifactoryPassword=$ARTIFACTORY_CREDENTIALS_PSW \
-PtestrailHost=$TESTRAIL_HOST \
-PtestrailUser=$TESTRAIL_CREDENTIALS_USR \
-PtestrailPassword=$TESTRAIL_CREDENTIALS_PSW \
-PtestrailSuiteId=$TESTRAIL_SUITE_ID \
-PadditionalTestArguments=$ADDITIONAL_TEST_ARGUMENTS \
--gradle-user-home $GRADLE_USER_HOME \
--continue --info --stacktrace \
check testrailPublish'
}
}
stage('Publish Snapshot') {
when { anyOf { branch 'develop' ; branch 'release/**' } }
steps {
sh './gradlew \
-PbuildNumber=$BUILD_NUMBER \
-PbuildProfile=$BUILD_PROFILE \
-PbuildTag=$TAG_NAME \
-PartifactoryUrl=$ARTIFACTORY_URL \
-PartifactoryUsername=$ARTIFACTORY_CREDENTIALS_USR \
-PartifactoryPassword=$ARTIFACTORY_CREDENTIALS_PSW \
-PartifactoryRepository=maven-libs-snapshot-local \
--gradle-user-home $GRADLE_USER_HOME \
--continue --info --stacktrace \
artifactoryPublish'
}
}
stage('Publish Release') {
when { tag "*" }
steps {
sh './gradlew \
-PbuildNumber=$BUILD_NUMBER \
-PbuildProfile=$BUILD_PROFILE \
-PbuildTag=$TAG_NAME \
-PartifactoryUrl=$ARTIFACTORY_URL \
-PartifactoryUsername=$ARTIFACTORY_CREDENTIALS_USR \
-PartifactoryPassword=$ARTIFACTORY_CREDENTIALS_PSW \
-PartifactoryRepository=maven-libs-release-local \
--gradle-user-home $GRADLE_USER_HOME \
--continue --info --stacktrace \
artifactoryPublish'
}
}
}
}