-
Notifications
You must be signed in to change notification settings - Fork 0
/
pipeline
86 lines (81 loc) · 2.53 KB
/
pipeline
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
86
pipeline
{
agent {
node {
label 'local-docker'
}
}
stages {
stage('1 CleanUP') {
steps {
echo '1 CleanUP'
sh '''
rm -rf ./youtube_downloader
'''
echo '1 CleanUP END'
}
}
stage('2 GIT') {
steps {
echo '2 GIT'
sh '''
git clone ssh://git@${GITEA}/den/youtube_downloader.git --config core.sshCommand="ssh -i /home/den/.ssh/id_rsa"
'''
echo '2 GIT END'
}
}
stage('3 TESTING') {
steps {
echo '3 TESTING'
// dir('youtube_downloader') {
//TODO: add test
// }
echo '3 TESTING END'
}
}
stage('4 DOCKER build images') {
steps {
echo '4 DOCKER build images'
dir('youtube_downloader') {
sh 'docker build -t ${REGISTRY}/youtube-downloader -f ./dockerfile .'
}
echo '4 DOCKER build images END'
}
}
stage('5 DOCKER push images') {
steps {
echo '5 DOCKER push images'
dir('youtube_downloader') {
sh 'docker push ${REGISTRY}/youtube-downloader'
}
echo '5 DOCKER push images END'
}
}
stage('6 DEPLOY') {
steps {
echo '6 DEPLOY}'
dir('youtube_downloader') {
sh 'ssh -T ${DEPLOY_SERVER} -i /home/den/.ssh/id_rsa "cd Dockers/youtube_downloader && docker compose pull && docker compose down && docker compose up -d && docker image prune -f"'
}
echo '6 DEPLOY END'
}
}
stage('7 CLEAN UP') {
steps {
echo '7 CLEAN UP'
sh 'rm -rf ./youtube_downloader'
sh 'docker image prune -f'
echo '7 CLEAN UP'
}
}
stage('8 INFORMING') {
steps {
echo '8 INFORMING'
sh '''
curl "https://${GOTIFY_URL}/message?token=${GOTIFY_KEY}" -F "title=Бот youtube_downloader CI/CD" -F "message=youtube_downloader deploy complete ${BUILD_NUMBER}"
'''
echo '8 INFORMING END'
}
}
}
}