-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile-ci
More file actions
82 lines (71 loc) · 2.37 KB
/
Jenkinsfile-ci
File metadata and controls
82 lines (71 loc) · 2.37 KB
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
pipeline {
environment {
repository = "dls3145/camandedit"
// DOCKERHUB_CREDENTIALS = credentials('docker-hun-jo')
dockerImage = ""
dockerTag = "0"
SLACK_NAME = "camandedit"
SLACK_TOKEN = "slack-noti-key"
SLACK_CHANNEL = "#jenkins-ci"
}
agent any
stages {
stage("prepare"){
steps {
git branch : "${ghprbSourceBranch}",
credentialsId : "jenkins-pk",
url: "git@github.com:TeamDiligence/CamAndEdit_Back.git"
sh "pwd"
sh "cat $HOME/envfile/.env > .production.env"
}
post {
success {
echo "prepare Success"
sh "ls -al"
}
failure {
echo "prepare fail!"
}
}
}
stage("docker build"){
steps {
script {
sh "echo 'docker build' "
dockerImage = docker.build repository + ":$dockerTag"
}
}
post {
success {
echo "docker build Success"
}
failure {
echo "docker build faile"
}
}
}
stage("docker clean up"){
steps {
script {
sh "docker rmi -f $repository:$dockerTag"
}
}
post {
success {
echo "docker clean Up Success"
}
failure {
echo "docker cleanUp faile"
}
}
}
}
post {
success {
slackSend (channel: SLACK_CHANNEL, color: "#33FF33", message: "PullRequestSuccess \n [Title]:[${ghprbPullTitle}] [developer: ${ghprbPullAuthorLogin}] \n Link: ${ghprbPullLink}", teamDomain: SLACK_NAME, tokenCredentialId: SLACK_TOKEN)
}
failure {
slackSend (channel: SLACK_CHANNEL, color: "#FF0000", message: "PullRequestFail \n [Title]:[${ghprbPullTitle}] [developer: ${ghprbPullAuthorLogin}] \n Link: ${ghprbPullLink}", teamDomain: SLACK_NAME, tokenCredentialId: SLACK_TOKEN)
}
}
}