forked from fleetman-ci-cd-demo/fleetman-webapp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
executable file
·38 lines (33 loc) · 987 Bytes
/
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
pipeline {
agent any
environment {
// You must set the following environment variables
// ORGANIZATION_NAME
// YOUR_DOCKERHUB_USERNAME (it doesn't matter if you don't have one)
SERVICE_NAME = "fleetman-webapp"
REPOSITORY_TAG="${YOUR_DOCKERHUB_USERNAME}/${ORGANIZATION_NAME}-${SERVICE_NAME}:${BUILD_ID}"
}
stages {
stage('Preparation') {
steps {
cleanWs()
git credentialsId: 'GitHub', url: "https://github.com/${ORGANIZATION_NAME}/${SERVICE_NAME}"
}
}
stage('Build') {
steps {
sh 'echo No build required for Webapp.'
}
}
stage('Build and Push Image') {
steps {
sh 'docker image build -t ${REPOSITORY_TAG} .'
}
}
stage('Deploy to Cluster') {
steps {
sh 'envsubst < ${WORKSPACE}/deploy.yaml | kubectl apply -f -'
}
}
}
}