59 lines
1.8 KiB
Groovy
59 lines
1.8 KiB
Groovy
pipeline {
|
|
agent {
|
|
kubernetes {
|
|
cloud 'k3s-jenkins-agents'
|
|
label 'docker-agent'
|
|
defaultContainer 'docker-cli'
|
|
}
|
|
}
|
|
|
|
stages {
|
|
stage('Checkout') {
|
|
steps {
|
|
echo '✅ Code checked out from gitea'
|
|
}
|
|
}
|
|
|
|
stage('Build Docker Image') {
|
|
steps {
|
|
sh '''
|
|
docker build -t management-platform:latest ./platform/
|
|
echo "✅ Docker image built"
|
|
docker images management-platform:latest --format "Size: {{.Size}}"
|
|
'''
|
|
}
|
|
}
|
|
|
|
stage('SonarQube Analysis') {
|
|
steps {
|
|
withSonarQubeEnv('sonarqube') {
|
|
script {
|
|
def scannerHome = tool 'sonar-scanner'
|
|
sh """
|
|
${scannerHome}/bin/sonar-scanner \
|
|
-Dsonar.projectKey=management-platform \
|
|
-Dsonar.sources=platform \
|
|
-Dsonar.python.version=3
|
|
"""
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
stage('Deploy to Kubernetes [TODO - not implemented yet]') {
|
|
steps {
|
|
echo '⚠️ K8s deploy stage not implemented yet — image built but not pushed to the cluster.'
|
|
echo 'Image import + kubectl rollout still needs to be designed (RBAC + pod template + image transfer).'
|
|
}
|
|
}
|
|
}
|
|
|
|
post {
|
|
success {
|
|
echo '✅ Pipeline succeeded — build + Sonar passed, k8s deploy pending'
|
|
}
|
|
failure {
|
|
echo '❌ Pipeline failed — check logs'
|
|
}
|
|
}
|
|
} |