rollback changes

This commit is contained in:
areeqakbr 2025-02-25 10:04:56 +07:00
parent e64c275b3b
commit 39dce782c9
1 changed files with 28 additions and 62 deletions

36
Jenkinsfile vendored
View File

@ -1,28 +1,5 @@
pipeline {
agent {
kubernetes {
yaml """
apiVersion: v1
kind: Pod
spec:
containers:
- name: jnlp
image: jenkins/inbound-agent:latest
- name: docker
image: docker:latest
command:
- cat
tty: true
volumeMounts:
- name: docker-sock
mountPath: /var/run/docker.sock
volumes:
- name: docker-sock
hostPath:
path: /var/run/docker.sock
"""
}
}
agent any // Runs on an Ubuntu-based Jenkins agent
environment {
REGISTRY_URL = 'git.winteraccess.id'
@ -35,25 +12,20 @@ spec:
stages {
stage('Checkout Code') {
steps {
container('jnlp') {
git branch: 'dev', url: 'https://git.winteraccess.id/winter-access/backend_nam.git', credentialsId: "${CREDENTIALS_ID}"
}
}
}
stage('Get Short SHA') {
steps {
container('jnlp') {
script {
env.SHORT_SHA = sh(script: 'git rev-parse --short HEAD', returnStdout: true).trim()
}
}
}
}
stage('Login to Registry') {
steps {
container('docker') {
script {
withCredentials([usernamePassword(credentialsId: "${DOCKERUSRPASS}", usernameVariable: 'REGISTRY_USER', passwordVariable: 'REGISTRY_TOKEN')]) {
sh """
@ -63,11 +35,8 @@ spec:
}
}
}
}
stage('Build and Push Docker Image') {
steps {
container('docker') {
script {
def imageTag = "dev-${env.SHORT_SHA}"
sh """
@ -82,11 +51,9 @@ spec:
}
}
}
}
stage('Deploy to Kubernetes') {
steps {
container('jnlp') {
script {
withCredentials([string(credentialsId: "${KUBE_CONFIG_ID}", variable: 'KUBE_CONFIG')]) {
writeFile file: 'kubeconfig', text: KUBE_CONFIG
@ -99,7 +66,6 @@ spec:
}
}
}
}
post {
always {