This repository has been archived by the owner on Apr 19, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Jenkinsfile
64 lines (61 loc) · 1.99 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
#!/usr/bin/env groovy
// TODO use parallel https://stackoverflow.com/questions/40143500/how-to-make-pipeline-job-to-wait-for-all-triggered-parallel-jobs
// and have a stage for every layer of possible dependency
// so layer 1: foundational libs
// layer 2: libs that use layer 1 libs
// layer 3: all apps
//
// for each layer we test first whether to run at all, then determine what to build exactly.
// note that each layer needs to encode dependency info on previous layer's libs.
// then do it using "parallel"
pipeline {
agent {
node {
label 'common-ws-agent'
customWorkspace 'monorepo-experiments-master'
}
}
stages {
stage('init') {
steps {
script {
def scmVars = checkout scm
env.MY_GIT_PREVIOUS_SUCCESSFUL_COMMIT = scmVars.GIT_PREVIOUS_SUCCESSFUL_COMMIT
}
}
}
stage('monorepo-library') {
when {
expression {
matches = sh(returnStatus:true, script: "git diff --name-only $MY_GIT_PREVIOUS_SUCCESSFUL_COMMIT|egrep -q '^monorepo-library'")
return !matches
}
}
steps {
build 'monorepo-library'
}
}
stage('play-a') {
when {
expression {
matches = sh(returnStatus: true, script: "git diff --name-only $MY_GIT_PREVIOUS_SUCCESSFUL_COMMIT|egrep -q '^play-a'")
return !matches
}
}
steps {
build 'play-a'
}
}
stage('play-b') {
when {
expression {
matches = sh(returnStatus: true, script: "git diff --name-only $MY_GIT_PREVIOUS_SUCCESSFUL_COMMIT|egrep -q '^play-b'")
return !matches
}
}
steps {
build 'play-b'
}
}
}
}