O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.

Jenkins Shared Libraries

531 visualizações

Publicada em

A brief introduction to Jenkins Shared Libraries

Publicada em: Software
  • Seja o primeiro a comentar

  • Seja a primeira pessoa a gostar disto

Jenkins Shared Libraries

  1. 1. Jenkins Shared Libraries Paolo D'Incau @pdincau
  2. 2. DevOps Teams are cross-functional and have end-to-end responsibility on their products.
  3. 3. Not only features! Teams are also in charge to support production, monitor applications and to create/maintain pipelines that fit their needs best.
  4. 4. Jenkins pipelines With Jenkins you can create pipelines using groovy code. Deployment becomes developer friendly!
  5. 5. Beware duplication Some steps (e.g. deploy) are very similar across teams: you don’t want each team to reinvent the wheel.
  6. 6. Separate concerns You may want to make some things “opaque” to the teams (e.g. changes in orchestrator version, IP address, …).
  7. 7. Shared libraries You can harness Jenkins Shared Libraries and create a set of functionalities that each team can import and use in their pipelines.
  8. 8. Example Let’s see how we can write a library that each team will use to deploy a given containerised application on a generic orchestrator.
  9. 9. Code organisation
  10. 10. src and vars Directory ‘src’ has a standard Java source directory structure. It is added to the classpath when executing your pipelines. Directory ‘vars’ contains scripts that define global variables accessible from your pipelines.
  11. 11. Tips I
  12. 12. Serializable Your classes should implement Serializable when they have state, this is needed in order to allow Jenkins to stop and resume your pipelines properly.
  13. 13. Tips II
  14. 14. Logging You can’t log directory using ‘println’ or ‘echo’, you have to pass through ‘steps#echo’ which is available in the pipeline context.
  15. 15. Configuration
  16. 16. Use
  17. 17. Conclusions Jenkins shared libraries are a wonderful tool if you want to ‘DRY’ some common patterns that emerged in your pipelines. Remember that you are inside Jenkins, so things may behave a little different from what you think.
  18. 18. www.xpeppers.com /xpepperssrl@xpeppers

×