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
103 changes: 25 additions & 78 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,88 +1,35 @@
pipeline {
triggers {
pollSCM('* * * * *')
}
agent any
agent any
tools {
maven 'M2_HOME'
}
environment {
registry = '076892551558.dkr.ecr.us-east-1.amazonaws.com/jenkins'
registryCredential = 'jenkins-ecr'
dockerimage = ''

NEXUS_VERSION = "nexus3"
NEXUS_PROTOCOL = "http"
NEXUS_URL = "139.177.192.139:8081"
NEXUS_REPOSITORY = "utrains-nexus-pipeline"
NEXUS_CREDENTIAL_ID = "nexus-user-credentials"
POM_VERSION = ''
}
maven 'M2_HOME'
}
stages {

stage("build & SonarQube analysis") {
steps {
echo 'build & SonarQube analysis...'
withSonarQubeEnv('SonarServer') {
sh 'mvn verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=kserge2001_geolocation -X'
}
}
}
stage('Check Quality Gate') {
steps {
echo 'Checking quality gate...'
script {
timeout(time: 20, unit: 'MINUTES') {
def qg = waitForQualityGate()
if (qg.status != 'OK') {
error "Pipeline stopped because of quality gate status: ${qg.status}"
}
}
}
}
}


stage('maven package') {
steps {
sh 'mvn clean'
sh 'mvn package -DskipTests'
}
}
stage('Build Image') {

steps {
script{
def mavenPom = readMavenPom file: 'pom.xml'
POM_VERSION = "${mavenPom.version}"
echo "${POM_VERSION}"
dockerImage = docker.build registry + ":${POM_VERSION}"
}
}
}
stage('push image') {
stage("maven build") {
steps{
script{
docker.withRegistry("https://"+registry,"ecr:us-east-1:"+registryCredential) {
dockerImage.push()
}
}
sh 'mvn clean install package'
}
}

// Project Helm Chart push as tgz file
stage("pushing the Backend helm charts to nexus"){
}
stage("upload artifact") {
steps{
script{
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId:'nexus-pass', usernameVariable: 'jenkins-user', passwordVariable: 'docker_pass']]) {
def mavenPom = readMavenPom file: 'pom.xml'
POM_VERSION = "${mavenPom.version}"
sh "echo ${POM_VERSION}"
sh "tar -czvf app-${POM_VERSION}.tgz app/"
sh "curl -u jenkins-user:$docker_pass http://139.177.192.139:8081/repository/geolocation/ --upload-file app-${POM_VERSION}.tgz -v"
}
}
def mavenPom = readMavenPom file: 'pom.xml'
nexusArtifactUploader artifacts:
[[artifactId: "${mavenPom.artifactid}",
classifier: '',
file: "target/${mavenPom.artifactid}-${mavenPom.version}.${mavenPom.packaging}",
type: "${mavenPom.packaging}"]],
credentialsId: 'Nexusid',
groupId: "${mavenPom.groupid}",
nexusUrl: '69.164.206.106:8081',
nexusVersion: 'nexus3',
protocol: 'http',
repository: 'Biomedical',
version: "${mavenPom.version}"
}
}
}

}

}
}
}
88 changes: 88 additions & 0 deletions Jenkinsfile_bckup
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
pipeline {
triggers {
pollSCM('* * * * *')
}
agent any
tools {
maven 'M2_HOME'
}
environment {
registry = '076892551558.dkr.ecr.us-east-1.amazonaws.com/jenkins'
registryCredential = 'jenkins-ecr'
dockerimage = ''

NEXUS_VERSION = "nexus3"
NEXUS_PROTOCOL = "http"
NEXUS_URL = "139.177.192.139:8081"
NEXUS_REPOSITORY = "utrains-nexus-pipeline"
NEXUS_CREDENTIAL_ID = "nexus-user-credentials"
POM_VERSION = ''
}
stages {

stage("build & SonarQube analysis") {
steps {
echo 'build & SonarQube analysis...'
withSonarQubeEnv('SonarServer') {
sh 'mvn verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=kserge2001_geolocation -X'
}
}
}
stage('Check Quality Gate') {
steps {
echo 'Checking quality gate...'
script {
timeout(time: 20, unit: 'MINUTES') {
def qg = waitForQualityGate()
if (qg.status != 'OK') {
error "Pipeline stopped because of quality gate status: ${qg.status}"
}
}
}
}
}


stage('maven package') {
steps {
sh 'mvn clean'
sh 'mvn package -DskipTests'
}
}
stage('Build Image') {

steps {
script{
def mavenPom = readMavenPom file: 'pom.xml'
POM_VERSION = "${mavenPom.version}"
echo "${POM_VERSION}"
dockerImage = docker.build registry + ":${POM_VERSION}"
}
}
}
stage('push image') {
steps{
script{
docker.withRegistry("https://"+registry,"ecr:us-east-1:"+registryCredential) {
dockerImage.push()
}
}
}
}

// Project Helm Chart push as tgz file
stage("pushing the Backend helm charts to nexus"){
steps{
script{
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId:'nexus-pass', usernameVariable: 'jenkins-user', passwordVariable: 'docker_pass']]) {
def mavenPom = readMavenPom file: 'pom.xml'
POM_VERSION = "${mavenPom.version}"
sh "echo ${POM_VERSION}"
sh "tar -czvf app-${POM_VERSION}.tgz app/"
sh "curl -u jenkins-user:$docker_pass http://139.177.192.139:8081/repository/geolocation/ --upload-file app-${POM_VERSION}.tgz -v"
}
}
}
}
}
}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ fdfdfghfjj
Project to locate patients in order to facilitate their home appointments by medical specialists
haVDGHAVJCXHSJAVC
jhgvfkjghcvgc
cnvmvmfmvmcmv
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
</parent>
<groupId>com.spring</groupId>
<artifactId>bioMedical</artifactId>
<version>0.0.7-RELEASE</version>
<version>0.0.5-RELEASE</version>
<name>bioMedical</name>
<description>Demo project for Spring Boot</description>
<packaging>jar</packaging>
<properties>
<java.version>1.8</java.version>
<java.version>11</java.version>
<sonar.organization>geolocation</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
</properties>
Expand Down