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

64
Jenkinsfile vendored
View File

@@ -3,6 +3,9 @@ pipeline {
DOCKER_USERNAME = 'jenkins'
DOCKER_PASSWORD = credentials('gitea_jenkins')
SONAR_TOKEN = credentials('sonarcube_token')
POSTGRES_USER = 'postgres'
POSTGRES_PASSWORD = 'password'
POSTGRES_DB = 'arbeitszeitmessung'
}
agent any
@@ -11,30 +14,53 @@ pipeline {
stage('Test') {
agent {
docker {
image 'golang:alpine'
image ''
args ''
args ''
}
}
steps {
sh 'cd Backend && go mod download && go mod verify'
sh 'make test'
}
}
stage('SonarCube Analysis') {
steps {
sh 'make scan'
}
}
stage('Building image arbeitszeit-backend') {
when {
anyOf {
changeset 'Jenkinsfile'
changeset 'Makefile'
changeset 'Backend/**'
script {
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
// '''
// }
}
}
steps {
sh 'make backend'
}
}
stage('SonarCube Analysis') {
steps {
sh 'make scan'
}
}
stage('Building image arbeitszeit-backend') {
when {
anyOf {
changeset 'Jenkinsfile'
changeset 'Makefile'
changeset 'Backend/**'
}
}
steps {
sh 'make backend'
}
}
}
}