Skip to content

Instantly share code, notes, and snippets.

View ajohnstone's full-sized avatar

Andrew Johnstone ajohnstone

View GitHub Profile
@NonCPS
def getAllCauses() {
currentBuild.rawBuild.getCauses().toString()
}
@NonCPS
def isIssueCommentCause() {
def triggerCause = currentBuild.rawBuild.getCause(org.jenkinsci.plugins.pipeline.github.trigger.IssueCommentCause)
if (triggerCause) {
env.TRIGGER_COMMENT=triggerCause.comment
if ( pullRequest.title.toString() =~ /^([A-Z]+\-[0-9]+|NO_JIRA)/ ) {
echo 'invalid-jira - ' + pullRequest.title
pullRequest.createStatus(status: 'success',
context: 'pull-request-fmt',
description: 'pull request contains valid jira ticket',
targetUrl: "${env.JOB_URL}/testResults")
} else {
echo 'valid-jira - ' + pullRequest.title
pullRequest.createStatus(status: 'failure',
context: 'pull-request-fmt',
kubectl proxy &
kubectl delete cluster my-cluster --ignore-not-found=true
kubectl delete crd cluster --ignore-not-found=true
cat <<EOF | kubectl apply -f -
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: clusters.stable.example.com
spec:
group: stable.example.com
import boto3
r53_client = boto3.client('route53')
hosted_zone = 'alias.photobox.com.'
def lambda_handler(event = {}, context = {}):
aws_region = event['detail']['awsRegion']
elb_client = boto3.client('elb', region_name=aws_region)
$ curl -s https://api.cqc.org.uk/public/v1/providers/1-101614751 | jq '.';
{
"providerId": "1-101614751",
"locationIds": [
"1-107338589",
"1-107338606"
],
"organisationType": "Provider",
"ownershipType": "Organisation",
"type": "Social Care Org",
START="$(date +'%Y-%m-%dT%H:%M:%S' --date '-5 minutes')";
END="$(date +'%Y-%m-%dT%H:%M:%S')";
aws elb describe-load-balancers | jq -r '.LoadBalancerDescriptions[].LoadBalancerName' | while read LB; do
DATA=$(aws cloudwatch get-metric-statistics \
--namespace AWS/ELB \
--metric-name "RequestCount" \
--dimensions '[{"Name":"LoadBalancerName","Value":"'$LB'"}]' \
--start-time "$START" \
--end-time "$END" \
--period 60 \

Keybase proof

I hereby claim:

  • I am ajohnstone on github.
  • I am ajohnstone (https://keybase.io/ajohnstone) on keybase.
  • I have a public key whose fingerprint is 3657 5228 12EA F1FF 9A2E B738 1B09 88E9 DD22 D552

To claim this, I am signing this object:

#!/bin/bash
DEBUG=1;
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
exit 1
fi
GREP="`which grep`";
#!/usr/bin/env bash
UPDATE_ELB_POLICY=${UPDATE_ELB_POLICY:-0};
TMPFILE=`mktemp -t example.XXXXXXXXXX` && {
printf "Region|Status|Current security policy|Expected security policy|ELB|Action\n" >> "${TMPFILE}";
aws ec2 describe-regions |awk -F'"' '/RegionName/ {print $4}' | while read region; do
LATEST_PREDEFINED_SECURITY_GROUP=$(aws --region=$region elb describe-load-balancer-policies | grep -i PolicyName | awk -F '"' '{print $4}' | head -n1 | sed 's/[ \r\n]//g');

The kubernetes cluster has nodes of m3.medium and only have a emphemeral storage capacity of 4gb.

This is easily utilized, and therefore need to increase the total size.

I've allocated the following so technically the LVM group could utilise the following. However its unclear how to automatically get it to expand the volume.

export MASTER_DISK_TYPE='gp2';
export MASTER_DISK_SIZE=250