-
Notifications
You must be signed in to change notification settings - Fork 247
/
Jenkinsfile
81 lines (70 loc) · 2.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
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
#!groovy
// node {
//
// try {
// stage 'Checkout'
// checkout scm
//
// sh 'git log HEAD^..HEAD --pretty="%h %an - %s" > GIT_CHANGES'
// def lastChanges = readFile('GIT_CHANGES')
// //slackSend color: "warning", message: "Started `${env.JOB_NAME}#${env.BUILD_NUMBER}`\n\n_The changes:_\n${lastChanges}"
//
// stage 'Deploy'
// sh './deployment/deploy_prod.sh'
//
// stage 'Publish results'
// echo "Deployment successful"
// //slackSend color: "good", message: "Build successful: `${env.JOB_NAME}#${env.BUILD_NUMBER}` <${env.BUILD_URL}|Open in Jenkins>"
// }
//
// catch (err) {
// echo "Error found"
// //slackSend color: "danger", message: "Build failed :face_with_head_bandage: \n`${env.JOB_NAME}#${env.BUILD_NUMBER}` <${env.BUILD_URL}|Open in Jenkins>"
//
// throw err
// }
//
// }
// pipeline {
// agent any
//
// stages {
// stage('Checkout') {
// steps {
// git 'https://github.com/manjurulhoque/django-job-portal.git'
// }
// }
//
// stage('Build and Deploy') {
// steps {
// script {
// // navigate into the correct directory
// sh 'cd projects/django/job-portal/'
//
// // build and run docker-compose
// sh 'docker-compose -f docker-compose.prod.yml up --build -d'
// }
// }
// }
// }
// }
node {
try {
stage 'Checkout'
checkout scm
sh 'git log HEAD^..HEAD --pretty="%h %an - %s" > GIT_CHANGES'
def lastChanges = readFile('GIT_CHANGES')
//slackSend color: "warning", message: "Started `${env.JOB_NAME}#${env.BUILD_NUMBER}`\n\n_The changes:_\n${lastChanges}"
stage 'Deploy'
// sh 'cd projects/django/job-portal/'
sh './deployment/jenkins_deploy_prod_docker.sh'
stage 'Publish results'
echo "Deployment successful"
//slackSend color: "good", message: "Build successful: `${env.JOB_NAME}#${env.BUILD_NUMBER}` <${env.BUILD_URL}|Open in Jenkins>"
}
catch (err) {
echo "Error found"
//slackSend color: "danger", message: "Build failed :face_with_head_bandage: \n`${env.JOB_NAME}#${env.BUILD_NUMBER}` <${env.BUILD_URL}|Open in Jenkins>"
throw err
}
}