-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathJenkinsfileDev
37 lines (34 loc) · 1.17 KB
/
JenkinsfileDev
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
pipeline {
agent any
stages {
stage('Build project') {
steps {
dir ('contact-backend') {
sh 'pwd'
sh 'ls -l'
sh 'gradle build'
}
}
}
stage('Build image') {
steps {
withCredentials([usernamePassword(credentialsId: 'docker-registry', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {
sh ' echo "$PASSWORD" | docker login --username=$USERNAME --password-stdin'
echo "Step 1: Build Docker image"
dir ('contact-backend') {
sh 'docker build -t glgelopfalcon/k8s_contactbe:${BUILD_NUMBER} .'
echo "Step 2: Push image"
sh 'docker push glgelopfalcon/k8s_contactbe:${BUILD_NUMBER}'
}
}
}
}
stage('build') {
steps {
sh 'kubectl config view'
sh 'sudo kubectl config set-context $(kubectl config current-context) --namespace development'
sh 'sudo kubectl apply -f kube-deployment_be.yml'
}
}
}
}