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

Add instructions for installing CI Builds and move install scripts here #184

30 changes: 30 additions & 0 deletions .rhdh/docs/installing-ci-builds.adoc
@@ -0,0 +1,30 @@
== Installing CI builds of Red Hat Developer Hub

*Prerequisites*

* You are logged in as an administrator on the OpenShift web console.
* You have configured the appropriate roles and permissions within your project to create an application. See the link:https://docs.openshift.com/container-platform/4.14/applications/index.html[Red Hat OpenShift documentation on Building applications] for more details.
* You have been granted permission to pull private images from the `rhdh` organization on quay.io. Ask the team for more info.

*Procedure*

. Add your Quay token to the cluster global pull secret (link:https://docs.openshift.com/container-platform/4.14/openshift_images/managing_images/using-image-pull-secrets.html#images-update-global-pull-secret_using-image-pull-secrets[link]):
+
[source,console]
----
$ oc get secret/pull-secret -n openshift-config --template='{{index .data ".dockerconfigjson" | base64decode}}' > /tmp/my-global-pull-secret.yaml
$ oc registry login --registry="quay.io" --auth-basic="<user>:<token>" --to=/tmp/my-global-pull-secret.yaml

$ oc set data secret/pull-secret -n openshift-config --from-file=.dockerconfigjson=/tmp/my-global-pull-secret.yaml

$ rm -f /tmp/my-global-pull-secret.yaml
----

. Run the installation script to create the RHDH Operator CatalogSource in your cluster. Use link:../scripts/install-rhdh-latest-build.sh[`install-rhdh-latest-build.sh`] to install the latest (upcoming version) build, and link:../scripts/install-rhdh-next-build.sh[`install-rhdh-next-build.sh`] to install the development build (from the `main` branch). For example:
+
[source,console]
----
$ curl -L https://raw.githubusercontent.com/janus-idp/operator/main/.rhdh/scripts/install-rhdh-latest-build.sh | bash
rm3l marked this conversation as resolved.
Show resolved Hide resolved
----

. In the *Administrator* perspective of the OpenShift web console, go to *Operators* → *OperatorHub*, search for Red Hat Developer Hub, and install the Red Hat Developer Hub Operator. For more info, see link:https://docs.openshift.com/container-platform/4.14/operators/admin/olm-adding-operators-to-cluster.html#olm-installing-from-operatorhub-using-web-console_olm-adding-operators-to-a-cluster[Installing from OperatorHub using the web console].
rm3l marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion .rhdh/docs/openshift.adoc
Expand Up @@ -7,7 +7,7 @@
* You are logged in as an _administrator_ to the OpenShift web console.
* You have configured the appropriate roles and permissions within your project to create an application.
See the https://docs.openshift.com/container-platform/4.14/applications/index.html[Red Hat OpenShift documentation on Building applications] for more details.
* If installing a CI build from quay.io/rhdh, you (or an administrator) have https://gist.github.com/nickboldt/d54ba9d7264a5480d14eea6c3bd2ecdf[added a RHDH Operator Catalog Source] and a https://gist.github.com/nickboldt/84bea28da11ec5aab549c182818356e0#file-oc-pull-secret-update-project-sh[pull secret]. For GA releases, this is not required.
* **(Optional for GA Releases)**. Refer to link:installing-ci-builds.adoc[Installing CI Builds of the RHDH Operator] if installing a CI build from `quay.io/rhdh`.
rm3l marked this conversation as resolved.
Show resolved Hide resolved

*Procedure*

Expand Down
109 changes: 109 additions & 0 deletions .rhdh/scripts/install-rhdh-latest-build.sh
@@ -0,0 +1,109 @@
# code yoinked from https://gitlab.cee.redhat.com/rhidp/rhdh/-/blob/rhdh-1-rhel-9/build/scripts/installCatalogSourceFromIIB.sh
rm3l marked this conversation as resolved.
Show resolved Hide resolved

TMPDIR=/tmp
NAMESPACE="openshift-operators"
INSTALL_PLAN_APPROVAL="Automatic"
OLM_CHANNEL="fast"

# log into your OCP cluster before running this or you'll get null values for OCP vars!
OCP_VER="v$(oc version -o json | jq -r '.openshiftVersion' | sed -r -e "s#([0-9]+\.[0-9]+)\..+#\1#")"
OCP_ARCH="$(oc version -o json | jq -r '.serverVersion.platform' | sed -r -e "s#linux/##")"
if [[ $OCP_ARCH == "amd64" ]]; then OCP_ARCH="x86_64"; fi
# if logged in, this should return something like latest-v4.12-x86_64
UPSTREAM_IIB="quay.io/rhdh/iib:latest-${OCP_VER}-${OCP_ARCH}";

TO_INSTALL="rhdh"

# Add ImageContentSourcePolicy to let resolve references to images not on quay as if from quay.io
ICSP_URL="quay.io/rhdh/"
ICSP_URL_PRE=${ICSP_URL%%/*}
# echo "[DEBUG] ${ICSP_URL_PRE}, ${ICSP_URL_PRE//./-}, ${ICSP_URL}"
echo "apiVersion: operator.openshift.io/v1alpha1
kind: ImageContentSourcePolicy
metadata:
name: ${ICSP_URL_PRE//./-}
spec:
repositoryDigestMirrors:
## 1. add mappings for Developer Hub bundle, operator, hub
- mirrors:
- ${ICSP_URL}rhdh-operator-bundle
source: registry.redhat.io/rhdh/rhdh-operator-bundle
- mirrors:
- ${ICSP_URL}rhdh-operator-bundle
source: registry.stage.redhat.io/rhdh/rhdh-operator-bundle
- mirrors:
- ${ICSP_URL}rhdh-operator-bundle
source: registry-proxy.engineering.redhat.com/rh-osbs/rhdh-rhdh-operator-bundle

- mirrors:
- ${ICSP_URL}rhdh-rhel9-operator
source: registry.redhat.io/rhdh/rhdh-rhel9-operator
- mirrors:
- ${ICSP_URL}rhdh-rhel9-operator
source: registry.stage.redhat.io/rhdh/rhdh-rhel9-operator
- mirrors:
- ${ICSP_URL}rhdh-rhel9-operator
source: registry-proxy.engineering.redhat.com/rh-osbs/rhdh-rhdh-rhel9-operator

- mirrors:
- ${ICSP_URL}rhdh-hub-rhel9
source: registry.redhat.io/rhdh/rhdh-hub-rhel9
- mirrors:
- ${ICSP_URL}rhdh-hub-rhel9
source: registry.stage.redhat.io/rhdh/rhdh-hub-rhel9
- mirrors:
- ${ICSP_URL}rhdh-hub-rhel9
source: registry-proxy.engineering.redhat.com/rh-osbs/rhdh-rhdh-hub-rhel9

## 2. general repo mappings
- mirrors:
- ${ICSP_URL_PRE}
source: registry.redhat.io
- mirrors:
- ${ICSP_URL_PRE}
source: registry.stage.redhat.io
- mirrors:
- ${ICSP_URL_PRE}
source: registry-proxy.engineering.redhat.com

### now add mappings to resolve internal references
- mirrors:
- registry.redhat.io
source: registry.stage.redhat.io
- mirrors:
- registry.stage.redhat.io
source: registry-proxy.engineering.redhat.com
- mirrors:
- registry.redhat.io
source: registry-proxy.engineering.redhat.com
" > $TMPDIR/ImageContentSourcePolicy_${ICSP_URL_PRE}.yml && oc apply -f $TMPDIR/ImageContentSourcePolicy_${ICSP_URL_PRE}.yml

echo "[INFO] Using iib $TO_INSTALL image $UPSTREAM_IIB"
IIB_IMAGE="${UPSTREAM_IIB}"
CATALOGSOURCE_NAME="${TO_INSTALL}-${OLM_CHANNEL}"

echo "apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
name: ${CATALOGSOURCE_NAME}
namespace: $NAMESPACE
spec:
sourceType: grpc
image: ${IIB_IMAGE}
publisher: IIB testing ${TO_INSTALL}
displayName: IIB testing catalog ${TO_INSTALL}
" > $TMPDIR/CatalogSource.yml && oc apply -f $TMPDIR/CatalogSource.yml

# Create subscription for operator
echo "apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
name: $TO_INSTALL
namespace: $NAMESPACE
spec:
channel: $OLM_CHANNEL
installPlanApproval: $INSTALL_PLAN_APPROVAL
name: $TO_INSTALL
source: ${CATALOGSOURCE_NAME}
sourceNamespace: $NAMESPACE
" > $TMPDIR/Subscription.yml && oc apply -f $TMPDIR/Subscription.yml
109 changes: 109 additions & 0 deletions .rhdh/scripts/install-rhdh-next-build.sh
@@ -0,0 +1,109 @@
# code yoinked from https://gitlab.cee.redhat.com/rhidp/rhdh/-/blob/rhdh-1-rhel-9/build/scripts/installCatalogSourceFromIIB.sh

TMPDIR=/tmp
NAMESPACE="openshift-operators"
INSTALL_PLAN_APPROVAL="Automatic"
OLM_CHANNEL="fast"

# log into your OCP cluster before running this or you'll get null values for OCP vars!
OCP_VER="v$(oc version -o json | jq -r '.openshiftVersion' | sed -r -e "s#([0-9]+\.[0-9]+)\..+#\1#")"
OCP_ARCH="$(oc version -o json | jq -r '.serverVersion.platform' | sed -r -e "s#linux/##")"
if [[ $OCP_ARCH == "amd64" ]]; then OCP_ARCH="x86_64"; fi
# if logged in, this should return something like next-v4.12-x86_64
UPSTREAM_IIB="quay.io/rhdh/iib:next-${OCP_VER}-${OCP_ARCH}";

TO_INSTALL="rhdh"

# Add ImageContentSourcePolicy to let resolve references to images not on quay as if from quay.io
ICSP_URL="quay.io/rhdh/"
ICSP_URL_PRE=${ICSP_URL%%/*}
# echo "[DEBUG] ${ICSP_URL_PRE}, ${ICSP_URL_PRE//./-}, ${ICSP_URL}"
echo "apiVersion: operator.openshift.io/v1alpha1
kind: ImageContentSourcePolicy
metadata:
name: ${ICSP_URL_PRE//./-}
spec:
repositoryDigestMirrors:
## 1. add mappings for Developer Hub bundle, operator, hub
- mirrors:
- ${ICSP_URL}rhdh-operator-bundle
source: registry.redhat.io/rhdh/rhdh-operator-bundle
- mirrors:
- ${ICSP_URL}rhdh-operator-bundle
source: registry.stage.redhat.io/rhdh/rhdh-operator-bundle
- mirrors:
- ${ICSP_URL}rhdh-operator-bundle
source: registry-proxy.engineering.redhat.com/rh-osbs/rhdh-rhdh-operator-bundle

- mirrors:
- ${ICSP_URL}rhdh-rhel9-operator
source: registry.redhat.io/rhdh/rhdh-rhel9-operator
- mirrors:
- ${ICSP_URL}rhdh-rhel9-operator
source: registry.stage.redhat.io/rhdh/rhdh-rhel9-operator
- mirrors:
- ${ICSP_URL}rhdh-rhel9-operator
source: registry-proxy.engineering.redhat.com/rh-osbs/rhdh-rhdh-rhel9-operator

- mirrors:
- ${ICSP_URL}rhdh-hub-rhel9
source: registry.redhat.io/rhdh/rhdh-hub-rhel9
- mirrors:
- ${ICSP_URL}rhdh-hub-rhel9
source: registry.stage.redhat.io/rhdh/rhdh-hub-rhel9
- mirrors:
- ${ICSP_URL}rhdh-hub-rhel9
source: registry-proxy.engineering.redhat.com/rh-osbs/rhdh-rhdh-hub-rhel9

## 2. general repo mappings
- mirrors:
- ${ICSP_URL_PRE}
source: registry.redhat.io
- mirrors:
- ${ICSP_URL_PRE}
source: registry.stage.redhat.io
- mirrors:
- ${ICSP_URL_PRE}
source: registry-proxy.engineering.redhat.com

### now add mappings to resolve internal references
- mirrors:
- registry.redhat.io
source: registry.stage.redhat.io
- mirrors:
- registry.stage.redhat.io
source: registry-proxy.engineering.redhat.com
- mirrors:
- registry.redhat.io
source: registry-proxy.engineering.redhat.com
" > $TMPDIR/ImageContentSourcePolicy_${ICSP_URL_PRE}.yml && oc apply -f $TMPDIR/ImageContentSourcePolicy_${ICSP_URL_PRE}.yml

echo "[INFO] Using iib $TO_INSTALL image $UPSTREAM_IIB"
IIB_IMAGE="${UPSTREAM_IIB}"
CATALOGSOURCE_NAME="${TO_INSTALL}-${OLM_CHANNEL}"

echo "apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
name: ${CATALOGSOURCE_NAME}
namespace: $NAMESPACE
spec:
sourceType: grpc
image: ${IIB_IMAGE}
publisher: IIB testing ${TO_INSTALL}
displayName: IIB testing catalog ${TO_INSTALL}
" > $TMPDIR/CatalogSource.yml && oc apply -f $TMPDIR/CatalogSource.yml

# Create subscription for operator
echo "apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
name: $TO_INSTALL
namespace: $NAMESPACE
spec:
channel: $OLM_CHANNEL
installPlanApproval: $INSTALL_PLAN_APPROVAL
name: $TO_INSTALL
source: ${CATALOGSOURCE_NAME}
sourceNamespace: $NAMESPACE
" > $TMPDIR/Subscription.yml && oc apply -f $TMPDIR/Subscription.yml