Compare commits

..

No commits in common. "3be0d38cf1bd08a42ae37c3ffcafc8642b788190" and "7cf7246abd2aeccab49084d9977af5ce55646c06" have entirely different histories.

62
Jenkinsfile vendored
View File

@ -1,43 +1,35 @@
pipeline {
agent none
agent { label 'built-in' }
options {
buildDiscarder(logRotator(numToKeepStr: '10'))
}
environment {
DEPLOY_PATH = getDeployPath()
ENV_FILE_ID = getEnvFileId()
TARGET_URL = getHealthUrl()
DEPLOY_PATH = "/var/www/bangararaju.kottedi.in/admin"
}
stages {
stage('Checkout') {
agent { label getAgentLabel() }
steps {
checkout scm
}
}
stage('Inject Environment File') {
agent { label getAgentLabel() }
steps {
configFileProvider(
[configFile(
fileId: ENV_FILE_ID,
targetLocation: 'src/environments/environment.ts',
replaceTokens: true
)]
[configFile(fileId: 'admin-uat-properties',
targetLocation: 'src/environments/environment.ts',
replaceTokens: true)]
) {
echo "Environment file injected for ${env.BRANCH_NAME}"
echo "Environment file injected"
}
}
}
stage('Build Angular') {
agent { label getAgentLabel() }
steps {
sh '''
npm install
@ -47,7 +39,6 @@ pipeline {
}
stage('Deploy') {
agent { label getAgentLabel() }
steps {
sh '''
rm -rf $DEPLOY_PATH/*
@ -58,12 +49,11 @@ pipeline {
}
stage('Health Check') {
agent { label getAgentLabel() }
steps {
sh """
sh '''
sleep 2
curl -f ${TARGET_URL}
"""
curl -f https://bangararaju-uat.kottedi.in/admin
'''
}
}
}
@ -77,37 +67,3 @@ pipeline {
}
}
}
// -------- Helper Methods --------
def getAgentLabel() {
if (env.BRANCH_NAME == 'prod') {
return 'oracle-node'
} else {
return 'built-in' // for develop
}
}
def getEnvFileId() {
if (env.BRANCH_NAME == 'prod') {
return 'admin-prod-properties'
} else {
return 'admin-uat-properties'
}
}
def getDeployPath() {
if (env.BRANCH_NAME == 'prod') {
return "/var/www/bangararaju.kottedi.in/admin"
} else {
return "/var/www/bangararaju.kottedi.in/admin"
}
}
def getHealthUrl() {
if (env.BRANCH_NAME == 'prod') {
return "https://bangararaju.kottedi.in/admin"
} else {
return "https://bangararaju-uat.kottedi.in/admin"
}
}