Jenkins freestyle joby nám sloužily roky. Ale s 50 projekty a složitějšími buildy se staly neudržitelnými. Jenkins Pipeline přinesl build pipeline definovaný jako kód v Jenkinsfile — verzovaný, reviewovaný, reprodukovatelný.
Pipeline as Code¶
pipeline {
agent any
stages {
stage('Build') {
steps { sh 'mvn clean compile' }
}
stage('Test') {
steps { sh 'mvn test' }
post { always { junit 'target/surefire-reports/*.xml' } }
}
stage('Package') {
steps {
sh 'mvn package -DskipTests'
archiveArtifacts 'target/*.war'
}
}
stage('Deploy to Staging') {
when { branch 'develop' }
steps { sh './deploy.sh staging' }
}
}
}
Shared Libraries a Multibranch¶
Sdílená knihovna core-pipeline-lib s funkcemi jako deployToEnvironment(),
runSonarAnalysis(). Multibranch Pipeline automaticky detekuje branch-e — feature branch
= automatický build.
Jenkinsfile patří do každého repozitáře¶
Build proces je součástí projektu, verzovaný, reviewovaný. Pokud stále používáte freestyle joby, migrujte na Pipeline.
Brauchen Sie Hilfe bei der Implementierung?
Unsere Experten helfen Ihnen bei Design, Implementierung und Betrieb. Von der Architektur bis zur Produktion.
Kontaktieren Sie uns