Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
84a9a90
Create Jenkinsfile
phk01-afk Jun 29, 2025
0cbbe4b
Update Jenkinsfile
phk01-afk Jun 29, 2025
56f4cf4
Update1 Jenkinsfile
phk01-afk Jun 29, 2025
0f90293
Update da proradi Jenkinsfile
phk01-afk Jun 29, 2025
6f0d9a0
pomozi boze
phk01-afk Jun 29, 2025
51121ab
proveraPonovo
phk01-afk Jun 29, 2025
077907b
ajd
phk01-afk Jun 29, 2025
1825dcf
ajd1
phk01-afk Jun 29, 2025
4732d8f
Update pom.xml
phk01-afk Jun 29, 2025
c657fb5
pliz
phk01-afk Jun 29, 2025
9f0a6c6
ajde2
phk01-afk Jun 29, 2025
3250ca4
Update application.properties
phk01-afk Jun 29, 2025
c35ca95
testovi
phk01-afk Jun 29, 2025
5415409
frontend
phk01-afk Jun 29, 2025
cf3265b
pls pls pls
phk01-afk Jun 29, 2025
6d051bd
ajd ziv bio
phk01-afk Jun 29, 2025
e299f10
za spavanje
phk01-afk Jun 29, 2025
cc3d923
port
phk01-afk Jun 30, 2025
7ecb5ae
port Jenkins
phk01-afk Jun 30, 2025
660db7b
pls
phk01-afk Jun 30, 2025
8eb14e1
lol
phk01-afk Jun 30, 2025
5f1c173
ajd plz
phk01-afk Jun 30, 2025
46dbb88
nmg vise
phk01-afk Jun 30, 2025
e0e6f1c
plizomgomg
phk01-afk Jun 30, 2025
b4bf01e
Update Jenkinsfile
phk01-afk Jun 30, 2025
50e32cd
Create JenkinsProba
phk01-afk Jul 2, 2025
c2a2684
Update JenkinsProba1
phk01-afk Jul 2, 2025
46a0cb0
Update JenkinsProba2
phk01-afk Jul 2, 2025
e6b042f
Update JenkinsProba4
phk01-afk Jul 2, 2025
de30962
Update JenkinsProba5
phk01-afk Jul 2, 2025
1e4dfc4
Update Jenkinsfile
phk01-afk Jul 2, 2025
60c985f
Update Jenkinsfile
phk01-afk Jul 2, 2025
d4a2647
Update Jenkinsfile
phk01-afk Jul 2, 2025
ccd0f85
Update Jenkinsfile
phk01-afk Jul 2, 2025
6562bd2
Update Jenkinsfile
phk01-afk Jul 2, 2025
b0f79d2
ajd sad
phk01-afk Jul 13, 2025
384d5af
Update Jenkinsfile
phk01-afk Jul 13, 2025
fe956ae
Update Jenkinsfile
phk01-afk Jul 13, 2025
9554d7a
Update Jenkinsfile
phk01-afk Jul 13, 2025
4ad7882
Update Jenkinsfile
phk01-afk Jul 13, 2025
8f4bae5
Update application.properties
phk01-afk Jul 13, 2025
3ba857f
Update Jenkinsfile
phk01-afk Jul 13, 2025
6e11b75
Update Jenkinsfile
phk01-afk Jul 13, 2025
7ada5af
Update Jenkinsfile
phk01-afk Jul 13, 2025
8fa6baf
Update application.properties
phk01-afk Jul 13, 2025
ce131b6
pls2323
phk01-afk Jul 14, 2025
d6cc35a
Update Jenkinsfile
phk01-afk Jul 14, 2025
1772836
Update Jenkinsfile
phk01-afk Jul 14, 2025
b64f55f
proba
phk01-afk Jul 14, 2025
dd94bd7
ajd1212
phk01-afk Jul 14, 2025
af3e2c6
pliz
phk01-afk Jul 14, 2025
7eb59af
Update application.properties
phk01-afk Jul 14, 2025
f3cf9be
Update application.properties
phk01-afk Jul 14, 2025
feb4c83
Update Jenkinsfile
phk01-afk Jul 14, 2025
9286e46
Update Jenkinsfile
phk01-afk Jul 15, 2025
5dc3651
more
phk01-afk Aug 7, 2025
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
78 changes: 78 additions & 0 deletions JenkinsProba
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
pipeline {
agent any


tools {
maven 'Maven 3' // ovo si dodao u Global Tool Configuration
nodejs 'Node 12' // NodeJS koji si tamo dodao
}



stages {
stage('Clone Repo') {
steps {
git branch: 'patch-1', url: 'https://github.com/phk01-afk/angular9-springboot-expensetracker.git'
}
}

stage('Build Backend') {
steps {
dir('expensetracker') {
sh 'mvn clean install -DskipTests'
}
}
}

stage('Build Frontend') {
steps {
dir('expense-tracker-fronten') {
sh 'npm install'
sh 'ng build --prod'
}
}
}

stage('Run Backend') {
steps {
script {
sh "pkill -f '${JAR_NAME}' || true"
sh """
nohup java -jar ${BACKEND_DIR}/target/${JAR_NAME} \
--server.port=${BACKEND_PORT} > backend.log 2>&1 &
"""
}
}
}

stage('Run Frontend (Dev Server)') {
steps {
dir("${FRONTEND_DIR}") {
sh 'nohup npm run start -- --port 4200 > frontend.log 2>&1 &'
}
}
}

stage('Health Check') {
steps {
script {
sleep 15
echo "Testing backend on http://localhost:${BACKEND_PORT}/api/v1/expenses"
sh "curl -f http://localhost:${BACKEND_PORT}/api/v1/expenses || exit 1"

echo "Testing frontend on http://localhost:4200"
sh "curl -f http://localhost:4200 || exit 1"
}
}
}
}

post {
success {
echo "✅ Backend is running on port ${BACKEND_PORT}, frontend on port 4200"
}
failure {
echo "❌ Pipeline failed. Check backend.log or frontend.log for details."
}
}
}
83 changes: 83 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
pipeline {
agent any

tools {
maven 'Maven 3'
nodejs 'Node 12'
}

stages {

stage('Kloniraj Repozitorijum') {
steps {
echo "📥 Kloniram GitHub repozitorijum..."
dir('angular9-springboot-expensetracker') {
deleteDir()
}
git url: 'https://github.com/phk01-afk/angular9-springboot-expensetracker.git', branch: 'patch-1'
}
}

stage('Build Backend') {
steps {
dir('expensetracker') {
sh 'mvn clean install -Dmaven.test.skip=true -Dmaven.compiler.arguments="--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED"'
}
}
}

stage('Run Spring Boot') {
steps {
dir('expensetracker') {
sh '''
echo "✔ Provera .jar fajla:"
ls -l target/*.jar || { echo "❌ JAR fajl nije pronađen!"; exit 1; }

echo "⚙️ Pokretanje Spring Boot aplikacije..."
pkill -f 'expensetracker-v1.jar' || true
nohup java -jar target/expensetracker-v1.jar > backend.log 2>&1 &

echo "⏳ Čekam 25 sekundi da se backend startuje..."
sleep 25
'''
}
}
}

stage('Health Check Backend') {
steps {
script {
def retries = 5
def success = false
while (retries > 0) {
def response = sh(script: "curl -s -o /dev/null -w '%{http_code}' http://localhost:8080/api/v1/expenses", returnStdout: true).trim()
if (response == '200') {
echo "✅ Backend je uspešno startovan!"
success = true
break
} else {
retries--
echo "⏳ Backend još nije spreman... (${retries} pokušaja ostalo)"
sleep(10)
}
}
if (!success) {
error "❌ Backend health check nije uspeo!"
}
}
}
}

stage('Build & Serve Frontend') {
steps {
dir('angular9-springboot-expensetracker/expense-tracker-frontend') {
sh 'npm install'
sh 'pkill -f "ng serve" || true'
sh 'nohup npx ng serve --host 0.0.0.0 --port 4200 > frontend.log 2>&1 &'
}
}
}

}
}

146 changes: 83 additions & 63 deletions expensetracker/pom.xml
Original file line number Diff line number Diff line change
@@ -1,70 +1,90 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.1.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>in.bushansirgur</groupId>
<artifactId>expensetracker</artifactId>
<version>v1</version>
<name>expensetracker</name>
<description>Expense tracking application</description>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<properties>
<java.version>1.8</java.version>
<maven-jar-plugin.version>2.6</maven-jar-plugin.version>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.1.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<groupId>in.bushansirgur</groupId>
<artifactId>expensetracker</artifactId>
<version>v1</version>
<name>expensetracker</name>
<description>Expense tracking application</description>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<properties>
<java.version>1.8</java.version>
<maven-jar-plugin.version>2.6</maven-jar-plugin.version>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.38</version> <!-- Verovatno je najbolje koristiti najnoviju verziju -->
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>

<!-- Preskakanje testova tokom build-a -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<configuration>
<skipTests>true</skipTests> <!-- Preskoči testove tokom build-a -->
</configuration>
</plugin>
</plugins>
</build>
</project>


17 changes: 15 additions & 2 deletions expensetracker/src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
spring.datasource.url=jdbc:mysql://localhost:3306/expensetracker?useSSL=false
#Konfiguracija porta za aplikaciju
server.port=8080
# Podaci za konekciju sa bazom podataka
spring.datasource.url=jdbc:mysql://localhost:3306/expensetracker?useSSL=false&serverTimezone=UTC
spring.datasource.username=expensetracker
spring.datasource.password=expensetracker
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

spring.jpa.generate-ddl=true
# Hibernate Dialekt za MySQL
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect # Za MySQL 8.x
# spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect # Za MySQL 5.x

# Postavke za automatsko kreiranje/izmene DDL tabele (update, create, validate, none)
spring.jpa.hibernate.ddl-auto=update # Možeš koristiti: update, create, validate, none

# Postavke za SQL logovanje (opciono, korisno za debugging)
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.format_sql=true