Une collection organisée de snippets de code pour accélérer votre développement. Parcourez, recherchez et copiez en un clic.
steps {
archiveArtifacts artifacts: 'build/app.jar', fingerprint: true
}
post {
always {
echo 'This will always run'
}
success {
echo 'This will run only if successful'
}
failure {
echo 'This will run only if failed'
}
}
pipeline {
agent any
parameters {
string(name: 'BRANCH', defaultValue: 'main', description: 'Branch to build')
}
stages {
stage('Build') {
steps {
echo "Building branch ${params.BRANCH}"
}
}
}
}
stage('Deploy to Prod') {
steps {
input 'Deploy to production?'
echo 'Deploying...'
}
}
pipeline {
agent any
stages {
stage('Build') {
steps {
echo 'Building...'
}
}
}
}
environment {
MY_SECRET = credentials('my-secret-id')
}
steps {
sh 'echo $MY_SECRET'
}
pipeline {
agent { docker { image 'node:18-alpine' } }
stages {
stage('Test') {
steps {
sh 'node --version'
}
}
}
}
@Library('my-shared-library') _
pipeline { ... }