_CORE
AI & Agentic Systems Core Information Systems Cloud & Platform Engineering Data Platform & Integration Security & Compliance QA, Testing & Observability IoT, Automation & Robotics Mobile & Digital Banking & Finance Insurance Public Administration Defense & Security Healthcare Energy & Utilities Telco & Media Manufacturing Logistics & E-commerce Retail & Loyalty
References Technologies Blog Know-how Tools
About Collaboration Careers
CS EN
Let's talk

Jenkins — Moderní Pipeline Patterns

28. 02. 2017 1 min read intermediate

DevOps Intermediate

Jenkins — Moderní Pipeline Patterns

JenkinsCI/CDPipelineAutomatizace 5 min read

Jenkins shared libraries, deklarativní pipeline, parallel stages a Kubernetes-based agents.

Shared Libraries

// vars/standardPipeline.groovy
def call(Map config = [:]) {
    pipeline {
        agent { kubernetes { yaml agentPod() } }
        stages {
            stage('Build') {
                steps { sh "docker build -t ${config.image}:${env.BUILD_NUMBER} ." }
            }
            stage('Test') {
                parallel {
                    stage('Unit') { steps { sh 'make test-unit' } }
                    stage('Integration') { steps { sh 'make test-integration' } }
                    stage('Lint') { steps { sh 'make lint' } }
                }
            }
            stage('Deploy') {
                when { branch 'main' }
                steps { sh "kubectl set image ..." }
            }
        }
    }
}

// Jenkinsfile
@Library('shared-pipeline') _
standardPipeline(image: 'registry/myapp', app: 'myapp')

Kubernetes Agents

pipeline {
    agent {
        kubernetes {
            yaml '''
apiVersion: v1
kind: Pod
spec:
  containers:
    - name: golang
      image: golang:1.22
      command: [sleep]
      args: [infinity]
    - name: docker
      image: docker:24-dind
      securityContext:
        privileged: true
'''
        }
    }
    stages {
        stage('Build') {
            steps { container('golang') { sh 'go build ./...' } }
        }
    }
}

Best Practices

  • Deklarativní pipeline > skriptovací
  • Shared libraries pro opakující se patterny
  • Parallel stages pro rychlejší feedback
  • K8s agents pro izolaci a škálovatelnost
  • Credentials plugin pro secrets

Summary

Moderní Jenkins s shared libraries a K8s agents je stále silný CI/CD nástroj. Klíč je standardizace.

Need Help with Implementation?

Our team has experience designing and implementing modern architectures. We’re happy to help.

Free Consultation

Share:

CORE SYSTEMS tým

Stavíme core systémy a AI agenty, které drží provoz. 15 let zkušeností s enterprise IT.