add Jenkinsfile
Some checks failed
csharp-secdevops-pipeline-pod/pipeline/head There was a failure building this commit
Some checks failed
csharp-secdevops-pipeline-pod/pipeline/head There was a failure building this commit
This commit is contained in:
63
Jenkinsfile
vendored
Normal file
63
Jenkinsfile
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
pipeline {
|
||||
agent {
|
||||
kubernetes {
|
||||
// Definiert den Pod mit dem .NET 8 SDK Image
|
||||
yaml '''
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
spec:
|
||||
containers:
|
||||
- name: dotnet8
|
||||
image: mcr.microsoft.com/dotnet/sdk:8.0
|
||||
command:
|
||||
- cat
|
||||
tty: true
|
||||
'''
|
||||
}
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('Checkout Source') {
|
||||
steps {
|
||||
// Ersetze 'dein-user' und 'dein-repo' durch die Namen aus Gitea
|
||||
git url: 'http://130.61.26.230:30080/dev-master/secdevops-csharp-app.git',
|
||||
branch: 'master'
|
||||
}
|
||||
}
|
||||
|
||||
stage('Build with .NET 8') {
|
||||
steps {
|
||||
// Führt den Build-Befehl im spezialisierten Container aus
|
||||
container('dotnet8') {
|
||||
sh 'dotnet --version' // Zur Bestätigung der Version
|
||||
sh 'dotnet build'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Unit Tests') {
|
||||
steps {
|
||||
container('dotnet8') {
|
||||
// Führt alle Tests im Solution-Verzeichnis aus
|
||||
sh 'dotnet test --no-build --configuration Release'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Set Build Name') {
|
||||
steps {
|
||||
script {
|
||||
// Setzt den Namen des aktuellen Laufs auf die Version + Build-Nummer
|
||||
currentBuild.displayName = "v1.0.0-build-${env.BUILD_NUMBER}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
post {
|
||||
always {
|
||||
// Meldet den Status zurück, wenn das Gitea-Plugin korrekt konfiguriert ist
|
||||
step([$class: 'GiteaNotifier'])
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user