Skip to content

Instantly share code, notes, and snippets.


Block or report user

Report or block smalltown

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View repo.yaml
- id: /.*/
# apply_requirements sets the Apply Requirements for all repos that match.
apply_requirements: [mergeable]
# workflow sets the workflow for all repos that match.
# This workflow must be defined in the workflows section.
allowed_overrides: [workflow]
smalltown / Jenkins_Job_DSL_GitLab_Trigger
Created Oct 21, 2017
Jenkins job DSL for integrating GitLab
View Jenkins_Job_DSL_GitLab_Trigger
import jenkins.model.Jenkins
// define global variable
def job_folder = 'job_folder'
def job_name = 'job_name'
pipelineJob("${job_folder}/${job_name}") {
triggers {
gitlab {
View Jenkins_Pipeline_Slack
import groovy.json.*
def deploy(phase, version, user, branch, status = 'Success', region = 'Oregon', channel = 'none', repoer = 'true', repo_host, repo_owner) {
def slack_info = slack_info.load()
def http_client = new com.droi.pipeline.jenkins.httpRequest(slack_info.hook_protocol, slack_info.hook_fqdn, slack_info.hook_port.toInteger())
def header = ["Content-Type": "application/json"]
def url = "${slack_info.hook_protocol}://${slack_info.hook_fqdn}/${slack_info.hook_uri}"
def response = [:]
# clean old properties and script file
rm -rf *
# copy the latest properties and script file
cp -rf /var/lib/jenkins/dsl-repo/config ./
cp -rf /var/lib/jenkins/dsl-repo/dsl ./
cp -rf /var/lib/jenkins/dsl-repo/pipeline ./
# reload pipeline global library
rm -rf /tmp/workflowLibs
View ApproveScript.groovy
// This Groovy snippet is used for Jenkins Job DSL groovy script,
// when ...
// 1. enable Jenkins Global Security
// 2. use pipelineJob
// 3. want to approve pipeline cps automatically
import jenkins.model.Jenkins
View chef_users_recipe_group
search("groups", "*:*").each do |group_data|
group group_data["id"] do
gid group_data["gid"]
members group_data["members"]
View chef_users_recipe_default
# Cookbook Name:: users
# Recipe:: default
# Copyright (c) 2016 The Authors, All Rights Reserved.
search("users", "*:*").each do |user_data|
user user_data["id"] do
comment user_data["comment"]
uid user_data["uid"]
View chef_data_bag_group_clowns
"id": "clowns",
"gid": 3000,
"members": ["bobo", "frank"]
View chef_data_bag_users_frank
"id": "frank",
"comment": "Frank Belson",
"uid": 2001,
"gid": 0,
"home": "/home/frank",
"shell": "/bin/bash"
View chef_data_bag_users_bobo
"id": "bobo",
"comment": "Bobo T. Clown",
"uid": 2000,
"gid": 0,
"home": "/home/bobo",
"shell": "/bin/bash"
You can’t perform that action at this time.