This repository has been archived by the owner on Jan 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Jenkinsfile
55 lines (51 loc) · 1.98 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
pipeline {
agent any
parameters {
string(name:'PLUGIN_NAME', defaultValue: 'valuya/curlftpfs', description: '')
string(name:'PLUGIN_TAG', defaultValue:'next', description: '')
}
options {
disableConcurrentBuilds()
buildDiscarder(logRotator(numToKeepStr: '10'))
}
environment {
PLUGIN_NAME="${params.PLUGIN_NAME}"
PLUGIN_TAG="${params.PLUGIN_TAG}"
}
stages {
stage ('Build') {
steps {
sh '''
sudo rm -rf rootfs
sudo docker rm curlftpfsbuild || echo "."
sudo docker rmi curlftpfsbuild || echo "."
sudo docker rm pluginbuild || echo "."
sudo docker rmi "${PLUGIN_NAME}":rootfs || echo "."
sudo docker build -q -t curlftpfsbuild -f Dockerfile.dev .
sudo docker create --name curlftpfsbuild curlftpfsbuild
sudo docker cp curlftpfsbuild:/go/bin/docker-volume-curlftpfs .
sudo docker stop curlftpfsbuild
sudo docker rm curlftpfsbuild
sudo docker rmi curlftpfsbuild
sudo docker build -t "${PLUGIN_NAME}":rootfs .
mkdir -p rootfs
sudo docker create --name pluginbuild "${PLUGIN_NAME}":rootfs
sudo docker export pluginbuild | tar -x -C rootfs
sudo cp config.json rootfs/
sudo docker stop pluginbuild
sudo docker rm pluginbuild
sudo docker plugin rm "${PLUGIN_NAME}":"${PLUGIN_TAG}" || echo "."
sudo docker plugin create "${PLUGIN_NAME}":"${PLUGIN_TAG}" .
sudo rm -rf rootfs
sudo rm -rf docker-volume-curlftpfs
sudo docker rmi "${PLUGIN_NAME}":rootfs
'''
}
}
stage ('Publish') {
steps {
sh 'sudo docker plugin push "${PLUGIN_NAME}":"${PLUGIN_TAG}"'
}
}
}
}