-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
39 lines (39 loc) · 1.48 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
pipeline {
agent any
environment{
ACR_CRED = credentials('acr_creds')
}
stages {
stage('ACR Login') {
steps{
sh 'docker login devops2022.azurecr.io -u $ACR_CRED_USR -p $ACR_CRED_PSW'
}
}
stage('Image Building') {
steps {
sh 'docker build -t devops2022.azurecr.io/romanm:$GIT_COMMIT .'
sh 'docker push devops2022.azurecr.io/romanm:$GIT_COMMIT'
sh 'docker rmi devops2022.azurecr.io/romanm:$GIT_COMMIT'
}
}
stage('Deploy') {
agent {
docker {
image 'alpine/k8s:1.23.16'
}
}
environment{
KUB_CONF = credentials('k8s_config')
}
steps{
// sh 'kubectl --kubeconfig=$KUB_CONF delete namespace romank8s'
// sh 'kubectl --kubeconfig=$KUB_CONF create namespace romank8s'
// sh 'echo $KUB_CONF'
sh 'kubectl --kubeconfig=$KUB_CONF apply -f rmnspace.yml -n romank8s'
sh 'kubectl --kubeconfig=$KUB_CONF apply -f rmndeployment.yml -n romank8s'
// sh 'kubectl --kubeconfig=$KUB_CONF get namespaces'
sh 'kubectl --kubeconfig=$KUB_CONF set image -n romank8s deployment/romank8s romank8s=devops2022.azurecr.io/romanm:$GIT_COMMIT'
}
}
}
}