-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathJenkinsfile.PR
98 lines (93 loc) · 3.37 KB
/
Jenkinsfile.PR
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
def buildDeploy() {
stage('Build And Push Image'){
// when {
// expression {
// return env.useGithubAction != 'true'
// }
// }
script {
echo "docker build"
// dockerApi.buildImage()
// dockerApi.dockerTag(utils.targetEnvironment + '-' + prImageTag)
}
}
stage('Updating Image Tags'){
// when {
// expression {
// return env.useGithubAction != 'true'
// }
// }
script {
echo "docker tag"
// dockerApi.updateLatestDockertags() // Set old 'environment-latest' tagged docker image to 'environment-previous' tag & set 'environment-latest' tag to the new built image
}
}
}
def triggerChecks(){
echo "trigger new Job..."
build job: 'oh-api/oh-api-lint', parameters: [[$class: 'StringParameterValue', name: 'branch_name', value: 'testjenkins'],
[$class: 'StringParameterValue', name: 'pullId', value: '5'],
[$class: 'StringParameterValue', name: 'repo', value: 'nodeapp']]
// triggerRemoteJob mode: [$class: 'TrackProgressAwaitResult', scheduledTimeout: [timeoutStr: ''], startedTimeout: [timeoutStr: ''], timeout: [timeoutStr: '1d'], whenFailure: [$class: 'StopAsFailure'], whenScheduledTimeout: [$class: 'ContinueAsIs'], whenStartedTimeout: [$class: 'ContinueAsIs'], whenTimeout: [$class: 'ContinueAsFailure'], whenUnstable: [$class: 'ContinueAsUnstable']],
// parameterFactories: [
// [$class: 'CurrentBuild', excludesStr: '', includeSensitive: false],
// [$class: 'SimpleString', name: 'branch_name', value: "${env.CHANGE_BRANCH}"],
// [$class: 'SimpleString', name: 'repo', value: "${utils.repoName}"],
// [$class: 'SimpleString', name: 'pullId', value: "${pullId}"],
// ], remotePathMissing: [$class: 'ContinueAsIs'], remotePathUrl: "jenkins://0f512b00c7f3d4ad1076556b8a13afd2/${utils.projectName}/${repositoryName}-lint"
}
def triggerTests(){
echo "trigger new Job..."
build job: 'oh-api/oh-api-testaa', parameters: [[$class: 'StringParameterValue', name: 'branch_name', value: "testjenkins"],
[$class: 'StringParameterValue', name: 'pullId', value: "5"],
[$class: 'StringParameterValue', name: 'repo', value: "nodeapp"]]
}
checksJobs = [
"Lint Checks": {
triggerChecks()
},
"Test Checks": {
triggerTests()
}
]
checksJobs.failFast = true
pipeline {
agent
{
node {
label 'master'
customWorkspace "${env.JobPath}"
}
}
environment {
CI = 'true'
HOME = '.'
}
stages {
stage('Branch Check') {
steps {
sh 'npm install'
}
}
stage('Review Check') {
steps {
echo "approved checks"
}
}
stage('Stage Trigger') {
steps {
script {
if (true) {
stage('Checks') {
echo "lintjob"
script {
parallel(checksJobs)
}
}
}
buildDeploy()
}
}
}
}
}