apache / tvm

Open deep learning compiler stack for cpu, gpu and specialized accelerators
https://tvm.apache.org/
Apache License 2.0
11.6k stars 3.44k forks source link

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

Open mikepapadim opened 2 years ago

mikepapadim commented 2 years ago

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:

@areusch

cc @Mousius @driazati @gigiblender

areusch commented 2 years ago

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.