From 5f139d6f3392d82a510c3a7f70fbc7681bea8435 Mon Sep 17 00:00:00 2001 From: Anatoliy Bazko Date: Thu, 23 Jan 2020 14:04:30 +0200 Subject: [PATCH 1/2] Add RELEASE.md Signed-off-by: Anatoliy Bazko --- RELEASE.md | 68 ++++++++++++ make-release.sh | 226 +++++++++++++++++++++++++++++++++++++++ olm/release-olm-files.sh | 4 + 3 files changed, 298 insertions(+) create mode 100644 RELEASE.md create mode 100755 make-release.sh diff --git a/RELEASE.md b/RELEASE.md new file mode 100644 index 0000000000..deca76f609 --- /dev/null +++ b/RELEASE.md @@ -0,0 +1,68 @@ +# `che-operator` release process + +## 1. Release files + +```bash +./make-release.sh +``` + +## 2. Testing release on crc + +Start a cluster using `cluster-bot` application. + +To be able to test update it is needed to created some user before. Login as `kubeadmin`. At the middle of the dashboard click `Update OAuth configuration`. Then `Identidy providers` -> `Add` -> `HTPassword` and upload a htpassword file (can be created with HTPassword utility). Login using HTPassword, logout and login again as `kubeadmin`. Go to `kube:admin` menu -> `Copy Login Command` -> `Display Token` and launch to showing command in the terminal. Now it is possible to test update by launching: + +```bash +olm/testUpdates.sh openshift stable +``` + +Open Eclipse Che dashboard to validate that the correct version is installed and workspace can be created: + +```bash +echo http://$(kubectl get ingress -n che | grep ^che | awk -F ' ' '{ print $2 }') +``` + +Open the url in the anonymous tab. + +## 3. Testing release on minikube + +Run script to test updates: + +```bash +olm/testUpdates.sh kubernetes stable +``` + +Open Eclipse Che dashboard to validate that the correct version is installed and workspace can be created: + +```bash +xdg-open http://$(kubectl get ingress -n che | grep ^che | awk -F ' ' '{ print $2 }') +``` + +## 4. Testing release on minishift + +Login to local minishift cluster: + +```bash +oc login +``` + +Install the previous version of Eclipse Che: + +```bash +chectl server:start --platform=minikube --installer=operator --che-operator-image=quay.io/eclipse/che-operator: +``` + +Update Eclipse Che to the latest version. Validate that the correct version is installed and workspace can be created: + +```bash +chectl server:update --platform=minishift --installer=operator +xdg-open http://$(kubectl get ingress -n che | grep ^che | awk -F ' ' '{ print $2 }') +``` + +## 5. Prepare community operator PR + +```bash +olm/prepare-community-operators-update.sh +``` + +TODO automate creating PRs diff --git a/make-release.sh b/make-release.sh new file mode 100755 index 0000000000..8ef98a2fd6 --- /dev/null +++ b/make-release.sh @@ -0,0 +1,226 @@ +#!/bin/bash +# +# Copyright (c) 2019 Red Hat, Inc. +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +# +# Contributors: +# Red Hat, Inc. - initial API and implementation + +set -e +set -u + +init() { + RED='\033[0;31m' + NC='\033[0m' +} + +check() { + if [ $# -ne 1 ]; then + printf "%bError: %bWrong number of parameters.\nUsage: ./make-release.sh \n" "${RED}" "${NC}" + exit 1 + fi + + [ -z "$QUAY_USERNAME" ] && echo "QUAY_USERNAME is not set" && exit 1 + [ -z "$QUAY_PASSWORD" ] && echo "QUAY_PASSWORD is not set" && exit 1 + [ -z "$GIT_USER" ] && echo "GIT_USER is not set" && exit 1 + [ -z "$GIT_PASSWORD" ] && echo "GIT_PASSWORD is not set" && exit 1 + command -v operator-courier >/dev/null 2>&1 || { echo >&2 "operator-courier is not installed. Aborting."; exit 1; } + command -v operator-sdk >/dev/null 2>&1 || { echo >&2 "operator-sdk is not installed. Aborting."; exit 1; } + + local operatorVersion=$(operator-sdk version) + [[ $operatorVersion =~ .*v0.10.0.* ]] || echo "operator-sdk v0.10.0 is required" && exit 1 +} + +ask() { + while true; do + read -r -p "$@ " yn + case $yn in + [Yy]* ) return 0;; + [Nn]* ) return 1;; + * ) echo "Please answer (Y)es or (N)o.";; + esac + done +} + +resetLocalChanges() { + set +e + ask "1. Reset local changes?" + result=$? + set -e + + if [[ $result == 0 ]]; then + git fetch ${GIT_REMOTE_UPSTREAM} + git pull ${GIT_REMOTE_UPSTREAM} master + elif [[ $result == 1 ]]; then + echo "SKIPPED" + fi +} + +createLocalBranch() { + set +e + ask "2. Create local '$RELEASE' branch?" + result=$? + set -e + + if [[ $result == 0 ]]; then + git checkout -b $RELEASE + elif [[ $result == 1 ]]; then + echo "SKIPPED" + fi +} + +releaseOperatorCode() { + set +e + ask "3. Release operator code?" + result=$? + set -e + + if [[ $result == 0 ]]; then + local defaultsgo=$BASE_DIR/pkg/deploy/defaults.go + + echo "3.1 Launch 'release-operator-code.sh' script" + . ${BASE_DIR}/release-operator-code.sh $RELEASE + + echo "3.2 Validate pkg/deploy/defaults.go" + grep -q "defaultCheServerImageTag = \""$RELEASE"\"" $defaultsgo + grep -q "defaultDevfileRegistryUpstreamImage = \"quay.io/eclipse/che-devfile-registry:"$RELEASE"\"" $defaultsgo + grep -q "defaultPluginRegistryUpstreamImage = \"quay.io/eclipse/che-plugin-registry:"$RELEASE"\"" $defaultsgo + grep -q "defaultKeycloakUpstreamImage = \"quay.io/eclipse/che-keycloak:"$RELEASE"\"" $defaultsgo + elif [[ $result == 1 ]]; then + echo "SKIPPED" + fi +} + +commitDefaultsGoChanges() { + set +e + ask "4. Commit changes?" + result=$? + set -e + + if [[ $result == 0 ]]; then + git commit -am "Update defaults tags to "$RELEASE --singoff + elif [[ $result == 1 ]]; then + echo "SKIPPED" + fi +} + +pushImage() { + set +e + ask "5. Push image to quay.io?" + result=$? + set -e + + if [[ $result == 0 ]]; then + docker login quay.io + docker push quay.io/eclipse/che-operator:$RELEASE + elif [[ $result == 1 ]]; then + echo "SKIPPED" + fi +} + +releaseOlmFiles() { + set +e + ask "6. Release OLM files?" + result=$? + set -e + + if [[ $result == 0 ]]; then + echo "6.1 Launch 'olm/release-olm-files.sh' script" + . $BASE_DIR/olm/release-olm-files.sh $RELEASE + + local openshift=$BASE_DIR/olm/eclipse-che-preview-openshift/deploy/olm-catalog/eclipse-che-preview-openshift + local kubernetes=$BASE_DIR/olm/eclipse-che-preview-kubernetes/deploy/olm-catalog/eclipse-che-preview-kubernetes + + echo "6.2 Validate files" + grep -q "currentCSV: eclipse-che-preview-openshift.v"$RELEASE $openshift/eclipse-che-preview-openshift.package.yaml + grep -q "currentCSV: eclipse-che-preview-kubernetes.v"$RELEASE $kubernetes/eclipse-che-preview-kubernetes.package.yaml + grep -q "version: "$RELEASE $openshift/$RELEASE/eclipse-che-preview-openshift.v$RELEASE.clusterserviceversion.yaml + grep -q "version: "$RELEASE $kubernetes/$RELEASE/eclipse-che-preview-kubernetes.v$RELEASE.clusterserviceversion.yaml + test -f $kubernetes/$RELEASE/eclipse-che-preview-kubernetes.crd.yaml + test -f $openshift/$RELEASE/eclipse-che-preview-openshift.crd.yaml + + echo "6.3 It is needed to check diff files manully" + echo $openshift/$RELEASE/eclipse-che-preview-openshift.v$RELEASE.clusterserviceversion.yaml.diff + echo $kubernetes/$RELEASE/eclipse-che-preview-kubernetes.v$RELEASE.clusterserviceversion.yaml.diff + echo $openshift/$RELEASE/eclipse-che-preview-openshift.crd.yaml.diff + echo $kubernetes/$RELEASE/eclipse-che-preview-kubernetes.crd.yaml.diff + read -p "Press enter to continue" + elif [[ $result == 1 ]]; then + echo "SKIPPED" + fi +} + +commitOlmChanges() { + set +e + ask "7. Commit changes?" + result=$? + set -e + + if [[ $result == 0 ]]; then + git add -A + git commit -m "Release OLM files to "$RELEASE --singoff + elif [[ $result == 1 ]]; then + echo "SKIPPED" + fi +} + +pushOlmFiles() { + set +e + ask "8. Push OLM files to quay.io?" + result=$? + set -e + + if [[ $result == 0 ]]; then + . $BASE_DIR/olm/push-olm-files-to-quay.sh + + read -p "Validate RELEASES page on quay.io. Press enter to open the browser" + xdg-open https://quay.io/application/eclipse-che-operator-kubernetes/eclipse-che-preview-kubernetes + + read -p "Validate RELEASES page on quay.io. Press enter to open the browser" + xdg-open https://quay.io/application/eclipse-che-operator-openshift/eclipse-che-preview-openshift + + read -p "Press enter to continue" + elif [[ $result == 1 ]]; then + echo "SKIPPED" + fi +} + +pushChanges() { + set +e + ask "9. Push changes?" + result=$? + set -e + + if [[ $result == 0 ]]; then + git push origin $RELEASE + git tag -a $RELEASE + git push --tags origin + elif [[ $result == 1 ]]; then + echo "SKIPPED" + fi +} + +run() { + RELEASE="$1" + GIT_REMOTE_UPSTREAM="git@github.com:eclipse/che-operator.git" + CURRENT_DIR=$(pwd) + BASE_DIR=$(cd "$(dirname "$0")"; pwd) + + resetLocalChanges + createLocalBranch + releaseOperatorCode + commitDefaultsGoChanges + pushImage + releaseOlmFiles + commitOlmChanges + pushOlmFiles + pushChanges +} + +init "$@" +check "$@" +run "$@" diff --git a/olm/release-olm-files.sh b/olm/release-olm-files.sh index bc83482bf4..1315b4cdb1 100755 --- a/olm/release-olm-files.sh +++ b/olm/release-olm-files.sh @@ -77,5 +77,9 @@ do diff -u "${packageFolderPath}/${lastPackagePreReleaseVersion}/${packageName}.v${lastPackagePreReleaseVersion}.clusterserviceversion.yaml" \ "${packageFolderPath}/${RELEASE}/${packageName}.v${RELEASE}.clusterserviceversion.yaml" \ > "${packageFolderPath}/${RELEASE}/${packageName}.v${RELEASE}.clusterserviceversion.yaml.diff" || true + + diff -u "${packageFolderPath}/${lastPackagePreReleaseVersion}/${packageName}.crd.yaml" \ + "${packageFolderPath}/${RELEASE}/${packageName}.crd.yaml" \ + > "${packageFolderPath}/${RELEASE}/${packageName}.crd.yaml.diff" || true done cd "${CURRENT_DIR}" From 08d5ab91e72c54322227591ffa5f2f57c0af90e1 Mon Sep 17 00:00:00 2001 From: Anatoliy Bazko Date: Fri, 24 Jan 2020 10:00:57 +0200 Subject: [PATCH 2/2] Minor fixes Signed-off-by: Anatoliy Bazko --- RELEASE.md | 6 ++---- make-release.sh | 46 ++++++++++++++++++++++++++-------------------- 2 files changed, 28 insertions(+), 24 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index deca76f609..0c3d3d30f3 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -10,20 +10,18 @@ Start a cluster using `cluster-bot` application. -To be able to test update it is needed to created some user before. Login as `kubeadmin`. At the middle of the dashboard click `Update OAuth configuration`. Then `Identidy providers` -> `Add` -> `HTPassword` and upload a htpassword file (can be created with HTPassword utility). Login using HTPassword, logout and login again as `kubeadmin`. Go to `kube:admin` menu -> `Copy Login Command` -> `Display Token` and launch to showing command in the terminal. Now it is possible to test update by launching: +To be able to test update it is needed to created some user before. Login as `kubeadmin`. At the middle of the dashboard click `Update OAuth configuration`. Then `Identity providers` -> `Add` -> `HTPassword` and upload a htpassword file (can be created with HTPassword utility). Login using HTPassword, logout and login again as `kubeadmin`. Go to `kube:admin` menu -> `Copy Login Command` -> `Display Token` and launch to showing command in the terminal. Now it is possible to test update: ```bash olm/testUpdates.sh openshift stable ``` -Open Eclipse Che dashboard to validate that the correct version is installed and workspace can be created: +Open Eclipse Che dashboard in the anonymous to validate that the correct version is installed and workspace can be created: ```bash echo http://$(kubectl get ingress -n che | grep ^che | awk -F ' ' '{ print $2 }') ``` -Open the url in the anonymous tab. - ## 3. Testing release on minikube Run script to test updates: diff --git a/make-release.sh b/make-release.sh index 8ef98a2fd6..132d23af58 100755 --- a/make-release.sh +++ b/make-release.sh @@ -11,33 +11,39 @@ # Red Hat, Inc. - initial API and implementation set -e -set -u init() { - RED='\033[0;31m' - NC='\033[0m' + RED='\e[31m' + NC='\e[0m' + YELLOW='\e[33m' + GREEN='\e[32m' } check() { + echo -e $RED"##############################################" + echo -e $RED" This is a draft version of release script." + echo -e $RED" It is needed to check all steps manually." + echo -e $RED"##############################################"$NC + + if [ $# -ne 1 ]; then printf "%bError: %bWrong number of parameters.\nUsage: ./make-release.sh \n" "${RED}" "${NC}" exit 1 fi - [ -z "$QUAY_USERNAME" ] && echo "QUAY_USERNAME is not set" && exit 1 - [ -z "$QUAY_PASSWORD" ] && echo "QUAY_PASSWORD is not set" && exit 1 - [ -z "$GIT_USER" ] && echo "GIT_USER is not set" && exit 1 - [ -z "$GIT_PASSWORD" ] && echo "GIT_PASSWORD is not set" && exit 1 - command -v operator-courier >/dev/null 2>&1 || { echo >&2 "operator-courier is not installed. Aborting."; exit 1; } - command -v operator-sdk >/dev/null 2>&1 || { echo >&2 "operator-sdk is not installed. Aborting."; exit 1; } + [ -z "$QUAY_USERNAME" ] && echo -e $RED"QUAY_USERNAME is not set"$NC && exit 1 + [ -z "$QUAY_PASSWORD" ] && echo -e $RED"QUAY_PASSWORD is not set"$NC && exit 1 + command -v operator-courier >/dev/null 2>&1 || { echo -e $RED"operator-courier is not installed. Aborting."$NC; exit 1; } + command -v operator-sdk >/dev/null 2>&1 || { echo -e $RED"operator-sdk is not installed. Aborting."$NC; exit 1; } local operatorVersion=$(operator-sdk version) - [[ $operatorVersion =~ .*v0.10.0.* ]] || echo "operator-sdk v0.10.0 is required" && exit 1 + [[ ! $operatorVersion =~ .*v0.10.0.* ]] || { echo -e $RED"operator-sdk v0.10.0 is required"$NC; exit 1; } } ask() { while true; do - read -r -p "$@ " yn + echo -e $GREEN$@$NC" (Y)es or (N)o" + read -r yn case $yn in [Yy]* ) return 0;; [Nn]* ) return 1;; @@ -56,7 +62,7 @@ resetLocalChanges() { git fetch ${GIT_REMOTE_UPSTREAM} git pull ${GIT_REMOTE_UPSTREAM} master elif [[ $result == 1 ]]; then - echo "SKIPPED" + echo -e $YELLOW"> SKIPPED"$NC fi } @@ -69,7 +75,7 @@ createLocalBranch() { if [[ $result == 0 ]]; then git checkout -b $RELEASE elif [[ $result == 1 ]]; then - echo "SKIPPED" + echo -e $YELLOW"> SKIPPED"$NC fi } @@ -91,7 +97,7 @@ releaseOperatorCode() { grep -q "defaultPluginRegistryUpstreamImage = \"quay.io/eclipse/che-plugin-registry:"$RELEASE"\"" $defaultsgo grep -q "defaultKeycloakUpstreamImage = \"quay.io/eclipse/che-keycloak:"$RELEASE"\"" $defaultsgo elif [[ $result == 1 ]]; then - echo "SKIPPED" + echo -e $YELLOW"> SKIPPED"$NC fi } @@ -104,7 +110,7 @@ commitDefaultsGoChanges() { if [[ $result == 0 ]]; then git commit -am "Update defaults tags to "$RELEASE --singoff elif [[ $result == 1 ]]; then - echo "SKIPPED" + echo -e $YELLOW"> SKIPPED"$NC fi } @@ -118,7 +124,7 @@ pushImage() { docker login quay.io docker push quay.io/eclipse/che-operator:$RELEASE elif [[ $result == 1 ]]; then - echo "SKIPPED" + echo -e $YELLOW"> SKIPPED"$NC fi } @@ -150,7 +156,7 @@ releaseOlmFiles() { echo $kubernetes/$RELEASE/eclipse-che-preview-kubernetes.crd.yaml.diff read -p "Press enter to continue" elif [[ $result == 1 ]]; then - echo "SKIPPED" + echo -e $YELLOW"> SKIPPED"$NC fi } @@ -164,7 +170,7 @@ commitOlmChanges() { git add -A git commit -m "Release OLM files to "$RELEASE --singoff elif [[ $result == 1 ]]; then - echo "SKIPPED" + echo -e $YELLOW"> SKIPPED"$NC fi } @@ -185,7 +191,7 @@ pushOlmFiles() { read -p "Press enter to continue" elif [[ $result == 1 ]]; then - echo "SKIPPED" + echo -e $YELLOW"> SKIPPED"$NC fi } @@ -200,7 +206,7 @@ pushChanges() { git tag -a $RELEASE git push --tags origin elif [[ $result == 1 ]]; then - echo "SKIPPED" + echo -e $YELLOW"> SKIPPED"$NC fi }