-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
85 lines (85 loc) · 2.83 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
pipeline {
agent none
environment {
GITHUB = credentials('github_fint_jenkins')
}
stages {
stage('Generate Model') {
agent {
label 'docker'
}
when {
tag pattern: "v\\d+\\.\\d+\\.\\d+(-\\w+-\\d+)?", comparator: "REGEXP"
}
steps {
sh "docker run -i -v \$PWD:/src fint/fint-model:2.2.0-alpha-1 --repo fint-informasjonsmodell-metamodell --filename FINT-metamodell.xml --tag ${TAG_NAME} generate --resource"
stash(name: 'java', includes: 'java/**')
}
}
stage('Commit Java Model') {
agent {
docker {
label 'docker'
image 'fint/git:latest'
}
}
when {
tag pattern: "v\\d+\\.\\d+\\.\\d+(-\\w+-\\d+)?", comparator: "REGEXP"
}
steps {
script {
VERSION = TAG_NAME[1..-1]
}
git 'https://github.com/FINTmodels/fint-metamodell-model-java.git'
sh 'git clean -fdx'
unstash 'java'
sh 'rm -rf src/main/java/no/fint/model/*'
sh 'mv java/* src/main/java/no/fint/model/'
sh "echo version=${VERSION} > gradle.properties"
sh 'git config user.email "jenkins@fintlabs.no"'
sh 'git config user.name "FINT Jenkins"'
sh 'git add gradle.properties src/main/java/no/fint/model/'
sh "git commit -m 'Version ${VERSION}'"
sh "git push 'https://${GITHUB}@github.com/FINTmodels/fint-metamodell-model-java.git' master:master"
}
}
stage('Generate Consumer') {
agent {
label 'docker'
}
when {
tag pattern: "v\\d+\\.\\d+\\.\\d+(-\\w+-\\d+)?", comparator: "REGEXP"
}
steps {
sh "docker run -i -v \$PWD:/src fint/fint-consumer:2.2.0-rc-1 --repo fint-informasjonsmodell-metamodell --filename FINT-metamodell.xml --tag ${TAG_NAME} setup --name metamodell --component metamodell --branch newcache"
stash(name: 'consumer', includes: 'fint-consumer-metamodell/**')
}
}
stage('Commit Consumer') {
agent {
docker {
label 'docker'
image 'fint/git:latest'
}
}
when {
tag pattern: "v\\d+\\.\\d+\\.\\d+(-\\w+-\\d+)?", comparator: "REGEXP"
}
steps {
script {
VERSION = TAG_NAME[1..-1]
}
git 'https://github.com/FINTLabs/fint-consumer-metamodell.git'
sh 'git clean -fdx'
sh 'git config user.email "jenkins@fintlabs.no"'
sh 'git config user.name "FINT Jenkins"'
unstash 'consumer'
sh 'cp -r fint-consumer-metamodell/* . && rm -r fint-consumer-metamodell'
sh 'sed -i -e "s/-resource-model-/-model-/" build.gradle'
sh 'git add .'
sh "git commit -m 'Version ${VERSION}'"
sh "git push 'https://${GITHUB}@github.com/FINTLabs/fint-consumer-metamodell.git' master:master"
}
}
}
}