Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CI] Migrating Jenkinsfile from scripted to declartive pipeline style. #9042

Closed
mikepapadim opened this issue Sep 18, 2021 · 1 comment
Closed
Assignees
Labels

Comments

@mikepapadim
Copy link
Contributor

mikepapadim commented Sep 18, 2021

Currently, Jenkinsfile is in a scripted format.
Therefore, while more changes are suggested to improve the CI, like #8673, #8674 and #8675 the script will grow a lot.
So, I suggest migrating it to declarative style to have access to Jenkins helpers directly.

Pipeline syntax differences

Declarative pipelines always begin with the word pipeline. Scripted pipelines, on the other hand, always begin with the word node. Declarative pipelines break down stages into individual stages that can contain multiple steps. Scripted pipelines use Groovy code and references to the Jenkins pipeline DSL within the stage elements without the need for steps.

Declarative style example

pipeline {
    agent any
    stages {
        stage('Deploy') {
            steps {
                timeout(time: 3, unit: 'MINUTES') {
                    retry(5) {
                        sh ...
                    }
                }
            }
        }
    }
}

Pros:

  • A cleaner Jenkinsfile, easier to maintain, add features.
  • Direct access to declarative syntax, wrappers and functions from Jenkins syntax.
  • Can add post pipeline action to sent status on email, Slack, discord etc.

@areusch

cc @Mousius @driazati @gigiblender

@mikepapadim mikepapadim changed the title [CI Problem] Migrating Jenkinsfile from scripted to declartive pipeline style. [CI] Migrating Jenkinsfile from scripted to declartive pipeline style. Sep 18, 2021
@areusch areusch self-assigned this Sep 20, 2021
@areusch
Copy link
Contributor

areusch commented Mar 15, 2022

We tried this out, but not clear if the Jenkinsfile is cleaner/more maintainable in this format, or whether a template is needed. Going to revisit after ci.py is finished.

@areusch areusch added the needs-triage PRs or issues that need to be investigated by maintainers to find the right assignees to address it label Oct 19, 2022
@hpanda-naut hpanda-naut added dev:ci and removed needs-triage PRs or issues that need to be investigated by maintainers to find the right assignees to address it labels Nov 28, 2022
@tqchen tqchen closed this as completed Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants