Commit cfc1dab6 authored by apuy's avatar apuy

Add new file

parent 8d0ef38f
pipeline {
agent any
environment {
datedeploy = sh( script: "date +%d%m%Y", returnStdout: true ).trim()
datebckp = sh( script: "date +%Y-%m-%d-%H:%M", returnStdout: true ).trim()
tagname = "RC.${datedeploy}-${env.BUILD_NUMBER}-UAT"
appsName = "dms-aftersales-mobile"
gitBranch = "$gitBranch"
AWS_REGION = 'ap-southeast-3'
ECR_REGISTRY = '689978033173.dkr.ecr.ap-southeast-3.amazonaws.com'
registry = '689978033173.dkr.ecr.ap-southeast-3.amazonaws.com/ddms/$appsName'
gitUrl = 'http://103.44.149.204/s.pramana/dms-aftersales-app.git'
kubeuat = 'kubectl --context=staging'
}
tools {
jdk "jdk8"
}
stages {
stage('Debug') {
steps {
sh 'echo "Branch: $gitlabBranch"'
sh 'git branch -a'
}
}
stage('Login to ECR') {
steps {
sh '''
aws --version
aws ecr get-login-password --region ${AWS_REGION} \
| docker login --username AWS --password-stdin ${ECR_REGISTRY}
'''
}
}
stage('Build & Deploy Image to ali') {
steps{
script {
sh "docker buildx build -t ${registry}:${tagname} --push . "
}
}
}
stage('Triggering Kubernetes') {
steps{
script {
echo "uat-b"
sh "${kubeuat} set image deploy/${appsName} ${appsName}=${registry}:${tagname} -n uat-b"
}
}
}
}
post {
always {
deleteDir()
sh """
curl -s -X POST https://api.telegram.org/bot7250753069:AAGoB4-D0tu0t62u9NvUVSE2JUP6PHWzyzA/sendMessage -d chat_id=-4752319604 -d parse_mode="HTML" -d text=" \
<b>Job Name</b> : ${env.JOB_NAME} \n <b>Deploy</b>: AWS \n <b>Branch</b>: ${gitlabBranch} \n <b>Build </b> : ${env.BUILD_NUMBER} \n <b>Result</b> : ${currentBuild.currentResult} \n <b>Triggered by</b>: ${gitlabUserName} \n <b>Url</b> : ${env.BUILD_URL}"
"""
}
success {
echo "Release Success"
}
failure {
echo "Release Failed"
}
cleanup {
echo "Clean up in post work space"
cleanWs()
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment