Skip to content

Commit

Permalink
added features
Browse files Browse the repository at this point in the history
  • Loading branch information
joelwembo committed Apr 17, 2024
1 parent 4821c33 commit 599bab6
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 8 deletions.
31 changes: 26 additions & 5 deletions deployments/Jenkins/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,27 @@ pipeline{
}

}
stage('Build'){
steps {
// sh 'docker-compose down'
// sh 'docker-compose build --no-cache'
sh 'docker build -t joelwembo/cloudapp-django-web:latest --no-cache .'

stage('SonarQube Analysis') {
environment {
// Set environment variables required for SonarQube scanner
SONAR_SCANNER_HOME = tool 'SonarQube Scanner'
}
steps {
// Run SonarQube scanner
script {
withSonarQubeEnv('SonarQube Server') {
sh "${env.SONAR_SCANNER_HOME}/bin/sonar-scanner"
}
}
}
}
stage('Build'){
steps {
// sh 'docker-compose down'
// sh 'docker-compose build --no-cache'
sh 'docker build -t joelwembo/cloudapp-django-web:latest --no-cache .'
}
}
stage('Login') {
steps {
Expand All @@ -38,6 +53,12 @@ pipeline{
}
}

stage('Trivy Scan') {
steps {
sh 'trivy docker build -t joelwembo/cloudapp-django-web:latest'
}
}

stage('Docker Push') {
steps {
sh 'docker images'
Expand Down
28 changes: 25 additions & 3 deletions deployments/Jenkins/JenkinsfileTemplate
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,40 @@ pipeline{

}
stage('Build'){
steps {

sh 'docker build -t joelwembo/django_app:latest --no-cache .'
steps {
sh 'docker build -t joelwembo/django_app:latest --no-cache .'
}
}

stage('SonarQube Analysis') {
environment {
// Set environment variables required for SonarQube scanner
SONAR_SCANNER_HOME = tool 'SonarQube Scanner'
}
steps {
// Run SonarQube scanner
script {
withSonarQubeEnv('SonarQube Server') {
sh "${env.SONAR_SCANNER_HOME}/bin/sonar-scanner"
}
}
}
}

stage('Login') {
steps {
sh 'echo $DOCKERHUB_CREDENTIALS_PSW | docker login -u $DOCKERHUB_CREDENTIALS_USR --password-stdin'

}
}

stage('trivy Scan') {
steps {
sh 'trivy docker build -t joelwembo/cloudapp-django-web:latest'
}
}

stage('Docker Push') {
steps {
sh 'docker images'
Expand Down

0 comments on commit 599bab6

Please sign in to comment.