🤵 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 |