Skip to content

Instantly share code, notes, and snippets.

@nickboldt
Last active May 12, 2021 16:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nickboldt/e35b659770f57234152cc2934bcfc330 to your computer and use it in GitHub Desktop.
Save nickboldt/e35b659770f57234152cc2934bcfc330 to your computer and use it in GitHub Desktop.
get related images from a given CSV as list of sorted/unique images, or name=value;name2=value2... pairs to use in KIP configmap
# 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
# Re: https://access.redhat.com/documentation/en-us/red_hat_codeready_workspaces/2.8/html-single/administration_guide/index#installing-image-puller-on-openshift-using-openshift-templates_crw
# Table 8.3. Image Puller OpenShift templates parameters in configmap.yaml
# for {image-puller-images} = env var = container name;var2=container2;...
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")) | .name+"="+.value' | \
sort -u | sed -r -e "s#RELATED_IMAGE_##g" | tr -st "\n\r" ";"
#############################################################################################
# Che 7.30
# https://www.eclipse.org/che/docs/che-7/administration-guide/defining-the-list-of-images-to-pull/
curl -sSLo- https://raw.githubusercontent.com/eclipse-che/che-operator/main/deploy/olm-catalog/stable/eclipse-che-preview-openshift/manifests/che-operator.clusterserviceversion.yaml | \
yq -r '.spec.install.spec.deployments[].spec.template.spec.containers[].env[] | select(.name | test("RELATED_IMAGE_.*"; "g")) | .value' | \
sort -u
# https://www.eclipse.org/che/docs/che-7/administration-guide/installing-image-puller-on-openshift-using-openshift-templates/
curl -sSLo- https://raw.githubusercontent.com/eclipse-che/che-operator/main/deploy/olm-catalog/stable/eclipse-che-preview-openshift/manifests/che-operator.clusterserviceversion.yaml | \
yq -r '.spec.install.spec.deployments[].spec.template.spec.containers[].env[] | select(.name | test("RELATED_IMAGE_.*"; "g")) | .name+"="+.value' | \
sort -u | sed -r -e "s#RELATED_IMAGE_##g" | tr -st "\n\r" ";"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment