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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
103 changes: 36 additions & 67 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,75 +1,44 @@

pipeline {
triggers {
pollSCM('* * * * *')
}
agent any
pipeline{
agent any
tools {
maven 'M2_HOME'
}
environment {
registry = '076892551558.dkr.ecr.us-east-1.amazonaws.com/jenkins'
registryCredential = 'aws_ecr_id'
dockerimage = ''
}
stages {
stage ( 'maven build') {
steps{
sh 'mvn clean install package'
}

stages {

stage("build & SonarQube analysis") {
agent {
docker { image 'maven:3.8.6-openjdk-11-slim' }
}


steps {
withSonarQubeEnv('SonarServer') {
sh 'mvn sonar:sonar -Dsonar.projectKey=kserge2001_geolocation -Dsonar.java.binaries=.'
}
}
}
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 install -DskipTests'
sh 'mvn package -DskipTests'
}
}
stage('Build Image') {

steps {
script{
}
stage ( 'upload artifact') {
steps{
script{
def mavenPom = readMavenPom file: 'pom.xml'
dockerImage = docker.build registry + ":${mavenPom.version}"
}
nexusArtifactUploader artifacts:
[[artifactId: "${mavenPom.artifactId}",
classifier: '',
file: "target/${mavenPom.artifactId}-${mavenPom.version}.${mavenPom.packaging}",
type: "${mavenPom.packaging}"]],
credentialsId: 'NexusID',
groupId: "${mavenPom.groupId}",
nexusUrl: '192.53.120.155:8081',
nexusVersion: 'nexus3',
protocol: 'http',
repository: 'biom',
version: "${mavenPom.version}"
}
}
stage('Deploy image') {


steps{
script{
docker.withRegistry("https://"+registry,"ecr:us-east-1:"+registryCredential) {
dockerImage.push()
}
}
}
}


}
}


}
stage ( 'list the directory') {
steps{
sh 'ls'
}


}
}

}
75 changes: 75 additions & 0 deletions Jenkinsfile.bk
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@

pipeline {
triggers {
pollSCM('* * * * *')
}
agent any
tools {
maven 'M2_HOME'
}
environment {
registry = '076892551558.dkr.ecr.us-east-1.amazonaws.com/jenkins'
registryCredential = 'aws_ecr_id'
dockerimage = ''
}

stages {

stage("build & SonarQube analysis") {
agent {
docker { image 'maven:3.8.6-openjdk-11-slim' }
}


steps {
withSonarQubeEnv('SonarServer') {
sh 'mvn sonar:sonar -Dsonar.projectKey=kserge2001_geolocation -Dsonar.java.binaries=.'
}
}
}
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 install -DskipTests'
sh 'mvn package -DskipTests'
}
}
stage('Build Image') {

steps {
script{
def mavenPom = readMavenPom file: 'pom.xml'
dockerImage = docker.build registry + ":${mavenPom.version}"
}
}
}
stage('Deploy image') {


steps{
script{
docker.withRegistry("https://"+registry,"ecr:us-east-1:"+registryCredential) {
dockerImage.push()
}
}
}
}


}
}
71 changes: 71 additions & 0 deletions target/classes/application.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# ===============================
# TOMCAT
# ===============================
#server.address=127.0.0.1
#server.error.whitelabel.enabled=false
#server.tomcat.accesslog.enabled=true

# ===============================
# SMTP EMAIL
# ===============================
server.port=8082
spring.mail.host = smtp.gmail.com
spring.mail.username = root90user@gmail.com
spring.mail.password = bCE6jOzVHltl2%!Q?:`E8Bq&yFk
spring.mail.port = 587
spring.mail.properties.mail.smtp.auth = true
spring.mail.properties.mail.smtp.starttls.enable = true
spring.mail.properties.mail.smtp.connectiontimeout=5000
spring.mail.properties.mail.smtp.timeout=5000
spring.mail.properties.mail.smtp.writetimeout=5000


# ===============================
# = LOGGING
# ===============================
logging.level.org.springframework.web=DEBUG
logging.level.org.hibernate=ERROR

# ===============================
# = DATA SOURCE
# ===============================
# spring.datasource.url=jdbc:mysql://localhost:3306/userauth
# spring.datasource.username=root
# spring.datasource.password=2j5R1HtsE7LmpM8Tdn92
# spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.tomcat.max-wait=10000
spring.datasource.tomcat.max-active=5
#spring.datasource.tomcat.test-on-borrow=true
spring.datasource.initialization-mode=always

# spring.jpa.defer-datasource-initialization=true
spring.jpa.hibernate.naming_strategy=org.hibernate.cfg.EJB3NamingStrategy
spring.sql.init.mode=always
# ===============================
# = JPA / HIBERNATE
# ===============================
spring.jpa.show-sql = true
spring.jpa.hibernate.ddl-auto = update

#server.servlet.context-path=/bio
# ===============================
# = Thymeleaf configurations
# ===============================
spring.thymeleaf.mode=LEGACYHTML5
spring.thymeleaf.cache=false

# H2 Database config

# H2 Database
spring.h2.console.enabled=true
#spring.datasource.url=jdbc:h2:mem:dcbapp
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=school1
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect

spring.datasource.url=jdbc:h2:mem:userauth
# Enabling H2 Console
# Custom H2 Console URL
spring.h2.console.path=/h2
spring.jpa.defer-datasource-initialization = true
15 changes: 15 additions & 0 deletions target/classes/data.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
INSERT INTO USER (id, confirmation_token, username, enabled, first_name, last_name, gender, password, authority, lastseen)
VALUES
(3, 'AAAAAAA', 'student@utrains.test', 1, 'student', 'Utrains student', 'Male', 'school1', 'ROLE_ADMIN', '05/01/2022'),
(4, 'BBBBBBB', 'root@utrains.test', 1, 'root','Utrains ROOT','Female', 'root_pass', 'ROLE_USER', '05/01/2022'),
(5, 'CCCCCCC', 'mekano@utrains.test', 1, 'Mekano','hermann','Male', 'mekano_pass', 'ROLE_DOCTOR', '05/01/2022'),
(6, 'DDDDDDD', 'alain-pierre@utrains.test', 1, 'Alain','Pierre','Male', 'alain_pass', 'ROLE_ADMIN', '05/01/2022'),
(7, 'EEEEEEE', 'dev@utrains.test', 1,'Dev', 'User','Male', 'dev_test', 'ROLE_PATIENT', '05/01/2022'),
(8, 'GGGGGGG', 'serge@utrains.test', 1, 'Serge','Prof.','Male', 'serge_pass', 'ROLE_ADMIN', '05/01/2022'),
(31, 'AAAAAAA', 'student2@utrains.test', 1, 'student', 'Utrains student', 'Male', 'school1', 'ROLE_ADMIN', '05/01/2022'),
(41, 'BBBBBBB', 'root2@utrains.test', 1, 'root','Utrains ROOT','Female', 'root_pass', 'ROLE_USER', '05/01/2022'),
(51, 'CCCCCCC', 'mekano2@utrains.test', 1, 'Mekano','hermann','Male', 'mekano_pass', 'ROLE_DOCTOR', '05/01/2022'),
(61, 'DDDDDDD', 'alain-pierre2@utrains.test', 1, 'Alain','Pierre','Male', 'alain_pass', 'ROLE_ADMIN', '05/01/2022'),
(71, 'EEEEEEE', 'dev2@utrains.test', 1, 'dev', 'User','Male', 'dev_test', 'ROLE_PATIENT', '05/01/2022'),
(81, 'GGGGGGG', 'serge2@utrains.test', 1, 'Serge','Prof.','Male', 'serge_pass', 'ROLE_ADMIN', '05/01/2022');
commit;
17 changes: 17 additions & 0 deletions target/classes/schema.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
DROP TABLE IF EXISTS USER;
CREATE TABLE USER (
id INTEGER AUTO_INCREMENT,
confirmation_token VARCHAR(250) NOT NULL,
username VARCHAR(250) NOT NULL,
enabled INTEGER not null,
first_name VARCHAR(250) NOT NULL,
last_name VARCHAR(250) NOT NULL,
lastseen VARCHAR(250),
gender VARCHAR(250) NOT NULL,
password VARCHAR(250) NOT NULL,
authority VARCHAR(250) NOT NULL,
PRIMARY KEY (id)
);

--INSERT INTO USER (id, first_name, last_name, username, password, authority, gender) VALUES
-- (1,'utrains', 'root', 'utrains-root@utrains.com','school1','DOCTOR', 'Male');
Binary file added target/classes/static/css/ajax-loader.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading