Compare commits

..

5 Commits

Author SHA1 Message Date
094cac3b92 Merge pull request 'develop' (#11) from develop into prod
Some checks reported errors
bangararaju.kottedi.in/portfolio-admin/pipeline/head Something is wrong with the build of this commit
Reviewed-on: #11
2026-03-06 07:58:07 +05:30
f33bf8cd01 fix: remove unnecessary backticks from Jenkinsfile
Some checks are pending
bangararaju.kottedi.in/portfolio-admin/pipeline/head This commit looks good
bangararaju.kottedi.in/portfolio-admin/pipeline/pr-prod Build queued...
2026-03-06 07:33:38 +05:30
85fe20d0f3 fix: remove unnecessary backticks from Jenkinsfile
Some checks failed
bangararaju.kottedi.in/portfolio-admin/pipeline/head There was a failure building this commit
2026-03-06 07:31:42 +05:30
8de5d29a4d refactor: reorganize Jenkinsfile stages and improve environment variable handling
Some checks failed
bangararaju.kottedi.in/portfolio-admin/pipeline/head There was a failure building this commit
2026-03-06 07:16:33 +05:30
17d2289974 fix: correct agent label for production environment in Jenkinsfile
All checks were successful
bangararaju.kottedi.in/admin/admin-uat/pipeline/head This commit looks good
2026-02-16 20:35:22 +05:30

77
Jenkinsfile vendored
View File

@ -4,87 +4,110 @@ pipeline {
options {
buildDiscarder(logRotator(numToKeepStr: '10'))
}
environment {
DEPLOY_PATH = getDeployPath()
ENV_FILE_ID = getEnvFileId()
TARGET_URL = getHealthUrl()
disableConcurrentBuilds()
}
stages {
stage('Checkout') {
stage('Build') {
agent { label getAgentLabel() }
stages {
stage('Cleanup Workspace') {
steps {
cleanWs()
}
}
stage('Checkout') {
steps {
checkout scm
}
}
stage('Inject Environment File') {
agent { label getAgentLabel() }
steps {
configFileProvider(
[configFile(
fileId: ENV_FILE_ID,
fileId: getEnvFileId(),
targetLocation: 'src/environments/environment.ts',
replaceTokens: true
)]
) {
echo "Environment file injected for ${env.BRANCH_NAME}"
echo "Injected environment for ${env.BRANCH_NAME}"
}
}
}
stage('Build Angular') {
agent { label getAgentLabel() }
stage('Install & Build') {
steps {
sh '''
npm install
npm ci
ng build --configuration production --base-href /admin/
'''
}
}
}
}
// 🚨 Production Approval Gate
stage('Production Approval') {
when {
branch 'prod'
}
steps {
input message: "Approve deployment to PRODUCTION?", ok: "Deploy"
}
}
stage('Deploy & Verify') {
agent { label getAgentLabel() }
stages {
stage('Deploy') {
agent { label getAgentLabel() }
steps {
sh '''
rm -rf $DEPLOY_PATH/*
cp -r dist/portfolio-admin/browser/* $DEPLOY_PATH/
sh """
rsync -av --delete dist/portfolio-admin/browser/ ${getDeployPath()}/
sudo /usr/bin/systemctl reload nginx
'''
"""
}
}
stage('Health Check') {
agent { label getAgentLabel() }
steps {
sh """
sleep 2
curl -f ${TARGET_URL}
sleep 3
curl -f ${getHealthUrl()}
"""
}
}
}
}
}
post {
failure {
echo "Deployment failed!"
}
success {
echo "Deployment successful!"
echo "✅ Deployment successful for ${env.BRANCH_NAME}"
}
failure {
echo "❌ Deployment failed for ${env.BRANCH_NAME}"
}
}
}
//
// -------- Helper Methods --------
//
def getAgentLabel() {
if (env.BRANCH_NAME == 'prod') {
return 'oracle-node'
return 'oracle-prod'
} else {
return 'built-in' // for develop
return 'built-in'
}
}