Compare commits
No commits in common. "2f7c629aa79202652e04d38e5c89b1a1bc6f2e91" and "4989ff9883945a4d6b0e93fd966cc4f74a2783aa" have entirely different histories.
2f7c629aa7
...
4989ff9883
79
Jenkinsfile
vendored
79
Jenkinsfile
vendored
@ -10,7 +10,6 @@ pipeline {
|
||||
stages {
|
||||
|
||||
stage('Build & Test') {
|
||||
|
||||
agent { label getAgentLabel() }
|
||||
|
||||
environment {
|
||||
@ -20,11 +19,15 @@ pipeline {
|
||||
stages {
|
||||
|
||||
stage('Cleanup Workspace') {
|
||||
steps { cleanWs() }
|
||||
steps {
|
||||
cleanWs()
|
||||
}
|
||||
}
|
||||
|
||||
stage('Checkout') {
|
||||
steps { checkout scm }
|
||||
steps {
|
||||
checkout scm
|
||||
}
|
||||
}
|
||||
|
||||
stage('Inject Environment File') {
|
||||
@ -37,20 +40,22 @@ pipeline {
|
||||
}
|
||||
}
|
||||
steps {
|
||||
configFileProvider([
|
||||
configFile(
|
||||
configFileProvider(
|
||||
[configFile(
|
||||
fileId: getEnvFileId(),
|
||||
targetLocation: 'src/environments/environment.ts',
|
||||
replaceTokens: true
|
||||
)
|
||||
]) {
|
||||
)]
|
||||
) {
|
||||
echo "Injected environment for ${env.BRANCH_NAME}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Install Dependencies') {
|
||||
steps { sh 'npm ci' }
|
||||
steps {
|
||||
sh 'npm ci'
|
||||
}
|
||||
}
|
||||
|
||||
stage('Run Tests') {
|
||||
@ -60,7 +65,6 @@ pipeline {
|
||||
branch pattern: "bug/.*", comparator: "REGEXP"
|
||||
branch 'develop'
|
||||
branch 'prod'
|
||||
changeRequest()
|
||||
}
|
||||
}
|
||||
steps {
|
||||
@ -73,20 +77,24 @@ pipeline {
|
||||
anyOf {
|
||||
branch 'develop'
|
||||
branch 'prod'
|
||||
changeRequest()
|
||||
}
|
||||
}
|
||||
steps {
|
||||
sh 'ng build --configuration production --base-href /admin/'
|
||||
sh '''
|
||||
ng build --configuration production --base-href /admin/
|
||||
'''
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
stage('Production Approval') {
|
||||
when { branch 'prod' }
|
||||
when {
|
||||
branch 'prod'
|
||||
}
|
||||
steps {
|
||||
input message: 'Approve deployment to PRODUCTION?', ok: 'Deploy'
|
||||
input message: "Approve deployment to PRODUCTION?", ok: "Deploy"
|
||||
}
|
||||
}
|
||||
|
||||
@ -120,13 +128,18 @@ pipeline {
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
post {
|
||||
success { echo "Deployment successful for ${env.BRANCH_NAME}" }
|
||||
failure { echo "Deployment failed for ${env.BRANCH_NAME}" }
|
||||
success {
|
||||
echo "Deployment successful for ${env.BRANCH_NAME}"
|
||||
}
|
||||
failure {
|
||||
echo "Deployment failed for ${env.BRANCH_NAME}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -135,27 +148,41 @@ pipeline {
|
||||
//
|
||||
|
||||
def getAgentLabel() {
|
||||
return env.BRANCH_NAME == 'prod' ? 'oracle-prod' : 'built-in'
|
||||
if (env.BRANCH_NAME == 'prod') {
|
||||
return 'oracle-prod'
|
||||
} else {
|
||||
return 'built-in'
|
||||
}
|
||||
}
|
||||
|
||||
def getEnvFileId() {
|
||||
return env.BRANCH_NAME == 'prod' ? 'admin-prod-properties' : 'admin-uat-properties'
|
||||
if (env.BRANCH_NAME == 'prod') {
|
||||
return 'admin-prod-properties'
|
||||
} else {
|
||||
return 'admin-uat-properties'
|
||||
}
|
||||
}
|
||||
|
||||
def getDeployPath() {
|
||||
return env.BRANCH_NAME == 'prod'
|
||||
? "/var/www/bangararaju.kottedi.in/admin"
|
||||
: "/var/www/bangararaju.kottedi.in/admin"
|
||||
if (env.BRANCH_NAME == 'prod') {
|
||||
return "/var/www/bangararaju.kottedi.in/admin"
|
||||
} else {
|
||||
return "/var/www/bangararaju.kottedi.in/admin"
|
||||
}
|
||||
}
|
||||
|
||||
def getHealthUrl() {
|
||||
return env.BRANCH_NAME == 'prod'
|
||||
? "https://bangararaju.kottedi.in/admin"
|
||||
: "https://bangararaju-uat.kottedi.in/admin"
|
||||
if (env.BRANCH_NAME == 'prod') {
|
||||
return "https://bangararaju.kottedi.in/admin"
|
||||
} else {
|
||||
return "https://bangararaju-uat.kottedi.in/admin"
|
||||
}
|
||||
}
|
||||
|
||||
def getChromeBin() {
|
||||
return env.BRANCH_NAME == 'prod'
|
||||
? "/snap/bin/chromium"
|
||||
: "/usr/bin/chromium"
|
||||
if (env.BRANCH_NAME == 'prod') {
|
||||
return "/snap/bin/chromium"
|
||||
} else {
|
||||
return "/usr/bin/chromium"
|
||||
}
|
||||
}
|
||||
10
src/test.ts
10
src/test.ts
@ -8,12 +8,12 @@ import { provideHttpClientTesting } from '@angular/common/http/testing';
|
||||
declare const beforeEach: (fn: () => void) => void;
|
||||
|
||||
getTestBed().initTestEnvironment(
|
||||
BrowserTestingModule,
|
||||
platformBrowserTesting()
|
||||
BrowserTestingModule,
|
||||
platformBrowserTesting()
|
||||
);
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [provideZonelessChangeDetection(), provideHttpClient(), provideHttpClientTesting()]
|
||||
});
|
||||
TestBed.configureTestingModule({
|
||||
providers: [provideZonelessChangeDetection(), provideHttpClient(), provideHttpClientTesting()]
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user