Difference between revisions of "Continuous Integration: Tagging Jenkins Pipeline"

From Gcube Wiki
Jump to: navigation, search
(Undo revision 33787 by Manuele.simi (talk))
 
Line 1: Line 1:
 
= gCubeTagging Pipeline Project =
 
= gCubeTagging Pipeline Project =
A pipeline to execute configurable actions over a list of Git repositories:
 
  
The pipeline project is available at: https://jenkins.d4science.org/job/Pipeline-gCubeActions/
+
In gCube we use a Pipeline to tag all the repositories forming a gCube Release. The pipeline project is available at:
 +
https://jenkins.d4science.org/job/Pipeline-gCubeTagging/
  
  
 
== Parameters==
 
== Parameters==
  
[[File:Jenkins_action_pipeline_params.png|400px]]
+
[[File:Jenkins_tagging_pipeline_params.png|400px]]
 +
 
 +
The pipeline takes as input the parameters needed to locate a [[Continuous_Integration:_Releases_Jenkins_Pipeline#Build_Commits_Report|commits report]].
 +
 
 +
The commits report is generated by the Builder pipeline. The tagging pipeline assumes that the report is available at:
 +
 
 +
<nowiki>https://code-repo.d4science.org/gCubeCI/gCubeReleases/raw/branch/master/closed/<gcube_release_version>/build_commits.<report_number>.csv</nowiki>
  
 
== Triggers ==
 
== Triggers ==
 
No triggers are defined because the pipeline is expected to be manually launched by the [[Continuous_Integration:_Releases_Manager|Release Manager]]:
 
No triggers are defined because the pipeline is expected to be manually launched by the [[Continuous_Integration:_Releases_Manager|Release Manager]]:
  
 +
[[File:Jenkins_tagging_pipeline_triggers.png|400px]]
  
 +
 +
It can be changed according to the release needs and the availability of a sufficient number of dedicate agents in Jenkins.
  
 
== Git ==
 
== Git ==
Line 21: Line 30:
 
= Jenkins Pipeline Definition =
 
= Jenkins Pipeline Definition =
 
== Git Repository ==
 
== Git Repository ==
The definition of the gCube release pipeline is maintained in this Git Repository: ...
+
The definition of the gCube release pipeline is maintained in this Git Repository: https://code-repo.d4science.org/gCubeCI/gCubeTagging.
  
 
== Requirements on Jenkins ==
 
== Requirements on Jenkins ==
 
+
* [https://jenkins.io| Jenkins] ver. 2.164.2 or newer
 +
* [https://plugins.jenkins.io/workflow-aggregator| Pipeline Plugin]
 +
* [https://plugins.jenkins.io/workflow-basic-steps| Pipeline: Basic Steps]
 +
* [https://plugins.jenkins.io/pipeline-maven| Pipeline: Maven]
 +
* [https://plugins.jenkins.io/workflow-scm-step| Pipeline: SCM Step plugin] ver. 2.7 or newer
 +
* [https://plugins.jenkins.io/workflow-cps-global-lib| Pipeline: Shared Groovy Libraries] ver. 2.15 or newer
 +
* User credentials configured on Jenkins. These are needed to set the author of the tag. ''git.gcube'' is currently used
  
 
= Jenkins Pipeline Execution =
 
= Jenkins Pipeline Execution =
  
 +
In order to use as input the following sample report available at <nowiki>https://code-repo.d4science.org/gCubeCI/gCubeRelease/raw/branch/master/releases/4.10.0/build_commits.12.csv</nowiki>:
 +
<pre>
 +
GroupID,ArtifactID,Version,SCM URL,Build Number,Distribution URL,Filename,Packaging
 +
org.gcube.tools,strategy-forward,1.1.0,https://code-repo.d4science.org/Playground/MergeStrategyFastForward,66f5fd1da37229615268955eeaf46870dd4d6576,...
 +
</pre>
 +
 +
We run the pipeline with the following parameters:
 +
* Type = TAG
 +
* gcube_release_number = 4.10.0
 +
* report_number = 12
 +
 +
On the jenkins console, we can see the messages logging the tagging activity on the repository:
 +
 +
[[File:Jenkins_tagging_pipeline_console.png|600px]]
 +
 +
On gitea, we can appreciate that the tag has been pushed;
 +
 +
[[File:Jenkins_tagging_pipeline_gitea.png|600px]]
 +
 +
On a local cloned repo, we can fetch the new tag:
 +
 +
[[File:Jenkins_tagging_pipeline_repo.png|600px]]
 +
 +
= Tags =
 +
The pipeline must tag the master branch at the commit ID reported in the build report.
 +
 +
The commit is tagged twice:
 +
 +
* v<component version>
 +
* r<Gcube Release number>
  
= Action Report =
+
= Tag Report =
 
If the pipeline execution succeeds, it sends a tag report to the release manager.
 
If the pipeline execution succeeds, it sends a tag report to the release manager.
 
The report includes the following information for each Git repository tagged:
 
The report includes the following information for each Git repository tagged:
* the repo name
+
* the artifact id
 +
* the artifact version
 
* the SCM url
 
* the SCM url
* the result (completed or failed)
+
* the commit tagged
 +
* the component tag pushed to the repository
 +
* the gCube release tag pushed to the repository
  
 
Here's an example of a tag report:
 
Here's an example of a tag report:
  
[[File:Jenkins-action-report.png|600px]]
+
[[File:Jenkins-tag-report2.png|600px]]
 
   
 
   
 
''Back to the [[Continuous_Integration_procedure_(2019) | CI guide]].''
 
''Back to the [[Continuous_Integration_procedure_(2019) | CI guide]].''
  
 
[[Category:Continuous_Integration]]
 
[[Category:Continuous_Integration]]

Latest revision as of 03:44, 26 January 2021

gCubeTagging Pipeline Project

In gCube we use a Pipeline to tag all the repositories forming a gCube Release. The pipeline project is available at: https://jenkins.d4science.org/job/Pipeline-gCubeTagging/


Parameters

Jenkins tagging pipeline params.png

The pipeline takes as input the parameters needed to locate a commits report.

The commits report is generated by the Builder pipeline. The tagging pipeline assumes that the report is available at:

https://code-repo.d4science.org/gCubeCI/gCubeReleases/raw/branch/master/closed/<gcube_release_version>/build_commits.<report_number>.csv

Triggers

No triggers are defined because the pipeline is expected to be manually launched by the Release Manager:

Jenkins tagging pipeline triggers.png


It can be changed according to the release needs and the availability of a sufficient number of dedicate agents in Jenkins.

Git

The pipeline is maintained in a Git repository. This section connects the project to the Git repository.

Jenkins tagging pipeline git.png

Jenkins Pipeline Definition

Git Repository

The definition of the gCube release pipeline is maintained in this Git Repository: https://code-repo.d4science.org/gCubeCI/gCubeTagging.

Requirements on Jenkins

Jenkins Pipeline Execution

In order to use as input the following sample report available at https://code-repo.d4science.org/gCubeCI/gCubeRelease/raw/branch/master/releases/4.10.0/build_commits.12.csv:

GroupID,ArtifactID,Version,SCM URL,Build Number,Distribution URL,Filename,Packaging
org.gcube.tools,strategy-forward,1.1.0,https://code-repo.d4science.org/Playground/MergeStrategyFastForward,66f5fd1da37229615268955eeaf46870dd4d6576,...

We run the pipeline with the following parameters:

  • Type = TAG
  • gcube_release_number = 4.10.0
  • report_number = 12

On the jenkins console, we can see the messages logging the tagging activity on the repository:

Jenkins tagging pipeline console.png

On gitea, we can appreciate that the tag has been pushed;

Jenkins tagging pipeline gitea.png

On a local cloned repo, we can fetch the new tag:

Jenkins tagging pipeline repo.png

Tags

The pipeline must tag the master branch at the commit ID reported in the build report.

The commit is tagged twice:

  • v<component version>
  • r<Gcube Release number>

Tag Report

If the pipeline execution succeeds, it sends a tag report to the release manager. The report includes the following information for each Git repository tagged:

  • the artifact id
  • the artifact version
  • the SCM url
  • the commit tagged
  • the component tag pushed to the repository
  • the gCube release tag pushed to the repository

Here's an example of a tag report:

Jenkins-tag-report2.png

Back to the CI guide.