ready for action
Some checks failed
GoLang Tests / Run Go Tests (push) Failing after 55s
GoLang Tests / Build Go Image and Upload (push) Has been skipped

This commit is contained in:
2025-08-22 00:13:00 +02:00
parent c1b937152b
commit 34bd44db5c
6 changed files with 49 additions and 26 deletions

View File

@@ -1,8 +1,6 @@
module arbeitszeitmessung module arbeitszeitmessung
go 1.23.0 go 1.24.5
toolchain go1.24.5
require github.com/lib/pq v1.10.9 require github.com/lib/pq v1.10.9

View File

@@ -20,7 +20,7 @@ services:
- 8001:8080 - 8001:8080
backend: backend:
build: ../Backend build: ../Backend
image: git.letsstein.de/tom/arbeitszeit-backend:0.1.1 image: git.letsstein.de/tom/arbeitszeitmessung
restart: unless-stopped restart: unless-stopped
env_file: env_file:
- .env - .env

View File

@@ -7,7 +7,6 @@ services:
- .env.test - .env.test
environment: environment:
PGDATA: /var/lib/postgresql/data/pg_data PGDATA: /var/lib/postgresql/data/pg_data
volumes: # volumes: //- ${POSTGRES_PATH}/initdb:/docker-entrypoint-initdb.d
- ${POSTGRES_PATH}/initdb:/docker-entrypoint-initdb.d
ports: ports:
- 5433:5432 - 5433:5432

View File

@@ -17,7 +17,7 @@ services:
- 5432:5432 - 5432:5432
backend: backend:
image: git.letsstein.de/tom/arbeitszeit-backend image: git.letsstein.de/tom/arbeitszeitmessung
env_file: env_file:
- .env - .env
environment: environment:

32
Jenkinsfile vendored
View File

@@ -3,6 +3,9 @@ pipeline {
DOCKER_USERNAME = 'jenkins' DOCKER_USERNAME = 'jenkins'
DOCKER_PASSWORD = credentials('gitea_jenkins') DOCKER_PASSWORD = credentials('gitea_jenkins')
SONAR_TOKEN = credentials('sonarcube_token') SONAR_TOKEN = credentials('sonarcube_token')
POSTGRES_USER = 'postgres'
POSTGRES_PASSWORD = 'password'
POSTGRES_DB = 'arbeitszeitmessung'
} }
agent any agent any
@@ -11,12 +14,35 @@ pipeline {
stage('Test') { stage('Test') {
agent { agent {
docker { docker {
image 'golang:alpine' image ''
args ''
args ''
} }
} }
steps { steps {
sh 'cd Backend && go mod download && go mod verify' script {
sh 'make test' sh '''
docker run -d --rm \
--name test-db \
-e POSTGRES_USER={$POSTGRES_USER} \
-e POSTGRES_PASSWORD={$POSTGRES_PASSWORD} \
-e POSTGRES_DB={$POSTGRES_DB} \
-v ./DB/initdb:/docker-entrypoint-initdb.d\
-p "5432:5432" \
postgres:16
'''
// docker.image('golang:1.24.5').withRun(
// '-u root:root --network=host'
// ) { go ->
// // wait for DB to start
// sh '''
// cd Backend \
// go mod download && go mod tidy \
// go test ./... -v
// '''
// }
}
} }
} }
stage('SonarCube Analysis') { stage('SonarCube Analysis') {