Compare commits
3 Commits
4989ff9883
...
2f7c629aa7
| Author | SHA1 | Date | |
|---|---|---|---|
| 2f7c629aa7 | |||
| 1864d49d6c | |||
| 37d7df2794 |
79
Jenkinsfile
vendored
79
Jenkinsfile
vendored
@ -10,6 +10,7 @@ pipeline {
|
||||
stages {
|
||||
|
||||
stage('Build & Test') {
|
||||
|
||||
agent { label getAgentLabel() }
|
||||
|
||||
environment {
|
||||
@ -19,15 +20,11 @@ pipeline {
|
||||
stages {
|
||||
|
||||
stage('Cleanup Workspace') {
|
||||
steps {
|
||||
cleanWs()
|
||||
}
|
||||
steps { cleanWs() }
|
||||
}
|
||||
|
||||
stage('Checkout') {
|
||||
steps {
|
||||
checkout scm
|
||||
}
|
||||
steps { checkout scm }
|
||||
}
|
||||
|
||||
stage('Inject Environment File') {
|
||||
@ -40,22 +37,20 @@ 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') {
|
||||
@ -65,6 +60,7 @@ pipeline {
|
||||
branch pattern: "bug/.*", comparator: "REGEXP"
|
||||
branch 'develop'
|
||||
branch 'prod'
|
||||
changeRequest()
|
||||
}
|
||||
}
|
||||
steps {
|
||||
@ -77,24 +73,20 @@ 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'
|
||||
}
|
||||
}
|
||||
|
||||
@ -128,18 +120,13 @@ 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}" }
|
||||
}
|
||||
}
|
||||
|
||||
@ -148,41 +135,27 @@ pipeline {
|
||||
//
|
||||
|
||||
def getAgentLabel() {
|
||||
if (env.BRANCH_NAME == 'prod') {
|
||||
return 'oracle-prod'
|
||||
} else {
|
||||
return 'built-in'
|
||||
}
|
||||
return env.BRANCH_NAME == 'prod' ? 'oracle-prod' : 'built-in'
|
||||
}
|
||||
|
||||
def getEnvFileId() {
|
||||
if (env.BRANCH_NAME == 'prod') {
|
||||
return 'admin-prod-properties'
|
||||
} else {
|
||||
return 'admin-uat-properties'
|
||||
}
|
||||
return env.BRANCH_NAME == 'prod' ? 'admin-prod-properties' : '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"
|
||||
}
|
||||
return env.BRANCH_NAME == 'prod'
|
||||
? "/var/www/bangararaju.kottedi.in/admin"
|
||||
: "/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"
|
||||
}
|
||||
return env.BRANCH_NAME == 'prod'
|
||||
? "https://bangararaju.kottedi.in/admin"
|
||||
: "https://bangararaju-uat.kottedi.in/admin"
|
||||
}
|
||||
|
||||
def getChromeBin() {
|
||||
if (env.BRANCH_NAME == 'prod') {
|
||||
return "/snap/bin/chromium"
|
||||
} else {
|
||||
return "/usr/bin/chromium"
|
||||
}
|
||||
return env.BRANCH_NAME == 'prod'
|
||||
? "/snap/bin/chromium"
|
||||
: "/usr/bin/chromium"
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user