-
Notifications
You must be signed in to change notification settings - Fork 85
Expand file tree
/
Copy pathJenkinsfile
More file actions
executable file
·71 lines (64 loc) · 2.07 KB
/
Jenkinsfile
File metadata and controls
executable file
·71 lines (64 loc) · 2.07 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
@Library('lib-jenkins-pipeline') _
def sbtOnMain = "no"
// we can remove the pod_template block if we end up having only one template
// in jenkins config
//
String podLabel = "Jenkinsfile-apibuilder"
podTemplate(
label: "${podLabel}",
inheritFrom : 'generic'
){
node(podLabel) {
try {
checkoutWithTags scm
//Checkout the code from the repository
stage('Checkout') {
echo "Checking out branch: ${env.BRANCH_NAME}"
checkout scm
}
// => tagging function to identify what actions to take depending on the nature of the changes
stage ('tagging') {
semversion = taggingv2()
println(semversion)
}
// => Running the actions for each component in parallel
checkoutWithTags scm
String jsondata = '''
[{"serviceName": "apibuilder-api",
"dockerImageName": "apibuilder-api",
"dockerFilePath" : "/api/Dockerfile",
"multiplatforms": "no"},
{"serviceName": "apibuilder-app",
"dockerImageName": "apibuilder-app",
"dockerFilePath" : "/app/Dockerfile",
"multiplatforms": "no"}]
'''
withCredentials([string(credentialsId: "jenkins-argocd-token", variable: 'ARGOCD_AUTH_TOKEN')]) {
mainJenkinsBuildArgo(
semversion: "${semversion}",
pgImage: "flowcommerce/bentest-postgresql:latest",
componentargs: "${jsondata}",
sbtOnMain: "${sbtOnMain}",
sbtTest: "no"
// => optional
//orgName: "flowvault"
// SBT test
//sbtCommand: 'sbt clean flowLint coverage test scalafmtSbtCheck scalafmtCheck doc',
//playCpuLimit: "2",
//playMemoryRequest: "4Gi",
//pgCpuLimit: "1",
//pgMemoryRequest: "2Gi",
//sbtTestInMain: "${sbtOnMain}"
)
}
} catch (Exception e) {
// In case of an error, mark the build as failure
currentBuild.result = 'FAILURE'
throw e
} finally {
// Always clean up workspace and notify if needed
cleanWs()
echo "Pipeline execution finished"
}
}
}