Skip to content

Instantly share code, notes, and snippets.

Avatar

Nick Boldt nickboldt

View GitHub Profile
@nickboldt
nickboldt / csv-to-containers.sh
Last active May 12, 2021
get related images from a given CSV as list of sorted/unique images, or name=value;name2=value2... pairs to use in KIP configmap
View csv-to-containers.sh
# CRW 2.8
# Re: https://access.redhat.com/documentation/en-us/red_hat_codeready_workspaces/2.8/html-single/administration_guide/index#defining-the-list-of-images-to-pull_crw
# Example 8.1. Getting the list of all relevant images for CodeReady Workspaces
# for list of containers only
curl -sSLo- https://raw.githubusercontent.com/redhat-developer/codeready-workspaces-operator/crw-2.8-rhel-8/manifests/codeready-workspaces.csv.yaml | \
yq -r '.spec.install.spec.deployments[].spec.template.spec.containers[].env[] | select(.name | test("RELATED_IMAGE_.*"; "g")) | .value' | \
sort -u
View gist:c38ea07145f4e096293fd2edf0c90a04
brew list-tagged crw-2-rhel-8-container-candidate | grep operator-metadata
brew untag crw-2-rhel-8-container-candidate \
codeready-workspaces-rhel8-operator-metadata-container-2.8-23 \
codeready-workspaces-rhel8-operator-metadata-container-2.8-25 \
# ...
@nickboldt
nickboldt / go.cheat.adoc
Last active Apr 9, 2021
go cheat sheet
View go.cheat.adoc

get latest deps into a vendor/ folder:

go mod tidy || true; go get -d -t || true; go mod download || true; go mod vendor || true

go build options:

-mod=readonly == break if go.mod not current w.r.t. vendor folder (online mode)
@nickboldt
nickboldt / check-rpms-installed-in-container.sh
Created Jan 29, 2021
check rpms installed in a container (or diff two containers)
View check-rpms-installed-in-container.sh
# copied from a jenkins job last used in Dec 2019 for CRW 2.0
alias dr='docker run --rm --entrypoint /bin/bash'
if [[ ${CONTAINER1} ]]; then
dr ${CONTAINER1} -c "rpm -qa | sort" | tee CONTAINER1.installed.rpms.txt &
fi
if [[ ${CONTAINER2} ]]; then
dr ${CONTAINER2} -c "rpm -qa | sort" | tee CONTAINER2.installed.rpms.txt &
fi
@nickboldt
nickboldt / obtainImageVersions.sh
Created Jan 22, 2021
obtainImageVersions.sh :: get server + registry images from an OCP 4.x CRW 2.x deployment and compare those digests to the latest in Quay
View obtainImageVersions.sh
#!/bin/bash
NAMESPACE=$1
function obtainPodName(){
local podPartialName=$1
echo "$(oc get pods -n $NAMESPACE | grep $podPartialName | awk '{print $1;}' | awk 'NR==1{print $1}')"
}
@nickboldt
nickboldt / pr1.yaml
Last active Dec 2, 2020
2 ways to do github action to authenticate against registry.redhat.io
View pr1.yaml
name: Test crw-build token for authenticated connection to RHEC (option 1)
# note, this only works against pull requests from the origin fork (redhat-developer, eclipse), not from personal forks,
# as secrets cannot be copied to user forks and end up being blank
on: [pull_request]
jobs:
job1:
runs-on: ubuntu-18.04
steps:
- name: Checkout code
@nickboldt
nickboldt / crwctldeploy2
Last active Aug 21, 2020
installing CRW 2.3 via operatorhub / olm method v2, based on https://gitlab.cee.redhat.com/flacatus/custom-catalog
View crwctldeploy2
#!/bin/bash
set +e +x
tmpdir=$(mktemp -d)
CONTAINERS=(\
crw-2-rhel8-operator-metadata \
devfileregistry-rhel8 \
pluginregistry-rhel8 \
server-rhel8 \
@nickboldt
nickboldt / create-custom-catalog.sh
Last active Jul 29, 2020
create a custom catalog index in quay for use when deploying CRW 2.3 via crwctl server:start -a olm
View create-custom-catalog.sh
#!/bin/bash
# create a custom catalog for CRW 2.3 operator metadata
cd /tmp
if [[ ! -x /usr/local/bin/opm ]]; then
OPM_image="registry.redhat.io/openshift4/ose-operator-registry:v4.5"
echo "Download opm binary from ${OPM_image}"
oc image extract ${OPM_image} --path /usr/bin/opm:/tmp --confirm
chmod +x /tmp/opm
@nickboldt
nickboldt / crwctldeploy
Last active Aug 21, 2020
installing CRW 2.3 via operatorhub / olm method
View crwctldeploy
#!/bin/bash
set +e +x
# for a specific version, see either quay or redhat folders:
# https://codeready-workspaces-jenkins.rhev-ci-vms.eng.rdu2.redhat.com/view/CRW_CI/view/Pipelines/job/crwctl_master/lastSuccessfulBuild/artifact/codeready-workspaces-chectl/dist/channels/quay/
# https://codeready-workspaces-jenkins.rhev-ci-vms.eng.rdu2.redhat.com/view/CRW_CI/view/Pipelines/job/crwctl_master/lastSuccessfulBuild/artifact/codeready-workspaces-chectl/dist/channels/redhat/codeready-workspaces-2.3.0-GA-crwctl-linux-x64.tar.gz
VER=2.3.0-CI # or specific release like 2.3.0-GA
CHANNEL="quay" # for CI, use Quay, for GA, use redhat
# set project namespace default