Skip to content

Instantly share code, notes, and snippets.

View john24rel's full-sized avatar

JOHN OSHIKOYA john24rel

View GitHub Profile
@john24rel
john24rel / Jenkinsfile.groovy
Created May 27, 2022 19:28 — forked from Faheetah/Jenkinsfile.groovy
Jenkinsfile idiosynchrasies with escaping and quotes
node {
echo 'Results included as an inline comment exactly how they are returned as of Jenkins 2.121, with $BUILD_NUMBER = 1'
echo 'No quotes, pipeline command in single quotes'
sh 'echo $BUILD_NUMBER' // 1
echo 'Double quotes are silently dropped'
sh 'echo "$BUILD_NUMBER"' // 1
echo 'Even escaped with a single backslash they are dropped'
sh 'echo \"$BUILD_NUMBER\"' // 1
echo 'Using two backslashes, the quotes are preserved'
sh 'echo \\"$BUILD_NUMBER\\"' // "1"
@john24rel
john24rel / create-self-signed-certificate.sh
Created April 19, 2021 03:55 — forked from ivan-pinatti/create-self-signed-certificate.sh
Create self-signed certificate - #linux #openssl #certificate
#!/usr/bin/env bash
: ' Script to create self-signed certificate
'
# check if debug flag is set
if [ "${DEBUG}" = true ]; then
set -x # enable print commands and their arguments as they are executed.
@john24rel
john24rel / export-mysql.sh
Created April 19, 2021 03:55 — forked from ivan-pinatti/export-mysql.sh
Export MySQL database with optimized options - #mysql #database #export #bash
#!/usr/bin/env bash
: ' A simple MySQL dump script with optimized options
'
# check if debug flag is set
if [ "${DEBUG}" = true ]; then
set -x # enable print commands and their arguments as they are executed.
@john24rel
john24rel / import-mysql.sh
Created April 19, 2021 03:55 — forked from ivan-pinatti/import-mysql.sh
Import MySQL database with optimized options - #mysql #database #import #bash
#!/usr/bin/env bash
: ' A simple MySQL import script with optimized options
'
# check if debug flag is set
if [ "${DEBUG}" = true ]; then
set -x # enable print commands and their arguments as they are executed.
@john24rel
john24rel / jenkins-set-system-message.groovy
Created April 19, 2021 03:54 — forked from ivan-pinatti/jenkins-set-system-message.groovy
Jenkins - Set Jenkins system message via groovy script - #jenkins #groovy #system #message
#!groovy
// imports
import jenkins.model.Jenkins
// parameters
def systemMessage = "Insert your Jenkins system message here."
// get Jenkins instance
Jenkins jenkins = Jenkins.getInstance()
@john24rel
john24rel / jenkins-set-global-shared-library.groovy
Created April 19, 2021 03:54 — forked from ivan-pinatti/jenkins-set-global-shared-library.groovy
Jenkins - Set Global Share Library plugin parameters via groovy script - #jenkins #groovy #library #shared #sharedLibrary
#!groovy
// imports
import hudson.scm.SCM
import jenkins.model.Jenkins
import jenkins.plugins.git.GitSCMSource
import org.jenkinsci.plugins.workflow.libs.*
import org.jenkinsci.plugins.workflow.libs.LibraryConfiguration
import org.jenkinsci.plugins.workflow.libs.SCMSourceRetriever
@john24rel
john24rel / Dockerfile
Created April 13, 2021 04:40 — forked from ealebed/Dockerfile
Airflow_Kubernetes
FROM python:3.7-slim-stretch
LABEL maintainer="Yevhen Lebid <yevhen.lebid@loopme.com>"
# Never prompts the user for choices on installation/configuration of packages
ENV DEBIAN_FRONTEND=noninteractive \
TERM=linux
# Airflow
ARG AIRFLOW_VERSION=1.10.7
@john24rel
john24rel / Jenkinsfile.validate
Created April 13, 2021 04:40 — forked from ealebed/Jenkinsfile.validate
Flyway migration validations (free, open-source version)
pipeline {
agent any
stages {
stage("Prepare environment") {
steps {
script {
sh "docker-compose -f docker-compose.yaml down --remove-orphans --volumes"
}
}
@john24rel
john24rel / create-jobs.groovy
Created April 13, 2021 04:39 — forked from ealebed/create-jobs.groovy
Groovy script for creating Jenkins job from .yaml file
@Grab(group='org.yaml', module='snakeyaml', version='1.18')
import jenkins.model.*
import hudson.model.*
import hudson.triggers.*
import hudson.tasks.LogRotator
import hudson.plugins.git.*
import hudson.plugins.git.extensions.*
import hudson.plugins.git.extensions.impl.*
import org.jenkinsci.plugins.workflow.job.WorkflowJob
import org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition
@john24rel
john24rel / helm
Created April 8, 2021 17:49 — forked from johnbuhay/helm
$ cat `which helm`
#!/usr/bin/env bash
set -x
docker run --rm \
-e KUBECONFIG=${KUBECONFIG//$HOME/\/root} \
-v ~/.kube:/root/.kube/:ro \
-v ~/.helm:/root/.helm/:rw \
helm "$@"