-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
51 lines (51 loc) · 1.44 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
<<<<<<< HEAD
pipeline{
agent any
parameters {
string(name: 'TAG',defaultValue: 'last',description: 'the docker tag you want to release')
}
environment {
TAG = "${params.TAG}"
USER = "root"
HOST = "10.10.0.212"
}
stages {
stage('k8s部署服务') {
steps {
sh "ssh ${USER}@${HOST} ls /data/docker"
=======
pipeline {
agent any
parameters {
string(name: 'BRANCH',defaultValue: 'master',description: 'you want to release the branch')
string(name: 'TAG',defaultValue: 'last',description: 'the tag of the docker images')
}
environment {
BRANCH = "${params.BRANCH}"
PROJECT = "cmdb"
TAG = "${params.TAG}"
}
stages {
stage('本地代码更新') {
steps {
sh " cd /data/git-app/$PROJECT && git pull && git checkout $BRANCH "
}
}
stage('代码打包') {
steps {
sh "cd /data/git-app/$PROJECT && tar -czvf ${PROJECT}.tar.gz ./guokr-cmdb && mv ${PROJECT}.tar.gz /data/docker-app/$PROJECT "
}
}
stage('生成docker镜像') {
steps {
sh " cd /data/docker-app/$PROJECT && docker build -t 180.76.244.5/quxiaotong/${PROJECT}:$TAG . "
}
}
stage('推送docker镜像') {
steps {
sh " docker push 180.76.244.5/quxiaotong/${PROJECT}:$TAG "
>>>>>>> dev
}
}
}
}