Skip to content

Commit

Permalink
feat(RHIDP-2305): switch framework to RHDH v1.2
Browse files Browse the repository at this point in the history
Signed-off-by: Pavel Macík <[email protected]>
  • Loading branch information
pmacik committed Jun 10, 2024
1 parent 2b946e6 commit c92927d
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 22 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ export RHDH_IMAGE_TAG ?=

# RHDH Helm chart to deploy
export RHDH_NAMESPACE ?= rhdh-performance
export RHDH_HELM_REPO ?= https://raw.githubusercontent.com/rhdh-bot/openshift-helm-charts/rhdh-1.1-rhel-9/installation
export RHDH_HELM_REPO ?= https://raw.githubusercontent.com/rhdh-bot/openshift-helm-charts/rhdh-1.2-rhel-9/installation
export RHDH_HELM_CHART ?= redhat-developer-hub
export RHDH_HELM_CHART_VERSION ?=
export RHDH_HELM_RELEASE_NAME ?= rhdh

# RHDH OLM subscription to deploy
export RHDH_OLM_INDEX_IMAGE ?= registry.redhat.io/redhat/redhat-operator-index:v$(shell oc version -o json | jq -r '.openshiftVersion' | sed -r -e "s,([0-9]+\.[0-9]+)\..+,\1,")
export RHDH_OLM_CHANNEL ?= fast-1.1
export RHDH_OLM_INDEX_IMAGE ?= quay.io/rhdh/iib:1.2-v$(shell oc version -o json | jq -r '.openshiftVersion' | sed -r -e "s,([0-9]+\.[0-9]+)\..+,\1,")-$(shell oc version -o json | jq -r '.serverVersion.platform' | sed -r -e "s,linux/,," | sed -e 's,amd64,x86_64,')
export RHDH_OLM_CHANNEL ?= fast

# RHDH horizontal scaling
export RHDH_DEPLOYMENT_REPLICAS ?= 1
Expand Down
29 changes: 15 additions & 14 deletions ci-scripts/rhdh-setup/create_resource.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ create_per_grp() {
fi
done
done
if [[ 'create_cmp' == "${1}" ]] ; then clone_and_upload "component-*.yaml" ;fi
if [[ 'create_api' == "${1}" ]] ; then clone_and_upload "api-*.yaml" ;fi
if [[ 'create_cmp' == "${1}" ]]; then clone_and_upload "component-*.yaml"; fi
if [[ 'create_api' == "${1}" ]]; then clone_and_upload "api-*.yaml"; fi
}

clone_and_upload() {
Expand All @@ -100,24 +100,25 @@ clone_and_upload() {
git push -f --set-upstream origin "$tmp_branch"
cd ..
sleep 5
rhdh_token=$(curl -s -k "$(backstage_url)/api/auth/guest/refresh"|jq -r '.backstageIdentity.token')
rhdh_token=$(curl -s -k "$(backstage_url)/api/auth/guest/refresh" | jq -r '.backstageIdentity.token')
for filename in "${files[@]}"; do
e_count=$(yq eval '.metadata.name | capture(".*-(?<value>[0-9]+)").value' "$filename" |tail -n 1)
e_count=$(yq eval '.metadata.name | capture(".*-(?P<value>[0-9]+)").value' "$filename" | tail -n 1)
upload_url="${GITHUB_REPO%.*}/blob/${tmp_branch}/$(basename "$filename")"
echo "Uploading entities from $upload_url"
curl -k "$(backstage_url)/api/catalog/locations" -X POST -H 'Accept-Encoding: gzip, deflate, br' -H 'Authorization: Bearer '"$rhdh_token" -H 'Content-Type: application/json' --data-raw '{"type":"url","target":"'"${upload_url}"'"}'

timeout_timestamp=$(date -d "300 seconds" "+%s")
while true; do
if [ "$(date "+%s")" -gt "$timeout_timestamp" ]; then
echo "ERROR: Timeout waiting on entity count"
exit 1
else
if [[ 'component-*.yaml' == "${1}" ]] ; then b_count=$(curl -s -k "$(backstage_url)/api/catalog/entity-facets?facet=kind" -H 'Content-Type: application/json' -H 'Authorization: Bearer '"$rhdh_token" |jq -r '.facets.kind[] | select(.value == "Component")| .count') ;fi
if [[ 'api-*.yaml' == "${1}" ]] ; then b_count=$(curl -s -k "$(backstage_url)/api/catalog/entity-facets?facet=kind" -H 'Content-Type: application/json' -H 'Authorization: Bearer '"$rhdh_token" |jq -r '.facets.kind[] | select(.value == "API")| .count') ;fi
if [[ $b_count -ge $e_count ]] ; then break;fi
fi
echo "Waiting for the entity count ${e_count}"
sleep 10s
if [ "$(date "+%s")" -gt "$timeout_timestamp" ]; then
echo "ERROR: Timeout waiting on entity count"
exit 1
else
if [[ 'component-*.yaml' == "${1}" ]]; then b_count=$(curl -s -k "$(backstage_url)/api/catalog/entity-facets?facet=kind" -H 'Content-Type: application/json' -H 'Authorization: Bearer '"$rhdh_token" | jq -r '.facets.kind[] | select(.value == "Component")| .count'); fi
if [[ 'api-*.yaml' == "${1}" ]]; then b_count=$(curl -s -k "$(backstage_url)/api/catalog/entity-facets?facet=kind" -H 'Content-Type: application/json' -H 'Authorization: Bearer '"$rhdh_token" | jq -r '.facets.kind[] | select(.value == "API")| .count'); fi
if [[ $b_count -ge $e_count ]]; then break; fi
fi
echo "Waiting for the entity count to be ${e_count} (current: ${b_count})"
sleep 10s
done
done
for filename in "${files[@]}"; do
Expand Down
10 changes: 6 additions & 4 deletions ci-scripts/rhdh-setup/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@ export RHDH_IMAGE_REGISTRY=${RHDH_IMAGE_REGISTRY:-}
export RHDH_IMAGE_REPO=${RHDH_IMAGE_REPO:-}
export RHDH_IMAGE_TAG=${RHDH_IMAGE_TAG:-}

export RHDH_HELM_REPO=${RHDH_HELM_REPO:-https://raw.githubusercontent.com/rhdh-bot/openshift-helm-charts/rhdh-1.1-rhel-9/installation}
export RHDH_HELM_REPO=${RHDH_HELM_REPO:-https://raw.githubusercontent.com/rhdh-bot/openshift-helm-charts/rhdh-1.2-rhel-9/installation}
export RHDH_HELM_CHART=${RHDH_HELM_CHART:-redhat-developer-hub}
export RHDH_HELM_CHART_VERSION=${RHDH_HELM_CHART_VERSION:-}

export RHDH_OLM_INDEX_IMAGE="${RHDH_OLM_INDEX_IMAGE:-registry.redhat.io/redhat/redhat-operator-index:v$(oc version -o json | jq -r '.openshiftVersion' | sed -r -e "s#([0-9]+\.[0-9]+)\..+#\1#")}"
export RHDH_OLM_CHANNEL=${RHDH_OLM_CHANNEL:-fast-1.1}
OCP_VER="$(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/##" | sed -e 's#amd64#x86_64#')"
export RHDH_OLM_INDEX_IMAGE="${RHDH_OLM_INDEX_IMAGE:-quay.io/rhdh/iib:1.2-v${OCP_VER}-${OCP_ARCH}}"
export RHDH_OLM_CHANNEL=${RHDH_OLM_CHANNEL:-fast}

export PRE_LOAD_DB="${PRE_LOAD_DB:-true}"
export BACKSTAGE_USER_COUNT="${BACKSTAGE_USER_COUNT:-1}"
Expand Down Expand Up @@ -141,7 +143,7 @@ backstage_install() {
echo "Installing RHDH with install method: $INSTALL_METHOD"
cp "template/backstage/app-config.yaml" "$TMP_DIR/app-config.yaml"
if [ "${AUTH_PROVIDER}" == "keycloak" ]; then yq -i '. |= . + {"signInPage":"oauth2Proxy"}' "$TMP_DIR/app-config.yaml"; fi
if [ "${AUTH_PROVIDER}" == "keycloak" ]; then yq -i '. |= . + {"auth":{"environment":"production","providers":{"oauth2Proxy":{}}}}' "$TMP_DIR/app-config.yaml"; else yq -i '. |= . + {"auth":{"providers":{"guest":{"dangerouslyAllowOutsideDevelopment":true}}}}' "$TMP_DIR/app-config.yaml"; fi
if [ "${AUTH_PROVIDER}" == "keycloak" ]; then yq -i '. |= . + {"auth":{"environment":"production","providers":{"oauth2Proxy":{}}}}' "$TMP_DIR/app-config.yaml"; else yq -i '. |= . + {"auth":{"providers":{"guest":{"dangerouslyAllowOutsideDevelopment":true}}}}' "$TMP_DIR/app-config.yaml"; fi
until envsubst <template/backstage/secret-rhdh-pull-secret.yaml | $clin apply -f -; do $clin delete secret rhdh-pull-secret --ignore-not-found=true; done
until $clin create configmap app-config-rhdh --from-file "app-config.rhdh.yaml=$TMP_DIR/app-config.yaml"; do $clin delete configmap app-config-rhdh --ignore-not-found=true; done
envsubst <template/backstage/plugin-secrets.yaml | $clin apply -f -
Expand Down
2 changes: 1 addition & 1 deletion ci-scripts/rhdh-setup/install-rhdh-catalog-source.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ OCP_VER="v$(oc version -o json | jq -r '.openshiftVersion' | sed -r -e "s#([0-9]
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="${UPSTREAM_IIB:-${OLM_INDEX_IMAGE_BASE:-quay.io/rhdh/iib:next}-${OCP_VER}-${OCP_ARCH}}"
UPSTREAM_IIB="${UPSTREAM_IIB:-${OLM_INDEX_IMAGE_BASE:-quay.io/rhdh/iib:latest}-${OCP_VER}-${OCP_ARCH}}"

while [[ "$#" -gt 0 ]]; do
case $1 in
Expand Down

0 comments on commit c92927d

Please sign in to comment.