Skip to content

Commit

Permalink
[feat]: Jenkinsfile (Ayudantía 3)
Browse files Browse the repository at this point in the history
  • Loading branch information
PodssilDev committed Apr 2, 2023
1 parent b6ed34d commit 3462353
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
jenkins.war
sonarqube-9.9.0.65466
pep1/data/
## Ignore Visual Studio temporary files, build results, and
Expand Down
57 changes: 57 additions & 0 deletions pep1/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
pipeline{
agent any
tools{
maven "maven"
}
stages{
stage("Build JAR File"){
steps{
checkout scmGit(branches: [[name: '*/main']], extensions: [], userRemoteConfigs: [[url: 'https://github.com/PodssilDev/ayudantias-tingeso-mingeso']])
dir("pep1"){
sh "mvn clean install"
}
}
}
stage("Test"){
steps{
dir("pep1"){
sh "mvn test"
}
}
}
stage("SonarQube Analysis"){
steps{
dir("pep1"){
sh "mvn sonar:sonar -Dsonar.projectKey=pep1 -Dsonar.host.url=http://localhost:9000 -Dsonar.login=sqp_fc56b1ba154bd3b0bf2aaa644210b01404548520"
}
}
}
stage("Build Docker Image"){
steps{
dir("pep1"){
sh "docker build -t johnserrano159/proyecto_docker ."
}
}
}
stage("Push Docker Image"){
steps{
dir("pep1"){
withCredentials([string(credentialsId: 'dckrhubpassword', variable: 'dckpass')]){
sh "docker login -u johnserrano159 -p ${dckpass}"

}
sh "docker push johnserrano159/proyecto_docker"

}

}
}
}
post{
always{
dir("pep1"){
sh "docker logout"
}
}
}
}
2 changes: 1 addition & 1 deletion sonarqube.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
mvn clean verify sonar:sonar -Dsonar.projectKey=pep1 -Dsonar.host.url=http://localhost:9000 -Dsonar.login=sqp_fc56b1ba154bd3b0bf2aaa644210b01404548520
mvn sonar:sonar -Dsonar.projectKey=pep1 -Dsonar.host.url=http://localhost:9000 -Dsonar.login=sqp_fc56b1ba154bd3b0bf2aaa644210b01404548520

0 comments on commit 3462353

Please sign in to comment.