You should install VirtualBox and Vagrant before you start.
You should create a Vagrantfile
in an empty directory with the following content:
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
$master_cpus = 2 | |
$master_memory = 2048 | |
$num_workers = 3 | |
$worker_cpus = 4 | |
$worker_memory = 4096 | |
$common_script = <<-SCRIPT |
+---------------------------------------------------------------+ | |
| * * * PUSH REJECTED BY EVIL DRAGON BUREAUCRATS * * * | | |
+---------------------------------------------------------------+ | |
\ | |
\ ^ /^ | |
\ / \ // \ | |
\ |\___/| / \// .\ | |
\ /V V \__ / // | \ \ *----* | |
/ / \/_/ // | \ \ \ | | |
@___@` \/_ // | \ \ \/\ \ |
You should install VirtualBox and Vagrant before you start.
You should create a Vagrantfile
in an empty directory with the following content:
Some Jenkinsfile examples |
pipeline { | |
// run on jenkins nodes tha has java 8 label | |
agent { label 'java8' } | |
// global env variables | |
environment { | |
EMAIL_RECIPIENTS = '[email protected]' | |
} | |
stages { | |
stage('Build with unit testing') { |
#!/bin/bash | |
#ONE LINE | |
#sudo wget -Nnv 'https://gist.githubusercontent.com/kydouglas/1f68d69e856fd6d7dc223f8e1f5ae3b3/raw/f8c3b22b9d9c41093150b96c815776956b523d9d/elk.sh' && bash elk.sh && rm -f elk.sh | |
# Checking whether user has enough permission to run this script | |
sudo -n true | |
if [ $? -ne 0 ] | |
then | |
echo "This script requires user to have passwordless sudo access" |
def getProjectName() { | |
return 'JenkinsPipeline' | |
} | |
def getJDKVersion() { | |
return 'jdk1.8.0_101' | |
} | |
def getMavenConfig() { | |
return 'maven-config' |
#!/bin/bash | |
REPO_URL="https://repository.xxx.net/repository/" | |
USER="admin" | |
PASSWORD="datpassword" | |
BUCKET="portal-docker" | |
KEEP_IMAGES=10 | |
IMAGES=$(curl --silent -X GET -H 'Accept: application/vnd.docker.distribution.manifest.v2+json' -u ${USER}:${PASSWORD} "${REPO_URL}${BUCKET}/v2/_catalog" | jq .repositories | jq -r '.[]' ) |
#!/usr/bin/env groovy | |
// Deploy Hello World Service Stack | |
node('java') { | |
properties([parameters([ | |
choice(choices: ["ci", "dev", "test", "uat"].join("\n"), | |
description: 'Environment', name: 'ENVIRONMENT') | |
])]) | |
stage('Git Checkout') { |
#!/bin/bash | |
# Parse df selected output | |
df -h|egrep -v 'File|tmpfs|docker|udev'| \ | |
while read LINE; do | |
USED_NUMBER=`echo $LINE |awk '{print $5}'|sed 's/\%//'|sed 's/ //g'` | |
USED_PERCENT=`echo $LINE |awk '{print $5}'|sed 's/ //g'` | |
MOUNT_POINT=`echo $LINE |awk '{print $6}'|sed 's/ //g'` | |
if [ $USED_NUMBER -gt 80 ]; then | |
# Create message without spaces |