Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRW-3876 add option to pass startingCSV to... #878

Open
wants to merge 2 commits into
base: devspaces-3.3-rhel-8
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions product/installCatalogSourceFromIIB.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ NAMESPACE="openshift-operators"
DISABLE_CATALOGSOURCES="false"
INSTALL_PLAN_APPROVAL="Automatic"
OLM_CHANNEL="fast"
STARTING_CSV=""

# default ICSP to use to resolve unreleased images
# if using --fast or --quay flag, this will be changed to quay.io
Expand Down Expand Up @@ -53,8 +54,9 @@ Options:
: * brew.registry.redhat.io/rh-osbs/iib:987654 [RH public, auth required], or
: * quay.io/devspaces/iib:3.2-v4.11-987654 or quay.io/devspaces/iib:next-v4.10 [public]
--install-operator <NAME> : Install operator named $NAME after creating CatalogSource
--channel <CHANNEL> : Channel to use for operator subscription if installing operator. Default: "fast"
--manual-updates : Use "manual" InstallPlanApproval for the CatalogSource instead of "automatic" if installing operator
--channel <CHANNEL> : Channel to use for operator subscription if installing operator. Default: 'fast'
--manual-updates : Use 'manual' InstallPlanApproval for the CatalogSource instead of 'automatic' if installing operator
--startingCSV <x.y.z> : Set the version of operator to install via the subscription. If unset, install the latest available
--disable-default-sources : Disable default CatalogSources. Default: false
--quay : Resolve images from quay.io using ImageContentSourcePolicy
--brew : Resolve images from brew.registry.redhat.io using ImageContentSourcePolicy (requires authentication)
Expand All @@ -77,6 +79,7 @@ while [[ "$#" -gt 0 ]]; do
'--install-operator') TO_INSTALL="$2"; shift 1;;
'--channel') OLM_CHANNEL="$2"; shift 1;;
'--manual-updates') INSTALL_PLAN_APPROVAL="Manual";;
'--startingCSV') STARTING_CSV=" startingCSV: $2"; shift 1;;
'--disable-default-sources') DISABLE_CATALOGSOURCES="true";;
'--icsp') ICSP_URLs="${ICSP_URLs} $2"; shift 1;;
'--quay') ICSP_URLs="${ICSP_URLs} quay.io";;
Expand Down Expand Up @@ -254,7 +257,7 @@ spec:
- mirrors:
- registry.redhat.io/devspaces/devspaces-operator-bundle
source: registry-proxy.engineering.redhat.com/rh-osbs/devspaces-operator-bundle
" > $TMPDIR/ImageContentSourcePolicy_${ICSP_URL}.yml && oc apply -f $TMPDIR/ImageContentSourcePolicy_${ICSP_URL}.yml
" > "${TMPDIR}/ImageContentSourcePolicy_${ICSP_URL}.yml" && oc apply -f "${TMPDIR}/ImageContentSourcePolicy_${ICSP_URL}.yml"
done
fi

Expand All @@ -270,7 +273,7 @@ spec:
image: ${IIB_IMAGE}
publisher: IIB testing ${TO_INSTALL}
displayName: IIB testing catalog ${TO_INSTALL}
" > $TMPDIR/CatalogSource.yml && oc apply -f $TMPDIR/CatalogSource.yml
" > "${TMPDIR}"/CatalogSource.yml && oc apply -f "${TMPDIR}"/CatalogSource.yml

if [ -z "$TO_INSTALL" ]; then
echo "Done"
Expand All @@ -285,7 +288,7 @@ kind: OperatorGroup
metadata:
name: $NAMESPACE-operators
namespace: $NAMESPACE
" > $TMPDIR/OperatorGroup.yml && oc apply -f $TMPDIR/OperatorGroup.yml
" > "${TMPDIR}"/OperatorGroup.yml && oc apply -f "${TMPDIR}"/OperatorGroup.yml
fi

# Create subscription for operator
Expand All @@ -300,7 +303,8 @@ spec:
name: $TO_INSTALL
source: ${TO_INSTALL}-${OLM_CHANNEL}
sourceNamespace: $NAMESPACE
" > $TMPDIR/Subscription.yml && oc apply -f $TMPDIR/Subscription.yml
${STARTING_CSV}
" > "${TMPDIR}"/Subscription.yml && oc apply -f "${TMPDIR}"/Subscription.yml

# cleanup temp yaml files
rm -fr $TMPDIR
rm -fr "${TMPDIR}"
25 changes: 15 additions & 10 deletions product/installDevSpacesFromLatestIIB.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ CREATE_USERS="false"
GET_URL="true"
DWO_VERSION="" # by default, install from latest release
DISABLE_CATALOGSOURCESFLAG="" # by default, allow installation from default catalog sources; use --next or --disable-default-sources to disable
DS_STARTING_CSV="" # by default, install the latest version from the catalog source; can use this to install something older
DWO_STARTING_CSV="" # by default, install the latest version from the catalog source; can use this to install something older

# subscription channels
CHANNEL_DWO="fast"
Expand Down Expand Up @@ -87,8 +89,9 @@ Options:
: For example, given https://console-openshift-console.apps.my-cluster-here.com instance,
: use 'my-cluster-here.com' (or longer format: 'api.my-cluster-here.com:6443')

--disable-default-sources
: Disable default CatalogSources, like the RH Ecosystem Cataloge. Default: false
--ds-startingCSV <x.y.z> : Set the version of DS operator to install via the subscription. If unset, install the latest available
--dwo-startingCSV <x.y.z> : Set the version of DWO operator to install via the subscription. If unset, install the latest available
--disable-default-sources : Disable default CatalogSources, like the RH Ecosystem Cataloge. Default: false

--dwo <VERSION> : Dev Workspace Operator version to test, e.g. '0.15'. Optional
--dwo-chan <CHANNEL>: Dev Workspace Operator channel to install; default: $CHANNEL_DWO (if --quay flag used, default: fast)
Expand Down Expand Up @@ -123,8 +126,8 @@ preflight() {
# Download specified dsc version to /tmp and use that
if [[ "$DSC_OPTION" =~ ^3\..*-(GA|CI)$ ]]; then
DSC_VER="${DSC_OPTION}"
rm -fr /tmp/dsc-${DSC_VER}/; mkdir -p /tmp/dsc-${DSC_VER}/
pushd /tmp/dsc-${DSC_VER}/ >/dev/null
rm -fr "/tmp/dsc-${DSC_VER}/"; mkdir -p "/tmp/dsc-${DSC_VER}/"
pushd "/tmp/dsc-${DSC_VER}/" >/dev/null
asset_dir="${DSC_VER}-dsc-assets"
# old folder format
# echo "curl https://github.com/redhat-developer/devspaces-chectl/releases/download/${asset_dir}/devspaces-${DSC_VER/-CI/}-quay-dsc-linux-x64.tar.gz ... "
Expand Down Expand Up @@ -248,6 +251,8 @@ while [[ "$#" -gt 0 ]]; do
'--iib-ds') IIB_DS="$2"; if [[ $IIB_DS == "quay.io/devspaces/iib"* ]]; then CHANNEL_DS="fast"; ICSP_FLAGs="${ICSP_FLAGs} --icsp quay.io"; fi; shift 1;;
'--quay'|'--fast') IIB_DS="quay.io/devspaces/iib"; CHANNEL_DS="fast"; CHANNEL_DWO="fast"; ICSP_FLAGs="${ICSP_FLAGs} --icsp quay.io";;
'--latest'|'--next') IIB_DS="quay.io/devspaces/iib"; CHANNEL_DS="fast"; CHANNEL_DWO="fast"; ICSP_FLAGs="${ICSP_FLAGs} --icsp quay.io"; DS_VERSION="${1//--/}";;
'--ds-startingCSV') DS_STARTING_CSV="--startingCSV $2"; shift 1;;
'--dwo-startingCSV') DWO_STARTING_CSV="--startingCSV $2"; shift 1;;
'--disable-default-sources') DISABLE_CATALOGSOURCESFLAG="$1";;
'--brew') ICSP_FLAGs="${ICSP_FLAGs} --icsp brew.registry.redhat.io";;
'--icsp') ICSP_FLAGs="${ICSP_FLAGs} --icsp $2"; shift 1;;
Expand Down Expand Up @@ -296,7 +301,7 @@ if [[ $IIB_DWO ]]; then
--iib "$IIB_DWO" \
--install-operator "devworkspace-operator" \
--channel "$CHANNEL_DWO" \
--namespace "$OLM_NAMESPACE" ${ICSP_FLAGs} ${DISABLE_CATALOGSOURCESFLAG}
--namespace "$OLM_NAMESPACE" ${ICSP_FLAGs} ${DISABLE_CATALOGSOURCESFLAG} ${DWO_STARTING_CSV}
fi

if [[ ! $IIB_DS ]]; then
Expand Down Expand Up @@ -324,7 +329,7 @@ fi
--iib "$IIB_DS" \
--install-operator "devspaces" \
--channel "$CHANNEL_DS" \
--namespace "$OLM_NAMESPACE" ${ICSP_FLAGs} ${DISABLE_CATALOGSOURCESFLAG}
--namespace "$OLM_NAMESPACE" ${ICSP_FLAGs} ${DISABLE_CATALOGSOURCESFLAG} ${DS_STARTING_CSV}

elapsed=0
inc=3
Expand Down Expand Up @@ -407,7 +412,7 @@ if [[ $(command -v ${DSC}) ]]; then # use dsc
echo "Using dsc from ${DSC}"
${DSC} server:deploy \
--catalog-source-namespace=openshift-operators \
--catalog-source-name=devspaces-${CHANNEL_DS} --olm-channel=${CHANNEL_DS} \
--catalog-source-name=devspaces-"${CHANNEL_DS}" --olm-channel="${CHANNEL_DS}" \
--package-manifest-name="devspaces" -n "${NAMESPACE}" \
--listr-renderer=verbose --telemetry=off

Expand All @@ -417,7 +422,7 @@ if [[ $(command -v ${DSC}) ]]; then # use dsc
else
# TODO: add support for custom patch YAML
if [ -z "$CHECLUSTER_PATH" ]; then
oc create namespace $NAMESPACE || true
oc create namespace "$NAMESPACE" || true
echo "apiVersion: org.eclipse.che/v2
kind: CheCluster
metadata:
Expand Down Expand Up @@ -447,7 +452,7 @@ spec:
storage:
pvcStrategy: common
networking: {}
" > $TMPDIR/CheCluster.yml && oc apply -f $TMPDIR/CheCluster.yml
" > "$TMPDIR/CheCluster.yml" && oc apply -f "$TMPDIR/CheCluster.yml"
else
oc apply -f "$CHECLUSTER_PATH"
fi
Expand All @@ -456,7 +461,7 @@ kind: OperatorGroup
metadata:
name: devspaces-operator
namespace: ${NAMESPACE}
" > $TMPDIR/OperatorGroup.yml && oc apply -f $TMPDIR/OperatorGroup.yml
" > "$TMPDIR/OperatorGroup.yml" && oc apply -f "$TMPDIR/OperatorGroup.yml"
fi

if [[ $GET_URL != "true" ]]; then
Expand Down