Skip to content

Commit

Permalink
Update install-osp.sh to support nightly…
Browse files Browse the repository at this point in the history
… and run test in their own project

Signed-off-by: Vincent Demeester <[email protected]>
  • Loading branch information
vdemeester authored and openshift-merge-bot[bot] committed Dec 4, 2023
1 parent a145802 commit 7204ea6
Showing 1 changed file with 75 additions and 23 deletions.
98 changes: 75 additions & 23 deletions hack/install-osp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,48 +22,100 @@ function rollout_status() {
fi
}

function install_channel() {
local channel="${1}"
echo "Installing OpenShift Pipelines from channel ${channel}"
cat <<EOF | oc apply -f-
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
name: openshift-pipelines-operator-rh
namespace: openshift-operators
spec:
channel: ${channel}
name: openshift-pipelines-operator-rh
source: redhat-operators
sourceNamespace: openshift-marketplace
EOF
}

function install_nightly() {
oc patch operatorhub.config.openshift.io/cluster -p='{"spec":{"disableAllDefaultSources":true}}' --type=merge
sleep 2
# Add a custom catalog-source
cat <<EOF | oc apply -f-
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
name: custom-osp-nightly
namespace: openshift-marketplace
spec:
sourceType: grpc
image: quay.io/openshift-pipeline/openshift-pipelines-operator-index:1.10
displayName: "Custom OSP Nightly"
updateStrategy:
registryPoll:
interval: 30m
EOF
sleep 10
# Create the "correct" subscription
oc delete subscription pipelines -n openshift-operators || true
cat <<EOF | oc apply -f-
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
name: openshift-pipelines-operator
namespace: openshift-operators
spec:
channel: latest
name: openshift-pipelines-operator-rh
source: custom-osp-nightly
sourceNamespace: openshift-marketplace
EOF
}

OSP_VERSION=${1:-latest}
shift

CHANNEL=""

case "$OSP_VERSION" in
nightly)
echo "Not supporting nightly just yet"
# FIXME add support for it
exit 0
install_nightly
;;
latest)
CHANNEL="latest"
install_channel latest
;;
*)
CHANNEL="pipelines-$OSP_VERSION"
install_channel "pipelines-$OSP_VERSION"
;;
esac

echo "Installing OpenShift Pipelines from channel ${CHANNEL}"
cat <<EOF | oc apply -f-
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
name: openshift-pipelines-operator-rh
namespace: openshift-operators
spec:
channel: ${CHANNEL}
name: openshift-pipelines-operator-rh
source: redhat-operators
sourceNamespace: openshift-marketplace
# wait until tekton pipelines operator is created
echo "Waiting for OpenShift Pipelines Operator to be created..."
timeout 2m bash <<- EOF
until oc get deployment openshift-pipelines-operator -n openshift-operators; do
sleep 5
done
EOF
oc rollout status -n openshift-operators deployment/openshift-pipelines-operator --timeout 10m

# FIXME(vdemeester) do better than waiting 2m for the namespace to appear
echo "Waiting for OpenShift Pipelines Operator to be available"
sleep 120
# wait until clustertasks tekton CRD is properly deployed
timeout 10m bash <<- EOF
until oc get crd tasks.tekton.dev; do
sleep 5
done
EOF

timeout 2m bash <<- EOF
until oc get deployment tekton-pipelines-controller -n openshift-pipelines; do
sleep 5
done
EOF
rollout_status "openshift-pipelines" "tekton-pipelines-controller"
rollout_status "openshift-pipelines" "tekton-pipelines-webhook"

oc get -n openshift-pipelines pods
tkn version

# Make sure we are on the default project
oc project default
oc new-project e2e-test
oc project e2e-test

0 comments on commit 7204ea6

Please sign in to comment.