Cicd documentation layout


Getting Started with Shared Library



Download 6.25 Mb.
Page13/39
Date15.06.2023
Size6.25 Mb.
#61535
1   ...   9   10   11   12   13   14   15   16   ...   39
CIcd
Getting Started with Shared Library
A shared library is a collection of groovy files (DSLs + Groovy). All the groovy files should be present it a git repo.
Shared library repo has the following folder structure.

vars: This directory holds all the global shared library code that can be called from a pipeline. It has all the library files with a groovy extension. It also supports .txt files for the documentation of shared library code. For example, if you have a file named maven-build.groovy, you can have a help file named maven-groovy.txt. In this file, you can write the respective shared library function help documentation in markdown format. The help file can be viewed from /pipeline-syntax/globals page. 
src: It is a regular java source directory. It is added to the class path during every script compilation. Here you can add custom groovy code to extend your shared library code. Also, you can import existing Jenkins and plugins classes using an import statement.
There will be scenarios where your groovy DSL’s will not be flexible enough to achieve some functionality. In this case, you can write custom groovy functions in src and call it in your shared library code.
resources: All the non-groovy files required for your pipelines can be managed in this folder. One such example is, you might need a common JSON template to make an API call during the build. This JSON template can be stored in the resources folder and called can be called in the shared library using library Resource function.


4.12. How to Configure Jenkins Shared Library?



5. MAVEN:

5.1. Introduction to Maven:




  • Maven is a project management tool from apache organisation (Apache is a open source for many tools).

  • Maven is a comprehensive project Management tools, however people call it as Build & Dependency Management tool and mainly used for java-based projects.

  • We can automate build process using maven project dependency.

  • It is an external jar(code) file on which our projects depend on.

  • Jar contains predefined reusable logic developed by some third party companies and collection of .class file[A.Java---->compile---->A.class, Run on any platform]

Download 6.25 Mb.

Share with your friends:
1   ...   9   10   11   12   13   14   15   16   ...   39




The database is protected by copyright ©ininet.org 2024
send message

    Main page