Difference between revisions of "Continuous Integration: Releases Jenkins Pipeline"
Manuele.simi (Talk | contribs) (→Basic Structure) |
Manuele.simi (Talk | contribs) (→Basic Structure) |
||
Line 31: | Line 31: | ||
== Basic Structure == | == Basic Structure == | ||
− | [https://code-repo.d4science.org/gCubePipelines/gCubeRelease/src/branch/master/Jenkinsfile|''Jenkinsfile''] defines a [https://jenkins.io/doc/book/pipeline/#declarative-pipeline-fundamentals| Declarative Pipeline]. | + | [https://code-repo.d4science.org/gCubePipelines/gCubeRelease/src/branch/master/Jenkinsfile|''Jenkinsfile''] defines a [https://jenkins.io/doc/book/pipeline/#declarative-pipeline-fundamentals| Declarative Pipeline]. The Pipeline’s code defines the entire build process of a gCube Release. |
This is a stub of the gCubeRelease pipeline. | This is a stub of the gCubeRelease pipeline. |
Revision as of 16:48, 29 May 2019
Jenkins Pipeline is a combination of plugins that support the integration and implementation of continuous delivery pipelines using Jenkins. A pipeline has an extensible automation server for creating simple or complex delivery pipelines "as code," via pipeline DSL (Domain-specific Language).
Contents
gCubeRelease Pipeline Project
In gCube we use a Pipeline to trigger the builds of jobs forming a gCube Release. The pipeline project is available at: https://jenkins.d4science.org/job/gCube-Release/
Parameters
Triggers
No triggers are defined because the pipeline is designed to be manually launched by the Release Manager:
Git
The pipeline definition is maintained in a Git repository. This section connects the project to the Git repository.
Jenkins Pipeline Definition
Git Repository
The definition of the gCube release pipeline is maintained in this Git Repository: https://code-repo.d4science.org/gCubePipelines/gCubeRelease
Requirements
- Jenkins ver. 2.164.2 or newer
- Pipeline Plugin
- Pipeline: Basic Steps
- Pipeline: Maven
- Jenkins configured with a JDK named 'OpenJDK 8'
Basic Structure
Jenkinsfile defines a Declarative Pipeline. The Pipeline’s code defines the entire build process of a gCube Release.
This is a stub of the gCubeRelease pipeline.
// manage options and settings // pipeline pipeline { // no restriction agent any // expected input parameters parameters { string(name: 'myInput', description: 'Some pipeline parameters') } stages { stage('preliminary steps') { //prepare the environment for the builds steps { script { //execute shell commands if needed } } } stage('build group 1') { steps { withMaven(..maven settings here..) { build 'job name 1' build 'job name 2' build 'job name 3' build 'job name 4' } script { //execute shell commands if needed } } } stage('build group 2') { steps { ... } } } // post-build actions post { always { echo 'This will always run' } success { echo 'This will run only if successful' } failure { echo 'This will run only if failed' } unstable { echo 'This will run only if the run was marked as unstable' } changed { echo 'This will run only if the state of the Pipeline has changed' echo 'For example, if the Pipeline was previously failing but is now successful' } } }
Reference Documentation
Back to the CI guide.