Skip to content

Feature #132

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 31 commits into
base: local
Choose a base branch
from
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
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Use official Tomcat base image
FROM tomcat:9.0

# Remove default webapps (optional)
RUN rm -rf /usr/local/tomcat/webapps/*

# Copy your WAR file into the webapps directory
COPY **/*.war /usr/local/tomcat/webapps/ROOT.war

# Expose the default Tomcat port
EXPOSE 8080

# Start Tomcat
CMD ["catalina.sh", "run"]
83 changes: 83 additions & 0 deletions jenkinsfile1
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
pipeline
{
agent any
tools{
maven "MAVEN_HOME"
jdk "JAVA-17"
}
environment{
GIT_URL="https://github.com/DevopsTech12/vprofile-project.git"
ECR_REPO = "https://279684396313.dkr.ecr.ap-south-1.amazonaws.com/vprofileapp"
IMAGE_NAME = 'vprofileapp'
}
stages{
stage("scm chekout")
{
steps{ git branch: 'local', url: "$GIT_URL" }
}
stage("test")
{
steps{sh 'mvn test'}
}
stage("build artifact")
{
steps{sh 'mvn package -Dskiptest'}
post{
success{
echo "archiving artifact"
sleep 10
archiveArtifacts artifacts: '**/*.war'
}
}
}
stage("checkstyle checks")
{
steps{sh 'mvn checkstyle:checkstyle'}
}

// stage("sonar qube analysis")
// {
// steps{ withSonarQubeEnv(credentialsId: 'SonarToken', installationName: 'SonarServer') {
// sh 'mvn sonar:sonar'
//}}
stage('docker image build')
{
steps {
script {
dockerImage = docker.build("${IMAGE_NAME}:latest")
}
}
}
stage ('push image to ECR')
{
steps{
// This step should not normally be used in your script. Consult the inline help for details.
withDockerRegistry(credentialsId: 'ecr:ap-south-1:ecrcred', url: "${ECR_REPO}") {
sh "docker push ${IMAGE_NAME}:latest"
//sh "docker push ${ECR_REPO}:latest"
}
// sh "docker push ${ECR_REPO}:latest"
}
}
}

post {
success {
slackSend channel: '#devops',
color: '#439FE0',
message: "✅ *Build SUCCESS* for Job: `${env.JOB_NAME}` Build: #${env.BUILD_NUMBER}\n<${env.BUILD_URL}|Open Build>",
teamDomain: 'vbtech-workspace',
tokenCredentialId: 'Slack-Jenkins'

}
failure {
slackSend channel: '#devops',
color: '#FF0000',
message: "❌ *Build FAILED* for Job: `${env.JOB_NAME}` Build: #${env.BUILD_NUMBER}\n<${env.BUILD_URL}|Check Console>",
teamDomain: 'vbtech-workspace',
tokenCredentialId: 'Slack-Jenkins'

}
}
}

28 changes: 28 additions & 0 deletions jenkinsfile2
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
pipeline{
agent any
tools {
maven 'MAVEN_HOME'
java 'JAVA_HOME'
}
environment{
GIT_URL="https://github.com/DevopsTech12/vprofile-project.git"

}
stages{
stage('scm checkout')
steps{git branch: 'local', url: "$GIT_URL"
}
stage('Testing')
steps{sh 'mvn test'

}
stage('build artifact')
steps{sh 'mvn clean package -Dskiptest'}
post{
success{slackSend channel: '#artifact', message: '"✅ *Artifact build* for Job: `${env.JOB_NAME}` Build: #${env.BUILD_NUMBER}\\n<${env.BUILD_URL}|Open Build>"', teamDomain: 'vbtech-workspace', tokenCredentialId: 'artifact-slack-jenkins'

}
}

}
}
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,11 @@
<artifactId>maven-war-plugin</artifactId>
<version>3.4.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.1.2</version>
</plugin>
<!-- JaCoCo Plugin -->
<plugin>
<groupId>org.jacoco</groupId>
Expand Down