Code Monkey home page Code Monkey logo

jenkins-shared-library-examples's Introduction

Jenkins Shared Library Test

This repo demonstrate the minimal viable best practice for Jenkins Shared Library.

How to use this Repo to learn?

Every subfolder in ./pipeline-scripts represents an example. Each folder comes with two file old.Jenkinsfile, representing pipeline script without shared library, and new.Jenkinsfile representing equavilent code with shared library. In ./vars each .groovy file is a Shared Library, the shared library name ./vars/${LibraryName} is the same as ./pipeline-scripts/${LibraryName}.

You can copy and paste the content of old.Jenkinsfile to Jenkins Pipeline Configuration and run once. And then do the same thing with new.Jenkinsfile.

Setup your Jenkins before playing with this Repo

Jenkins -> Manage Jenkins -> Configure System -> Search: Global Pipeline Libraries

Fill in git url, check "Load Implicitly" (if not check, you need to manually declare @Library("${LibraryName}") at begin of your Jenkinsfile). So your Jenkins system can load shared library implemented in this repo.

What is Jenkins Shared Library?

You may already very familiar with Jenkins pipeline scripts. Actually those node {}, stages("...") {}, steps { ... }, script{ ... }, withCredential() { ... } syntax are simply shared library implemented in community plugins. Those declaritive are predefined in a groovy script like node|stages|steps|script|withCredential.groovy, and you will see available parameters in plugin source code.

jenkins-shared-library-examples's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.