Pipelines in Jenkins

For CI/CD of your projects, you can use Jenkins. To set up a workflow, you can create a pipeline. They are written in Pipeline DSL based on Groovy syntax. The best practice is to keep the pipeline in a file in the repository and not as a script in Jenkins. The file containing the pipeline is called a Jenkinsfile.


Example (Declarative Pipeline)

pipeline {
    agent any

    stages {
        stage('Build') {
            steps {
                echo 'Building...'
            }
        }
        stage('Test') {
            steps {
                echo 'Testing...'
            }
        }
        stage('Deploy') {
            steps {
                echo 'Deploying...'
            }
        }
    }
}