Skip to content

Instantly share code, notes, and snippets.

View sboardwell's full-sized avatar

Steve Boardwell sboardwell

  • CloudBees
  • Berlin
View GitHub Profile
@sboardwell
sboardwell / install-jce.sh
Last active October 13, 2017 07:09
Utils for installing JCE in java dirs or JDK tar.gz archives
#!/usr/bin/env bash
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
set -euo pipefail
function cleanUp() {
local exitCode=$?
[ $exitCode -ne 0 ] && echo "ERROR: The script is exiting with an error. Please check the logs above."
[ -f "${myJceZip:-}" ] && echo "CLEANUP: Cleaning up jce zip..." && rm -f "${myJceZip}"
add_certificates() {
local envType=$1
local secretName ns
kubectl apply -f <(sops -d cert-manager-utils/01-clouddns-service-account.yaml)
kubectl apply -f <(sops -d cert-manager-utils/01-cloudflare-api-key.yaml)
kubectl apply -f cert-manager-utils/02-clusterissuer-${envType}.yaml
kubectl apply -f cert-manager-utils/03-cluster-certificate-${envType}.yaml
# get the secret name
secretName=$(cat cert-manager-utils/03-cluster-certificate-${envType}.yaml | docker run -i --rm evns/yq yq -r '.spec.secretName')
@sboardwell
sboardwell / kubernetes-replicator-install.sh
Last active June 25, 2019 13:10
kubernetes-replicator-install.sh
{
rm -rf /tmp/kr/kubernetes-replicator
mkdir -p /tmp/kr/kubernetes-replicator
(cd /tmp/kr/kubernetes-replicator && git clone --depth 1 --branch v1.0.0 [email protected]:mittwald/kubernetes-replicator.git .)
(cd /tmp/kr/kubernetes-replicator && helm upgrade --install --namespace kubernetes-replicator kubernetes-replicator ./deploy/helm-chart/kubernetes-replicator)
kubectl get all -n kubernetes-replicator
}
$ kubectl -n kube-system get certificates
NAME READY SECRET AGE
jxing-nginx-ingress-controller-wildcard-prod True jxing-nginx-ingress-controller-wildcard-prod-tls 5d
jxing-nginx-ingress-controller-wildcard-staging True jxing-nginx-ingress-controller-wildcard-staging-tls 11d
@sboardwell
sboardwell / add_default_ssl_cert.sh
Last active June 25, 2019 20:46
add_default_ssl_cert.sh
die() { echo "$@" 1>&2 ; exit 1; }
dieGracefully() { echo "$@" 1>&2 ; exit 0; }
confirm () {
# call with a prompt string or use a default
read -p "${1:-Are you sure?} [y/N]" -n 1 -r
[ -n "$REPLY" ] && echo # (optional) move to a new line
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
dieGracefully "Received '${REPLY:-N}'. ${2:-Exiting gracefully}."
#!/usr/bin/env bash
# Script to get a list of plugins from a Jenkins server
set -euo pipefail
# set the necessary vars
JENKINS_URL=${JENKINS_URL:-http://localhost:8080}
JENKINS_USER=${JENKINS_USER:-admin}
JENKINS_TOKEN=${JENKINS_TOKEN} # eg. abcd1234abcd1234abcd1234
// SecurityRealm
import jenkins.model.Jenkins
import hudson.security.SecurityRealm
import org.jenkinsci.plugins.googlelogin.GoogleOAuth2SecurityRealm
clientID = null
clientSecret = null
securityRealm = null
// secret sanity check
// SecurityRealm
import jenkins.model.Jenkins
import hudson.security.SecurityRealm
import org.jenkinsci.plugins.GithubSecurityRealm
clientID = null
clientSecret = null
securityRealm = null
// secret sanity check
/*
Inspiration taken from the github page below.
Changes made:
- allowing the configuration to be taken from a file
- this will allow the script to be used in a docker/k8s environment
with the configuration in a mounted secret.
*/
/*
Copyright (c) 2015-2018 Sam Gleske - https://github.com/samrocketman/jenkins-bootstrap-shared
@sboardwell
sboardwell / myvalues.yaml
Created August 5, 2019 20:20
Adding the Jenkins docker image.
jenkins:
Master:
Image: my-reg/my-company/jenkins-x-image
ImageTag: 0.0.70-1