Merge pull request 'style: format code for better readability and consistency' (#13) from develop into prod
Some checks are pending
bangararaju.kottedi.in/portfolio-admin/pipeline/head This commit looks good
bangararaju.kottedi.in/portfolio/pipeline/head Build queued...

Reviewed-on: #13
This commit is contained in:
rajukottedi 2026-03-06 12:53:22 +05:30
commit 2f7c629aa7
2 changed files with 31 additions and 58 deletions

79
Jenkinsfile vendored
View File

@ -10,6 +10,7 @@ pipeline {
stages { stages {
stage('Build & Test') { stage('Build & Test') {
agent { label getAgentLabel() } agent { label getAgentLabel() }
environment { environment {
@ -19,15 +20,11 @@ pipeline {
stages { stages {
stage('Cleanup Workspace') { stage('Cleanup Workspace') {
steps { steps { cleanWs() }
cleanWs()
}
} }
stage('Checkout') { stage('Checkout') {
steps { steps { checkout scm }
checkout scm
}
} }
stage('Inject Environment File') { stage('Inject Environment File') {
@ -40,22 +37,20 @@ pipeline {
} }
} }
steps { steps {
configFileProvider( configFileProvider([
[configFile( configFile(
fileId: getEnvFileId(), fileId: getEnvFileId(),
targetLocation: 'src/environments/environment.ts', targetLocation: 'src/environments/environment.ts',
replaceTokens: true replaceTokens: true
)] )
) { ]) {
echo "Injected environment for ${env.BRANCH_NAME}" echo "Injected environment for ${env.BRANCH_NAME}"
} }
} }
} }
stage('Install Dependencies') { stage('Install Dependencies') {
steps { steps { sh 'npm ci' }
sh 'npm ci'
}
} }
stage('Run Tests') { stage('Run Tests') {
@ -65,6 +60,7 @@ pipeline {
branch pattern: "bug/.*", comparator: "REGEXP" branch pattern: "bug/.*", comparator: "REGEXP"
branch 'develop' branch 'develop'
branch 'prod' branch 'prod'
changeRequest()
} }
} }
steps { steps {
@ -77,24 +73,20 @@ pipeline {
anyOf { anyOf {
branch 'develop' branch 'develop'
branch 'prod' branch 'prod'
changeRequest()
} }
} }
steps { steps {
sh ''' sh 'ng build --configuration production --base-href /admin/'
ng build --configuration production --base-href /admin/
'''
} }
} }
} }
} }
stage('Production Approval') { stage('Production Approval') {
when { when { branch 'prod' }
branch 'prod'
}
steps { steps {
input message: "Approve deployment to PRODUCTION?", ok: "Deploy" input message: 'Approve deployment to PRODUCTION?', ok: 'Deploy'
} }
} }
@ -128,18 +120,13 @@ pipeline {
""" """
} }
} }
} }
} }
} }
post { post {
success { success { echo "Deployment successful for ${env.BRANCH_NAME}" }
echo "Deployment successful for ${env.BRANCH_NAME}" failure { echo "Deployment failed for ${env.BRANCH_NAME}" }
}
failure {
echo "Deployment failed for ${env.BRANCH_NAME}"
}
} }
} }
@ -148,41 +135,27 @@ pipeline {
// //
def getAgentLabel() { def getAgentLabel() {
if (env.BRANCH_NAME == 'prod') { return env.BRANCH_NAME == 'prod' ? 'oracle-prod' : 'built-in'
return 'oracle-prod'
} else {
return 'built-in'
}
} }
def getEnvFileId() { def getEnvFileId() {
if (env.BRANCH_NAME == 'prod') { return env.BRANCH_NAME == 'prod' ? 'admin-prod-properties' : 'admin-uat-properties'
return 'admin-prod-properties'
} else {
return 'admin-uat-properties'
}
} }
def getDeployPath() { def getDeployPath() {
if (env.BRANCH_NAME == 'prod') { return env.BRANCH_NAME == 'prod'
return "/var/www/bangararaju.kottedi.in/admin" ? "/var/www/bangararaju.kottedi.in/admin"
} else { : "/var/www/bangararaju.kottedi.in/admin"
return "/var/www/bangararaju.kottedi.in/admin"
}
} }
def getHealthUrl() { def getHealthUrl() {
if (env.BRANCH_NAME == 'prod') { return env.BRANCH_NAME == 'prod'
return "https://bangararaju.kottedi.in/admin" ? "https://bangararaju.kottedi.in/admin"
} else { : "https://bangararaju-uat.kottedi.in/admin"
return "https://bangararaju-uat.kottedi.in/admin"
}
} }
def getChromeBin() { def getChromeBin() {
if (env.BRANCH_NAME == 'prod') { return env.BRANCH_NAME == 'prod'
return "/snap/bin/chromium" ? "/snap/bin/chromium"
} else { : "/usr/bin/chromium"
return "/usr/bin/chromium"
}
} }

View File

@ -8,12 +8,12 @@ import { provideHttpClientTesting } from '@angular/common/http/testing';
declare const beforeEach: (fn: () => void) => void; declare const beforeEach: (fn: () => void) => void;
getTestBed().initTestEnvironment( getTestBed().initTestEnvironment(
BrowserTestingModule, BrowserTestingModule,
platformBrowserTesting() platformBrowserTesting()
); );
beforeEach(() => { beforeEach(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
providers: [provideZonelessChangeDetection(), provideHttpClient(), provideHttpClientTesting()] providers: [provideZonelessChangeDetection(), provideHttpClient(), provideHttpClientTesting()]
}); });
}); });