Skip to content

Instantly share code, notes, and snippets.

View chmouel's full-sized avatar
🤨
Kuberneting

Chmouel Boudjnah chmouel

🤨
Kuberneting
View GitHub Profile
@chmouel
chmouel / create-multiple-codebase-and-search-latest.bash
Last active January 4, 2019 14:27
Create multiple codebases to different spaces in WIT, search it but only get the latest one
#!/usr/bin/env zsh
set -e
# URL
WIT_SERVICE=f8wit-build.devtools-dev.ext.devshift.net
AUTH_SERVICE=auth-build.devtools-dev.ext.devshift.net
# This can't be a git@github* thing, because with does some conversion
CODE_BASE=https://github.com/chmouel/fabric8-build4.git
randomword () {
func newPodForCR(cr *jrv1alpha1.JenkinsFileRunner) *corev1.Pod {
branch := cr.Spec.RepoBranch
if branch == "" {
branch = "master"
}
rev := cr.Spec.RepoRev
if rev == "" {
rev = "origin/master"
}
clusters:
- cluster:
certificate-authority-data: a
server: https://chmouel-api.devcluster.openshift.com:6443
name: chmouel
contexts:
- context:
cluster: chmouel
user: admin
name: admin
#!/usr/bin/env bash
set -e
# set -x
# You can change this manually if you like (ie windows)
PLATFORM=$(uname -s)
PLATFORM=${PLATFORM,,} # Lowercase it
# Change this if you like
INSTALLPATH=/usr/local/bin/minikube
T=taskrun
RUN=$(oc get ${T} -o json | jq -r '.items[].metadata.name' | fzf -1)
podname=$(oc get ${T} ${RUN} -o json | jq -r '.status.podName')
containerStatuses=$(oc get pod ${podname} -o json | jq -r '.status.containerStatuses[] | (.name + "|" + .state.terminated.reason)')
for cont in ${containerStatuses}; do
[[ $cont == *Error ]] && {
buildstep=${cont/|Error/}
echo "Showing failed step: ${buildstep}"
package main
import (
"fmt"
"log"
"os/user"
)
func main() {
userc, err := user.Current()
#!/bin/bash
PERSONAL_GIT_REMOTE=chmouel # usually your github username
RELEASE_VERSION=${1:-v0.2.0} # Tekton latest release from where you are going to release from
# detect current branch
currentb=$(git rev-parse --abbrev-ref HEAD)
# Push current branch to your user
git push ${PERSONAL_GIT_REMOTE} -u ${currentb}
#!/usr/bin/env bash
# Chmouel Boudjnah <[email protected]>
RELEASETYPE=4.0.0-0.ci
LATEST=https://openshift-release.svc.ci.openshift.org/releasestream/${RELEASETYPE}/latest/download
set -e
READLINK=readlink;type -p greadlink >/dev/null 2>/dev/null && READLINK=greadlink #osx brew readlink detection
SED=sed;type -p gsed >/dev/null 2>/dev/null && SED=gsed #osx brew sed detection
SD=$($READLINK -f $(dirname $0))
@chmouel
chmouel / os4-install.bash
Last active April 25, 2019 00:01
install openshift 4 in loop
#!/usr/bin/env bash
# set -x
set -e
SD=$(readlink -f $(dirname $0))
IC=$(readlink -f $(dirname $0)/install-config.yaml )
DIR=${SD}/os4
function recreate() {
@chmouel
chmouel / yaml2json.sh
Created April 24, 2019 23:12
Convert yaml to json via the command line
#!/usr/bin/env bash
[[ -n $1 ]] && from=$1 || from=/dev/stdin
python3 -c 'import sys, yaml, json; json.dump(yaml.load(sys.stdin), sys.stdout, indent=4);print()' < ${from} | jq '.'