Skip to content

Instantly share code, notes, and snippets.

View jkeam's full-sized avatar
🍻

Jon Keam jkeam

🍻
View GitHub Profile
@jkeam
jkeam / mac_openjdk.sh
Created June 18, 2020 13:51
This is how I installed OpenJDK on my Mac.
#!/bin/bash
brew tap AdoptOpenJDK/openjdk
# can install adoptopenjdk8 or adoptopenjdk11
brew cask install adoptopenjdk8
# list all installed
# /usr/libexec/java_home -V
# switch java version, use 1.8, or 11
@jkeam
jkeam / install-java.md
Created July 12, 2020 04:53
Instructions on how to install and manage Java in Ubuntu 20

Java Installation and Management in Ubuntu 20

Installation

sudo apt-get install openjdk-8-jdk

# don't worry, you can apt-get multiple java versions
sudo apt-get install openjdk-11-jdk
#sudo apt-get install openjdk-...  <tab complete to see all available versions>
@jkeam
jkeam / mac_graalvm.sh
Last active July 13, 2020 18:15
Install GraalVM on a Mac
#!/bin/bash
# install
brew cask install graalvm/tap/graalvm-ce-java11
# update
# brew cask upgrade graalvm/tap/graalvm-ce-java11
# update JAVA_HOME
export JAVA_HOME=/Library/Java/JavaVirtualMachines/graalvm-ce-java11-20.1.0/Contents/Home
@jkeam
jkeam / find_reports_dir.py
Last active August 12, 2020 00:22
Pom Reports Directory
import xml.etree.ElementTree as ET
import re
def find_reports_dir(pom_file):
""" Return the report directory specified in the pom """
# extract and set namespace
root = ET.parse(pom_file).getroot()
m = re.findall(r'{(.*?)}', root.tag)
namespace = m[0] if m else ''
ns = {'maven': namespace}
@jkeam
jkeam / curl_upload_signature.py
Last active September 30, 2020 17:55
Brain dump of a rough outline of the step to upload signatures via curl.
"""StepImplementer for the upload-container-image step using curl.
TODO: doc me
Mandatory Inputs:
1.
# entire file path of where the signature is
#includes temporary directory where signature is located
'container-image-signature-file-path'
@jkeam
jkeam / nodejs-sample-pipeline.yml
Created November 29, 2020 19:39
OpenShift 101 Workshop - Jenkins Node Pipeline BuildConfig
kind: "BuildConfig"
apiVersion: "build.openshift.io/v1"
metadata:
name: "nodejs-sample-pipeline"
spec:
strategy:
jenkinsPipelineStrategy:
jenkinsfile: |-
// path of the template to use
def templatePath = 'nodejs-mongodb-example'
@jkeam
jkeam / openshift_enforce_image_signature.md
Last active November 30, 2020 18:07
OpenShift Enforce Image Signature

Signing Validation

Assumptions

  1. Valid image in some registry, say something like docker.io:/jonnyman9/hello-node:latest
  2. Valid signature being served by some signature server, say something like https://sigserver.com
  3. You have access to the public PGP key used to sign the image, say something like pubring.gpg

Steps

There really only is 1 important file we need, the machine-config.yaml that forces the host to verify the image against some signature when pulling it in. This one file however is made up of 3 smaller components:

@jkeam
jkeam / url.sh
Created April 22, 2021 15:37
Open URL from the command line for MacOSX
#!/bin/bash
# Taken from: https://superuser.com/questions/153245/how-can-i-open-google-chrome-via-command-line-with-a-url-in-incognito-mode
url() {
url=$([[ $1 =~ ^[a-zA-Z]{1,}: ]] && printf '%s\n' "$1" || printf '%s\n' "http://$1")
open -a 'Google Chrome' "$url"
}
@jkeam
jkeam / clear_kubeconfig.sh
Created April 25, 2021 18:00
Clear Kube Config
#!/bin/bash
cat ~/.kube/config | yq e '.clusters.[].name' - | while read -r line; do oc config unset contexts.$line; done
cat ~/.kube/config | yq e '.contexts.[].name' - | while read -r line; do oc config unset contexts.$line; done
cat ~/.kube/config | yq e '.users.[].name' - | while read -r line; do oc config unset contexts.$line; done
echo 'done'
@jkeam
jkeam / compliance_operator_demo.md
Last active April 30, 2021 22:03
Compliance Operator Script

Compliance Operator Demo Script

Steps

  1. Use right project
oc project openshift-compliance
  1. See all profiles