Giter VIP home page Giter VIP logo

jenkins-library's Introduction

DEPRECATED

This repo is no longer maintained. I am keeping it around for reference for devs that want to write some groovy.

Jenkins Library

Instructions for setting up this Jenkins pipeline library which will query GitHub for the corresponding commit payload, save the commit author as an environment variable which is then used in the Slack notifier which posts messages as a bot user to your build-log slack channel.

Table of contents

Demo

Required Jenkins plugins

  • Pipeline: GitHub Groovy Libraries 1.0
  • HTTP Request Plugin 1.8.22

Quick start

These instructions are intended to assist in setting up this Jenkins pipeline library.

  1. Create a Jenkins credential (type: secret text) which contains a GitHub PAT

  2. Create a Slack app

    • Create a bot user
    • Create a Jenkins credential (type: secret text)
      • ID: slack-token
      • Secret: Bot User OAuth Access Token from the Slack app you created
  3. Fork this repo to your own GitHub account or GitHub organization

    • Update all of the configuration properties in Config.groovy
      • For GITHUB_TOKEN_CRED_ID you will need to use the credential id you made in step 1
  4. Configure Jenkins

    • In Jenkins instance, navigate to Manage Jenkins > Configure System and scroll down to the Global Pipeline Libraries section
    • Key Configuration settings
      • Default version: master
      • Load implicitly: False
      • Allow default version to be overridden: True
      • Include @Library changes in job recent changes: True
      • Retrieval method: Modern SCM
      • Source Code Management: GitHub
      • Credentials: Use the credential id you made in step 1
      • Owner: coltenkrauter (typically this is your orginazation or username)
      • Repository: jenkins-library
      • Behaviors: Discover branches, all branches
    • Of course, save the changes
  5. Import the library into groovy files

    • Add this to the top of files your Jenkinsfile
      #!/usr/bin/env groovy
      @Library("jenkins-library@master")
      
      import hudson.model.*;
      
      env.BUILD_START = new Date();
      env.SUCCESS = "true";
      

Checkout Jenkinsfile for a usage example.

jenkins-library's People

Contributors

ckrauterlovescoffee avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

spg7484

jenkins-library's Issues

Update build executer

    build_user = "John Doe"
    build_user_id = "jdoe"
    build_user_email = "[email protected]"

    wrap([$class: 'BuildUser']) {
      build_user = BUILD_USER
      build_user_id = BUILD_USER_ID
      build_user_email = BUILD_USER_EMAIL
    }

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.