Update Jenkinsfile
Some checks failed
ecommerce-backend/pipeline/head There was a failure building this commit
Some checks failed
ecommerce-backend/pipeline/head There was a failure building this commit
This commit is contained in:
8
Jenkinsfile
vendored
8
Jenkinsfile
vendored
@@ -4,7 +4,6 @@ pipeline {
|
||||
environment {
|
||||
HARBOR = 'harbor.myriadcara.com'
|
||||
IMAGE = 'harbor.myriadcara.com/vaishnavi-ecommerce/backend'
|
||||
SONAR_HOST = 'https://sonarqube.myriadcara.com'
|
||||
SONAR_PROJECT = 'ecommerce'
|
||||
VERSION_FILE = '/var/jenkins_home/vaishnavi-backend-version.txt'
|
||||
}
|
||||
@@ -20,15 +19,12 @@ pipeline {
|
||||
} else {
|
||||
version = '1.0.0'
|
||||
}
|
||||
|
||||
def parts = version.tokenize('.')
|
||||
def major = parts[0].toInteger()
|
||||
def minor = parts[1].toInteger()
|
||||
def patch = parts[2].toInteger() + 1
|
||||
|
||||
def newVersion = "${major}.${minor}.${patch}"
|
||||
writeFile file: VERSION_FILE, text: newVersion
|
||||
|
||||
env.TAG = newVersion
|
||||
echo "🏷️ New image tag: v${env.TAG}"
|
||||
}
|
||||
@@ -37,7 +33,7 @@ pipeline {
|
||||
|
||||
stage('SonarQube Scan') {
|
||||
steps {
|
||||
withSonarQubeEnv('SonarQube') {
|
||||
withSonarQubeEnv('SonarQube') { // 'SonarQube' must match Jenkins config name
|
||||
withCredentials([string(
|
||||
credentialsId: 'sonarqube-token',
|
||||
variable: 'SONAR_TOKEN'
|
||||
@@ -47,7 +43,7 @@ pipeline {
|
||||
-Dsonar.projectKey=${SONAR_PROJECT} \
|
||||
-Dsonar.projectName=${SONAR_PROJECT} \
|
||||
-Dsonar.sources=. \
|
||||
-Dsonar.login=\$SONAR_TOKEN \
|
||||
-Dsonar.token=\$SONAR_TOKEN \
|
||||
-Dsonar.projectVersion=${env.TAG}
|
||||
"""
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user