Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 9 additions & 39 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pipeline {
environment {
APP_NAME = "register-app-pipeline"
RELEASE = "1.0.0"
DOCKER_USER = "ashfaque9x"
DOCKER_USER = "ziedbrah1"
DOCKER_PASS = 'dockerhub'
IMAGE_NAME = "${DOCKER_USER}" + "/" + "${APP_NAME}"
IMAGE_TAG = "${RELEASE}-${BUILD_NUMBER}"
Expand All @@ -22,7 +22,7 @@ pipeline {

stage("Checkout from SCM"){
steps {
git branch: 'main', credentialsId: 'github', url: 'https://github.com/Ashfaque-9x/register-app'
git branch: 'main', credentialsId: 'github', url: 'https://github.com/ziedbrah-source/register-app'
}
}

Expand All @@ -38,27 +38,12 @@ pipeline {
sh "mvn test"
}
}

stage("SonarQube Analysis"){
stage("SonarQube"){
steps {
script {
withSonarQubeEnv(credentialsId: 'jenkins-sonarqube-token') {
sh "mvn sonar:sonar"
}
}
sh 'sleep 20'
}
}

stage("Quality Gate"){
steps {
script {
waitForQualityGate abortPipeline: false, credentialsId: 'jenkins-sonarqube-token'
}
}

}

stage("Build & Push Docker Image") {
stage("Build & Push Docker Image") {
steps {
script {
docker.withRegistry('',DOCKER_PASS) {
Expand All @@ -73,15 +58,13 @@ pipeline {
}

}

stage("Trivy Scan") {
steps {
script {
sh ('docker run -v /var/run/docker.sock:/var/run/docker.sock aquasec/trivy image ashfaque9x/register-app-pipeline:latest --no-progress --scanners vuln --exit-code 0 --severity HIGH,CRITICAL --format table')
sh ('docker run -v /var/run/docker.sock:/var/run/docker.sock aquasec/trivy image ziedbrah1/register-app-pipeline:latest --no-progress --scanners vuln --exit-code 0 --severity HIGH,CRITICAL --format table')
}
}
}

stage ('Cleanup Artifacts') {
steps {
script {
Expand All @@ -90,26 +73,13 @@ pipeline {
}
}
}

stage("Trigger CD Pipeline") {
stage("Trigger CD Pipeline") {
steps {
script {
sh "curl -v -k --user clouduser:${JENKINS_API_TOKEN} -X POST -H 'cache-control: no-cache' -H 'content-type: application/x-www-form-urlencoded' --data 'IMAGE_TAG=${IMAGE_TAG}' 'ec2-13-232-128-192.ap-south-1.compute.amazonaws.com:8080/job/gitops-register-app-cd/buildWithParameters?token=gitops-token'"
sh "curl -v -k --user clouduser:${JENKINS_API_TOKEN} -X POST -H 'cache-control: no-cache' -H 'content-type: application/x-www-form-urlencoded' --data 'IMAGE_TAG=${IMAGE_TAG}' 'ec2-51-20-253-164.eu-north-1.compute.amazonaws.com:8080/job/gitops-register-app-cd/buildWithParameters?token=gitops-token'"
}
}
}
}

post {
failure {
emailext body: '''${SCRIPT, template="groovy-html.template"}''',
subject: "${env.JOB_NAME} - Build # ${env.BUILD_NUMBER} - Failed",
mimeType: 'text/html',to: "ashfaque.s510@gmail.com"
}
success {
emailext body: '''${SCRIPT, template="groovy-html.template"}''',
subject: "${env.JOB_NAME} - Build # ${env.BUILD_NUMBER} - Successful",
mimeType: 'text/html',to: "ashfaque.s510@gmail.com"
}
}
}
}
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
register-app
<br>
Test93

## This ia an app for registration, it s a mock application
Binary file added server/target/classes/com/example/Greeter.class
Binary file not shown.
Binary file not shown.
7 changes: 5 additions & 2 deletions webapp/src/main/webapp/index.jsp
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<form action="action_page.php">
<div class="container">
<h1>New user Register for DevOps Learning at Virtual TechBox Youtube Channel</h1>

<h1>Hello madame Salouaa</h1>
<h1>TEST 3</h1>
<h1>New user Register</h1>
<p>Please fill in this form to create an account.</p>
<hr>

Expand Down Expand Up @@ -33,6 +36,6 @@

<h1> Thank You </h1>
<br>
<h1> Happy Learning. See You Again. </h1>
<h1> Haya salem </h1>

</form>