-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathJenkinsfile
57 lines (55 loc) · 1.42 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
def image
def tag
pipeline {
environment {
registry = "nunoferro/tera"
registryCredential = 'dockerhub'
}
agent any
stages {
stage('Checkout tera-docker') {
steps {
checkout([$class: 'GitSCM',
branches: [[name: '*/master']],
userRemoteConfigs: [[url: 'https://github.com/nferro/tera-docker.git']]
])
}
}
stage('Checkout tera') {
steps {
checkout([$class: 'GitSCM',
branches: [[name: '*/master']],
userRemoteConfigs: [[url: 'https://gitlab.com/terafoundation/tera2.git']],
extensions: [
[$class: 'RelativeTargetDirectory', relativeTargetDir: 'tera']
]
])
}
}
stage('Get Version') {
steps {
script {
tag = sh(returnStdout: true, script: "sed -nE 's/global\\.UPDATE_CODE_VERSION_NUM\\s*=\\s*(.*);/\\1/p' tera/Source/core/constant.js").trim()
echo "Tera version: " + tag
}
}
}
stage('Docker build') {
steps {
script {
image = docker.build(registry + ":0." + tag, ". --network=host")
}
}
}
stage('Docker push') {
steps {
script {
docker.withRegistry( '', registryCredential ) {
image.push()
image.push("latest")
}
}
}
}
}
}