GithubHelp home page GithubHelp logo

buildit / jenkins-pipeline-libraries Goto Github PK

View Code? Open in Web Editor NEW
81.0 13.0 38.0 163 KB

Useful Jenkins Pipeline Libraries to use for whatever.

Groovy 95.48% Java 4.52%
jenkins jenkins-pipeline jenkins-shared-library

jenkins-pipeline-libraries's Introduction

Jenkins Pipeline Libraries

Build Status Download

Useful Jenkins Pipeline Libraries to use for whatever.

##Prerequisites

##Usage

  1. Add global library 'buildit' pointing to github in Jenkins settings (Manage Jenkins > Configure System > Global Pipeline Libraries)
  2. Add @Library('buildit') into your pipeline definition (more details here)

##Examples ###Build and push tag

registry = '<SOME ECR REGISTRY>'

stage "Set Up"
node{
    sh("if find lib/*; then rm lib/*; fi && curl -L https://github.com/buildit/jenkins-pipeline-libraries/archive/${env.PIPELINE_LIBS_VERSION}.zip -o lib.zip && echo 'A' | unzip -j lib.zip */lib/* -d lib")

    shell = load "lib/shell.groovy"
    pom = load "lib/pom.groovy"
    ecr = load "lib/ecr.groovy"
    tools = load "lib/tools.groovy"
}

node{
    
    git(url: "https://github.com/dermotmburke/hello-boot.git")
    def version = pom.version("pom.xml")
    def artifactId = pom.artifactId("pom.xml")
    
    stage "Build"
    tools.configureMaven()
    sh("mvn clean package")
    
    docker.withRegistry(registry) {
        ecr.authenticate("us-east-1")
        
        def image = docker.build("${artifactId}:v${version}", '.')
        
        stage "Docker Push"
        image.push(version)
        image.push("latest")
    }
}

###Select tag

registry = '<SOME ECR REGISTRY>'

stage "Set Up"
node{
    sh("if find lib/*; then rm lib/*; fi && curl -L https://github.com/buildit/jenkins-pipeline-libraries/archive/${env.PIPELINE_LIBS_VERSION}.zip -o lib.zip && echo 'A' | unzip -j lib.zip */lib/* -d lib")

    ui = load "lib/ui.groovy"
    ecr = load "lib/ecr.groovy"
    template = load "lib/template.groovy"
}

node{
    git(url: "https://github.com/dermotmburke/hello-boot.git")
    
    def tag = input(message: "Select Tag", parameters: [ui.dropdown("tag", "Tag") {
        ecr.imageTags("hello-boot", "us-east-1")
    }], submitter: null)
    
    def tmpFile = UUID.randomUUID().toString() + ".tmp"
    def ymlData = template.transform(readFile("docker-compose.yml.template"), [tag :tag])
    
    writeFile(file: tmpFile, text: ymlData)
    
    sh("convox login console.convox.com --password <PASSWORD>")
    sh("convox switch development")
    //sh("convox apps create hello-boot")
    sh("convox deploy --app hello-boot --file ${tmpFile}")

}

jenkins-pipeline-libraries's People

Contributors

1jenkins avatar davidmoss avatar dermotmburke avatar electroma avatar yannislionis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

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.