devops101 › Cheat sheet'ler › 🤵 Jenkins (Jenkinsfile) cheat sheet

🤵 Jenkins (Jenkinsfile) cheat sheet

Bildirimsel pipeline

pipeline { agent any stages { stage('Build') { steps { sh 'npm ci' } } } }İskelet
agent { docker { image 'node:20' } }Konteyner agent
environment { TOKEN = credentials('tok') }Credentials
when { branch 'main' }Koşul
parallel { stage('a') {...} stage('b') {...} }Paralel
post { failure { echo 'hata' } }Sonrası
input message: 'Prod'a çıkalım mı?'Elle onay
options { timeout(time: 30, unit: 'MINUTES') }Zaman aşımı

Kullanışlılar

withCredentials([string(credentialsId: 'tok', variable: 'T')]) { ... }Secret güvenli kullan
@Library('ortak-lib') _Shared library
archiveArtifacts artifacts: 'dist/**'Artifact sakla
junit 'reports/*.xml'Test raporu

Uygulamada aç ve alıştırmaları çöz →